Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
eb87600b
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,发现更多精彩内容 >>
提交
eb87600b
编写于
11月 07, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use more URIs
上级
0129edae
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
131 addition
and
19 deletion
+131
-19
src/vs/editor/browser/services/codeEditorServiceImpl.ts
src/vs/editor/browser/services/codeEditorServiceImpl.ts
+2
-10
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+3
-3
src/vs/editor/test/browser/services/decorationRenderOptions.test.ts
...tor/test/browser/services/decorationRenderOptions.test.ts
+3
-3
src/vs/workbench/api/node/extHostTextEditor.ts
src/vs/workbench/api/node/extHostTextEditor.ts
+1
-1
src/vs/workbench/api/node/extHostTypeConverters.ts
src/vs/workbench/api/node/extHostTypeConverters.ts
+122
-2
未找到文件。
src/vs/editor/browser/services/codeEditorServiceImpl.ts
浏览文件 @
eb87600b
...
...
@@ -401,11 +401,7 @@ class DecorationCSSRules {
if
(
typeof
opts
!==
'
undefined
'
)
{
this
.
collectBorderSettingsCSSText
(
opts
,
cssTextArr
);
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
'
)));
}
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
...
...
@@ -432,11 +428,7 @@ class DecorationCSSRules {
let
cssTextArr
:
string
[]
=
[];
if
(
typeof
opts
.
gutterIconPath
!==
'
undefined
'
)
{
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
,
URI
.
revive
(
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
浏览文件 @
eb87600b
...
...
@@ -534,10 +534,10 @@ export interface IThemeDecorationRenderOptions {
textDecoration
?:
string
;
cursor
?:
string
;
color
?:
string
|
ThemeColor
;
opacity
?:
number
;
opacity
?:
string
;
letterSpacing
?:
string
;
gutterIconPath
?:
string
|
UriComponents
;
gutterIconPath
?:
UriComponents
;
gutterIconSize
?:
string
;
overviewRulerColor
?:
string
|
ThemeColor
;
...
...
@@ -551,7 +551,7 @@ export interface IThemeDecorationRenderOptions {
*/
export
interface
IContentDecorationRenderOptions
{
contentText
?:
string
;
contentIconPath
?:
string
|
UriComponents
;
contentIconPath
?:
UriComponents
;
border
?:
string
;
borderColor
?:
string
|
ThemeColor
;
...
...
src/vs/editor/test/browser/services/decorationRenderOptions.test.ts
浏览文件 @
eb87600b
...
...
@@ -134,7 +134,7 @@ suite('Decoration Render Options', () => {
// unix file path (used as string)
let
s
=
new
TestCodeEditorServiceImpl
(
themeServiceMock
,
styleSheet
);
s
.
registerDecorationType
(
'
example
'
,
{
gutterIconPath
:
'
/Users/foo/bar.png
'
});
s
.
registerDecorationType
(
'
example
'
,
{
gutterIconPath
:
URI
.
file
(
'
/Users/foo/bar.png
'
)
});
let
sheet
=
readStyleSheet
(
styleSheet
);
//.innerHTML || styleSheet.sheet.toString();
assert
(
sheet
.
indexOf
(
'
background: url(
\'
file:///Users/foo/bar.png
\'
) center center no-repeat;
'
)
>
0
...
...
@@ -143,7 +143,7 @@ suite('Decoration Render Options', () => {
// windows file path (used as string)
s
=
new
TestCodeEditorServiceImpl
(
themeServiceMock
,
styleSheet
);
s
.
registerDecorationType
(
'
example
'
,
{
gutterIconPath
:
'
c:
\\
files
\\
miles
\\
more.png
'
});
s
.
registerDecorationType
(
'
example
'
,
{
gutterIconPath
:
URI
.
file
(
'
c:
\\
files
\\
miles
\\
more.png
'
)
});
sheet
=
readStyleSheet
(
styleSheet
);
// TODO@Alex test fails
// assert(
...
...
@@ -162,7 +162,7 @@ suite('Decoration Render Options', () => {
// single quote must always be escaped/encoded
s
=
new
TestCodeEditorServiceImpl
(
themeServiceMock
,
styleSheet
);
s
.
registerDecorationType
(
'
example
'
,
{
gutterIconPath
:
'
/Users/foo/b
\'
ar.png
'
});
s
.
registerDecorationType
(
'
example
'
,
{
gutterIconPath
:
URI
.
file
(
'
/Users/foo/b
\'
ar.png
'
)
});
sheet
=
readStyleSheet
(
styleSheet
);
assert
(
sheet
.
indexOf
(
'
background: url(
\'
file:///Users/foo/b%27ar.png
\'
) center center no-repeat;
'
)
>
0
...
...
src/vs/workbench/api/node/extHostTextEditor.ts
浏览文件 @
eb87600b
...
...
@@ -25,7 +25,7 @@ export class TextEditorDecorationType implements vscode.TextEditorDecorationType
constructor
(
proxy
:
MainThreadTextEditorsShape
,
options
:
vscode
.
DecorationRenderOptions
)
{
this
.
key
=
TextEditorDecorationType
.
_Keys
.
nextId
();
this
.
_proxy
=
proxy
;
this
.
_proxy
.
$registerTextEditorDecorationType
(
this
.
key
,
<
any
>
/* URI vs Uri */
options
);
this
.
_proxy
.
$registerTextEditorDecorationType
(
this
.
key
,
TypeConverters
.
DecorationRenderOptions
.
from
(
options
)
);
}
public
dispose
():
void
{
...
...
src/vs/workbench/api/node/extHostTypeConverters.ts
浏览文件 @
eb87600b
...
...
@@ -8,8 +8,8 @@ import * as types from './extHostTypes';
import
*
as
search
from
'
vs/workbench/parts/search/common/search
'
;
import
{
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
EditorViewColumn
}
from
'
vs/workbench/api/shared/editor
'
;
import
{
IDecorationOptions
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EndOfLineSequence
}
from
'
vs/editor/common/model
'
;
import
{
IDecorationOptions
,
IThemeDecorationRenderOptions
,
IDecorationRenderOptions
,
IContentDecorationRenderOptions
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EndOfLineSequence
,
TrackedRangeStickiness
}
from
'
vs/editor/common/model
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
ProgressLocation
as
MainProgressLocation
}
from
'
vs/platform/progress/common/progress
'
;
...
...
@@ -252,6 +252,126 @@ export function fromRangeOrRangeWithMessage(ranges: vscode.Range[] | vscode.Deco
}
}
function
pathOrURIToURI
(
value
:
string
|
URI
):
URI
{
if
(
typeof
value
===
'
undefined
'
)
{
return
value
;
}
if
(
typeof
value
===
'
string
'
)
{
return
URI
.
file
(
value
);
}
else
{
return
value
;
}
}
export
namespace
ThemableDecorationAttachmentRenderOptions
{
export
function
from
(
options
:
vscode
.
ThemableDecorationAttachmentRenderOptions
):
IContentDecorationRenderOptions
{
if
(
typeof
options
===
'
undefined
'
)
{
return
options
;
}
return
{
contentText
:
options
.
contentText
,
contentIconPath
:
pathOrURIToURI
(
options
.
contentIconPath
),
border
:
options
.
border
,
borderColor
:
<
string
|
types
.
ThemeColor
>
options
.
borderColor
,
fontStyle
:
options
.
fontStyle
,
fontWeight
:
options
.
fontWeight
,
textDecoration
:
options
.
textDecoration
,
color
:
<
string
|
types
.
ThemeColor
>
options
.
color
,
backgroundColor
:
<
string
|
types
.
ThemeColor
>
options
.
backgroundColor
,
margin
:
options
.
margin
,
width
:
options
.
width
,
height
:
options
.
height
,
};
}
}
export
namespace
ThemableDecorationRenderOptions
{
export
function
from
(
options
:
vscode
.
ThemableDecorationRenderOptions
):
IThemeDecorationRenderOptions
{
if
(
typeof
options
===
'
undefined
'
)
{
return
options
;
}
return
{
backgroundColor
:
<
string
|
types
.
ThemeColor
>
options
.
backgroundColor
,
outline
:
options
.
outline
,
outlineColor
:
<
string
|
types
.
ThemeColor
>
options
.
outlineColor
,
outlineStyle
:
options
.
outlineStyle
,
outlineWidth
:
options
.
outlineWidth
,
border
:
options
.
border
,
borderColor
:
<
string
|
types
.
ThemeColor
>
options
.
borderColor
,
borderRadius
:
options
.
borderRadius
,
borderSpacing
:
options
.
borderSpacing
,
borderStyle
:
options
.
borderStyle
,
borderWidth
:
options
.
borderWidth
,
fontStyle
:
options
.
fontStyle
,
fontWeight
:
options
.
fontWeight
,
textDecoration
:
options
.
textDecoration
,
cursor
:
options
.
cursor
,
color
:
<
string
|
types
.
ThemeColor
>
options
.
color
,
opacity
:
options
.
opacity
,
letterSpacing
:
options
.
letterSpacing
,
gutterIconPath
:
pathOrURIToURI
(
options
.
gutterIconPath
),
gutterIconSize
:
options
.
gutterIconSize
,
overviewRulerColor
:
<
string
|
types
.
ThemeColor
>
options
.
overviewRulerColor
,
before
:
ThemableDecorationAttachmentRenderOptions
.
from
(
options
.
before
),
after
:
ThemableDecorationAttachmentRenderOptions
.
from
(
options
.
after
),
};
}
}
export
namespace
DecorationRangeBehavior
{
export
function
from
(
value
:
types
.
DecorationRangeBehavior
):
TrackedRangeStickiness
{
if
(
typeof
value
===
'
undefined
'
)
{
return
value
;
}
switch
(
value
)
{
case
types
.
DecorationRangeBehavior
.
OpenOpen
:
return
TrackedRangeStickiness
.
AlwaysGrowsWhenTypingAtEdges
;
case
types
.
DecorationRangeBehavior
.
ClosedClosed
:
return
TrackedRangeStickiness
.
NeverGrowsWhenTypingAtEdges
;
case
types
.
DecorationRangeBehavior
.
OpenClosed
:
return
TrackedRangeStickiness
.
GrowsOnlyWhenTypingBefore
;
case
types
.
DecorationRangeBehavior
.
ClosedOpen
:
return
TrackedRangeStickiness
.
GrowsOnlyWhenTypingAfter
;
}
}
}
export
namespace
DecorationRenderOptions
{
export
function
from
(
options
:
vscode
.
DecorationRenderOptions
):
IDecorationRenderOptions
{
return
{
isWholeLine
:
options
.
isWholeLine
,
rangeBehavior
:
DecorationRangeBehavior
.
from
(
options
.
rangeBehavior
),
overviewRulerLane
:
options
.
overviewRulerLane
,
light
:
ThemableDecorationRenderOptions
.
from
(
options
.
light
),
dark
:
ThemableDecorationRenderOptions
.
from
(
options
.
dark
),
backgroundColor
:
<
string
|
types
.
ThemeColor
>
options
.
backgroundColor
,
outline
:
options
.
outline
,
outlineColor
:
<
string
|
types
.
ThemeColor
>
options
.
outlineColor
,
outlineStyle
:
options
.
outlineStyle
,
outlineWidth
:
options
.
outlineWidth
,
border
:
options
.
border
,
borderColor
:
<
string
|
types
.
ThemeColor
>
options
.
borderColor
,
borderRadius
:
options
.
borderRadius
,
borderSpacing
:
options
.
borderSpacing
,
borderStyle
:
options
.
borderStyle
,
borderWidth
:
options
.
borderWidth
,
fontStyle
:
options
.
fontStyle
,
fontWeight
:
options
.
fontWeight
,
textDecoration
:
options
.
textDecoration
,
cursor
:
options
.
cursor
,
color
:
<
string
|
types
.
ThemeColor
>
options
.
color
,
opacity
:
options
.
opacity
,
letterSpacing
:
options
.
letterSpacing
,
gutterIconPath
:
pathOrURIToURI
(
options
.
gutterIconPath
),
gutterIconSize
:
options
.
gutterIconSize
,
overviewRulerColor
:
<
string
|
types
.
ThemeColor
>
options
.
overviewRulerColor
,
before
:
ThemableDecorationAttachmentRenderOptions
.
from
(
options
.
before
),
after
:
ThemableDecorationAttachmentRenderOptions
.
from
(
options
.
after
),
};
}
}
export
namespace
TextEdit
{
export
function
from
(
edit
:
vscode
.
TextEdit
):
modes
.
TextEdit
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录