Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
ee0be29c
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ee0be29c
编写于
6月 21, 2018
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
monaco tokenize2 fixes
上级
940ad819
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
23 addition
and
16 deletion
+23
-16
src/vs/editor/common/modes/supports/tokenization.ts
src/vs/editor/common/modes/supports/tokenization.ts
+10
-7
src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts
...s/editor/standalone/browser/standaloneThemeServiceImpl.ts
+13
-9
未找到文件。
src/vs/editor/common/modes/supports/tokenization.ts
浏览文件 @
ee0be29c
...
...
@@ -128,15 +128,15 @@ function resolveParsedTokenThemeRules(parsedThemeRules: ParsedTokenThemeRule[],
}
let
colorMap
=
new
ColorMap
();
// ensure default foreground gets id 1 and default background gets id 2
let
foregroundColorId
=
colorMap
.
getId
(
defaultForeground
);
let
backgroundColorId
=
colorMap
.
getId
(
defaultBackground
);
// start with token colors from custom token themes
for
(
let
color
of
customTokenColors
)
{
colorMap
.
getId
(
color
);
}
let
foregroundColorId
=
colorMap
.
getId
(
defaultForeground
);
let
backgroundColorId
=
colorMap
.
getId
(
defaultBackground
);
let
defaults
=
new
ThemeTrieElementRule
(
defaultFontStyle
,
foregroundColorId
,
backgroundColorId
);
let
root
=
new
ThemeTrieElement
(
defaults
);
for
(
let
i
=
0
,
len
=
parsedThemeRules
.
length
;
i
<
len
;
i
++
)
{
...
...
@@ -147,6 +147,8 @@ function resolveParsedTokenThemeRules(parsedThemeRules: ParsedTokenThemeRule[],
return
new
TokenTheme
(
colorMap
,
root
);
}
const
colorRegExp
=
/^#
?([
0-9A-Fa-f
]{6})([
0-9A-Fa-f
]{2})?
$/
;
export
class
ColorMap
{
private
_lastColorId
:
number
;
...
...
@@ -163,10 +165,11 @@ export class ColorMap {
if
(
color
===
null
)
{
return
0
;
}
co
lor
=
color
.
toUpperCase
(
);
if
(
!
/^
[
0-9A-F
]{6}
$/
.
test
(
color
)
)
{
throw
new
Error
(
'
Illegal
color name
:
'
+
color
);
co
nst
match
=
color
.
match
(
colorRegExp
);
if
(
!
match
)
{
throw
new
Error
(
'
Illegal
value for token color
:
'
+
color
);
}
color
=
match
[
1
].
toUpperCase
();
let
value
=
this
.
_color2id
.
get
(
color
);
if
(
value
)
{
return
value
;
...
...
src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts
浏览文件 @
ee0be29c
...
...
@@ -33,6 +33,7 @@ class StandaloneTheme implements IStandaloneTheme {
private
_tokenTheme
:
TokenTheme
;
constructor
(
name
:
string
,
standaloneThemeData
:
IStandaloneThemeData
)
{
this
.
themeData
=
standaloneThemeData
;
let
base
=
standaloneThemeData
.
base
;
if
(
name
.
length
>
0
)
{
this
.
id
=
base
+
'
'
+
name
;
...
...
@@ -42,7 +43,7 @@ class StandaloneTheme implements IStandaloneTheme {
this
.
themeName
=
base
;
}
this
.
colors
=
null
;
this
.
defaultColors
=
{}
;
this
.
defaultColors
=
Object
.
create
(
null
)
;
this
.
_tokenTheme
=
null
;
}
...
...
@@ -78,9 +79,9 @@ class StandaloneTheme implements IStandaloneTheme {
}
public
getColor
(
colorId
:
ColorIdentifier
,
useDefault
?:
boolean
):
Color
{
const
color
s
=
this
.
getColors
()
;
if
(
color
s
.
hasOwnProperty
(
colorId
)
)
{
return
color
s
[
colorId
]
;
const
color
=
this
.
getColors
()[
colorId
]
;
if
(
color
)
{
return
color
;
}
if
(
useDefault
!==
false
)
{
return
this
.
getDefault
(
colorId
);
...
...
@@ -89,10 +90,11 @@ class StandaloneTheme implements IStandaloneTheme {
}
private
getDefault
(
colorId
:
ColorIdentifier
):
Color
{
if
(
this
.
defaultColors
.
hasOwnProperty
(
colorId
))
{
return
this
.
defaultColors
[
colorId
];
let
color
=
this
.
defaultColors
[
colorId
];
if
(
color
)
{
return
color
;
}
let
color
=
colorRegistry
.
resolveDefaultColor
(
colorId
,
this
);
color
=
colorRegistry
.
resolveDefaultColor
(
colorId
,
this
);
this
.
defaultColors
[
colorId
]
=
color
;
return
color
;
}
...
...
@@ -116,11 +118,13 @@ class StandaloneTheme implements IStandaloneTheme {
if
(
this
.
themeData
.
inherit
)
{
let
baseData
=
getBuiltinRules
(
this
.
themeData
.
base
);
rules
=
baseData
.
rules
;
customTokenColors
=
baseData
.
customTokenColors
||
[];
if
(
baseData
.
customTokenColors
)
{
customTokenColors
=
baseData
.
customTokenColors
;
}
}
rules
=
rules
.
concat
(
this
.
themeData
.
rules
);
if
(
this
.
themeData
.
customTokenColors
)
{
customTokenColors
=
customTokenColors
.
concat
(
this
.
themeData
.
customTokenColors
)
;
customTokenColors
=
this
.
themeData
.
customTokenColors
;
}
this
.
_tokenTheme
=
TokenTheme
.
createFromRawTokenTheme
(
rules
,
customTokenColors
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录