Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1ec2438d
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1ec2438d
编写于
12月 13, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove usage of CustomMarshaller for MainThreadEditors (#40169)
上级
ed39dcd7
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
24 addition
and
20 deletion
+24
-20
src/vs/editor/browser/services/codeEditorServiceImpl.ts
src/vs/editor/browser/services/codeEditorServiceImpl.ts
+7
-5
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+3
-3
src/vs/workbench/api/electron-browser/mainThreadEditors.ts
src/vs/workbench/api/electron-browser/mainThreadEditors.ts
+5
-4
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+5
-5
src/vs/workbench/api/node/extHostTextEditor.ts
src/vs/workbench/api/node/extHostTextEditor.ts
+1
-1
src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts
...ectron-browser/api/extHostDocumentSaveParticipant.test.ts
+3
-2
未找到文件。
src/vs/editor/browser/services/codeEditorServiceImpl.ts
浏览文件 @
1ec2438d
...
...
@@ -372,10 +372,12 @@ class DecorationCSSRules {
if
(
typeof
opts
!==
'
undefined
'
)
{
this
.
collectBorderSettingsCSSText
(
opts
,
cssTextArr
);
if
(
typeof
opts
.
contentIconPath
===
'
string
'
)
{
cssTextArr
.
push
(
strings
.
format
(
_CSS_MAP
.
contentIconPath
,
URI
.
file
(
opts
.
contentIconPath
).
toString
().
replace
(
/'/g
,
'
%27
'
)));
}
else
if
(
opts
.
contentIconPath
instanceof
URI
)
{
cssTextArr
.
push
(
strings
.
format
(
_CSS_MAP
.
contentIconPath
,
opts
.
contentIconPath
.
toString
(
true
).
replace
(
/'/g
,
'
%27
'
)));
if
(
typeof
opts
.
contentIconPath
!==
'
undefined
'
)
{
if
(
typeof
opts
.
contentIconPath
===
'
string
'
)
{
cssTextArr
.
push
(
strings
.
format
(
_CSS_MAP
.
contentIconPath
,
URI
.
file
(
opts
.
contentIconPath
).
toString
().
replace
(
/'/g
,
'
%27
'
)));
}
else
{
cssTextArr
.
push
(
strings
.
format
(
_CSS_MAP
.
contentIconPath
,
URI
.
revive
(
opts
.
contentIconPath
).
toString
(
true
).
replace
(
/'/g
,
'
%27
'
)));
}
}
if
(
typeof
opts
.
contentText
===
'
string
'
)
{
const
truncated
=
opts
.
contentText
.
match
(
/^.*$/m
)[
0
];
// only take first line
...
...
@@ -405,7 +407,7 @@ class DecorationCSSRules {
if
(
typeof
opts
.
gutterIconPath
===
'
string
'
)
{
cssTextArr
.
push
(
strings
.
format
(
_CSS_MAP
.
gutterIconPath
,
URI
.
file
(
opts
.
gutterIconPath
).
toString
()));
}
else
{
cssTextArr
.
push
(
strings
.
format
(
_CSS_MAP
.
gutterIconPath
,
opts
.
gutterIconPath
.
toString
(
true
).
replace
(
/'/g
,
'
%27
'
)));
cssTextArr
.
push
(
strings
.
format
(
_CSS_MAP
.
gutterIconPath
,
URI
.
revive
(
opts
.
gutterIconPath
)
.
toString
(
true
).
replace
(
/'/g
,
'
%27
'
)));
}
if
(
typeof
opts
.
gutterIconSize
!==
'
undefined
'
)
{
cssTextArr
.
push
(
strings
.
format
(
_CSS_MAP
.
gutterIconSize
,
opts
.
gutterIconSize
));
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
1ec2438d
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
IMarkdownString
}
from
'
vs/base/common/htmlContent
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
URI
,
{
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
LanguageId
,
LanguageIdentifier
}
from
'
vs/editor/common/modes
'
;
import
{
LineTokens
}
from
'
vs/editor/common/core/lineTokens
'
;
...
...
@@ -1565,7 +1565,7 @@ export interface IThemeDecorationRenderOptions {
color
?:
string
|
ThemeColor
;
letterSpacing
?:
string
;
gutterIconPath
?:
string
|
U
RI
;
gutterIconPath
?:
string
|
U
riComponents
;
gutterIconSize
?:
string
;
overviewRulerColor
?:
string
|
ThemeColor
;
...
...
@@ -1579,7 +1579,7 @@ export interface IThemeDecorationRenderOptions {
*/
export
interface
IContentDecorationRenderOptions
{
contentText
?:
string
;
contentIconPath
?:
string
|
U
RI
;
contentIconPath
?:
string
|
U
riComponents
;
border
?:
string
;
borderColor
?:
string
|
ThemeColor
;
...
...
src/vs/workbench/api/electron-browser/mainThreadEditors.ts
浏览文件 @
1ec2438d
...
...
@@ -176,11 +176,11 @@ export class MainThreadEditors implements MainThreadEditorsShape {
return
TPromise
.
as
(
null
);
}
$trySetDecorationsFast
(
id
:
string
,
key
:
string
,
ranges
:
string
):
TPromise
<
any
>
{
$trySetDecorationsFast
(
id
:
string
,
key
:
string
,
ranges
:
number
[]
):
TPromise
<
any
>
{
if
(
!
this
.
_documentsAndEditors
.
getEditor
(
id
))
{
return
TPromise
.
wrapError
(
disposed
(
`TextEditor(
${
id
}
)`
));
}
this
.
_documentsAndEditors
.
getEditor
(
id
).
setDecorationsFast
(
key
,
/*TODO: marshaller is too slow*/
JSON
.
parse
(
ranges
)
);
this
.
_documentsAndEditors
.
getEditor
(
id
).
setDecorationsFast
(
key
,
ranges
);
return
TPromise
.
as
(
null
);
}
...
...
@@ -213,7 +213,8 @@ export class MainThreadEditors implements MainThreadEditorsShape {
for
(
let
i
=
0
,
len
=
workspaceResourceEdits
.
length
;
i
<
len
;
i
++
)
{
const
workspaceResourceEdit
=
workspaceResourceEdits
[
i
];
if
(
workspaceResourceEdit
.
modelVersionId
)
{
let
model
=
this
.
_modelService
.
getModel
(
workspaceResourceEdit
.
resource
);
const
uri
=
URI
.
revive
(
workspaceResourceEdit
.
resource
);
let
model
=
this
.
_modelService
.
getModel
(
uri
);
if
(
model
&&
model
.
getVersionId
()
!==
workspaceResourceEdit
.
modelVersionId
)
{
// model changed in the meantime
return
TPromise
.
as
(
false
);
...
...
@@ -225,7 +226,7 @@ export class MainThreadEditors implements MainThreadEditorsShape {
let
resourceEdits
:
IResourceEdit
[]
=
[];
for
(
let
i
=
0
,
len
=
workspaceResourceEdits
.
length
;
i
<
len
;
i
++
)
{
const
workspaceResourceEdit
=
workspaceResourceEdits
[
i
];
const
uri
=
workspaceResourceEdit
.
resource
;
const
uri
=
URI
.
revive
(
workspaceResourceEdit
.
resource
)
;
const
edits
=
workspaceResourceEdit
.
edits
;
for
(
let
j
=
0
,
lenJ
=
edits
.
length
;
j
<
lenJ
;
j
++
)
{
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
1ec2438d
...
...
@@ -14,7 +14,7 @@ import {
import
*
as
vscode
from
'
vscode
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
URI
,
{
UriComponents
}
from
'
vs/base/common/uri
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
...
...
@@ -200,7 +200,7 @@ export interface ITextDocumentShowOptions {
}
export
interface
IWorkspaceResourceEdit
{
resource
:
U
RI
;
resource
:
U
riComponents
;
modelVersionId
?:
number
;
edits
:
{
range
?:
IRange
;
...
...
@@ -210,14 +210,14 @@ export interface IWorkspaceResourceEdit {
}
export
interface
MainThreadEditorsShape
extends
IDisposable
{
$tryShowTextDocument
(
resource
:
U
RI
,
options
:
ITextDocumentShowOptions
):
TPromise
<
string
>
;
$tryShowTextDocument
(
resource
:
U
riComponents
,
options
:
ITextDocumentShowOptions
):
TPromise
<
string
>
;
$registerTextEditorDecorationType
(
key
:
string
,
options
:
editorCommon
.
IDecorationRenderOptions
):
void
;
$removeTextEditorDecorationType
(
key
:
string
):
void
;
$tryShowEditor
(
id
:
string
,
position
:
EditorPosition
):
TPromise
<
void
>
;
$tryHideEditor
(
id
:
string
):
TPromise
<
void
>
;
$trySetOptions
(
id
:
string
,
options
:
ITextEditorConfigurationUpdate
):
TPromise
<
any
>
;
$trySetDecorations
(
id
:
string
,
key
:
string
,
ranges
:
editorCommon
.
IDecorationOptions
[]):
TPromise
<
any
>
;
$trySetDecorationsFast
(
id
:
string
,
key
:
string
,
ranges
:
string
):
TPromise
<
any
>
;
$trySetDecorationsFast
(
id
:
string
,
key
:
string
,
ranges
:
number
[]
):
TPromise
<
any
>
;
$tryRevealRange
(
id
:
string
,
range
:
IRange
,
revealType
:
TextEditorRevealType
):
TPromise
<
any
>
;
$trySetSelections
(
id
:
string
,
selections
:
ISelection
[]):
TPromise
<
any
>
;
$tryApplyEdits
(
id
:
string
,
modelVersionId
:
number
,
edits
:
editorCommon
.
ISingleEditOperation
[],
opts
:
IApplyEditsOptions
):
TPromise
<
boolean
>
;
...
...
@@ -673,7 +673,7 @@ export const MainContext = {
MainThreadDialogs
:
createMainId
<
MainThreadDiaglogsShape
>
(
'
MainThreadDiaglogs
'
,
ProxyType
.
CustomMarshaller
),
MainThreadDocuments
:
createMainId
<
MainThreadDocumentsShape
>
(
'
MainThreadDocuments
'
,
ProxyType
.
CustomMarshaller
),
MainThreadDocumentContentProviders
:
createMainId
<
MainThreadDocumentContentProvidersShape
>
(
'
MainThreadDocumentContentProviders
'
,
ProxyType
.
CustomMarshaller
),
MainThreadEditors
:
createMainId
<
MainThreadEditorsShape
>
(
'
MainThreadEditors
'
,
ProxyType
.
CustomMarshaller
),
MainThreadEditors
:
createMainId
<
MainThreadEditorsShape
>
(
'
MainThreadEditors
'
),
MainThreadErrors
:
createMainId
<
MainThreadErrorsShape
>
(
'
MainThreadErrors
'
,
ProxyType
.
CustomMarshaller
),
MainThreadTreeViews
:
createMainId
<
MainThreadTreeViewsShape
>
(
'
MainThreadTreeViews
'
,
ProxyType
.
CustomMarshaller
),
MainThreadLanguageFeatures
:
createMainId
<
MainThreadLanguageFeaturesShape
>
(
'
MainThreadLanguageFeatures
'
,
ProxyType
.
CustomMarshaller
),
...
...
src/vs/workbench/api/node/extHostTextEditor.ts
浏览文件 @
1ec2438d
...
...
@@ -435,7 +435,7 @@ export class ExtHostTextEditor implements vscode.TextEditor {
return
this
.
_proxy
.
$trySetDecorationsFast
(
this
.
_id
,
decorationType
.
key
,
/*TODO: marshaller is too slow*/
JSON
.
stringify
(
_ranges
)
_ranges
);
}
}
...
...
src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts
浏览文件 @
1ec2438d
...
...
@@ -324,15 +324,16 @@ suite('ExtHostDocumentSaveParticipant', () => {
$tryApplyWorkspaceEdit
(
_edits
:
IWorkspaceResourceEdit
[])
{
for
(
const
{
resource
,
edits
}
of
_edits
)
{
const
uri
=
URI
.
revive
(
resource
);
for
(
const
{
newText
,
range
}
of
edits
)
{
documents
.
$acceptModelChanged
(
resource
.
toString
(),
{
documents
.
$acceptModelChanged
(
uri
.
toString
(),
{
changes
:
[{
range
,
rangeLength
:
undefined
,
text
:
newText
}],
eol
:
undefined
,
versionId
:
documents
.
getDocumentData
(
resource
).
version
+
1
versionId
:
documents
.
getDocumentData
(
uri
).
version
+
1
},
true
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录