Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b6d746a0
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,发现更多精彩内容 >>
提交
b6d746a0
编写于
11月 01, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tokenIterator uses only standardTokenType
上级
318bafe3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
17 deletion
+21
-17
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+2
-2
src/vs/editor/common/model/tokenIterator.ts
src/vs/editor/common/model/tokenIterator.ts
+7
-7
src/vs/workbench/parts/themes/test/electron-browser/themes.test.contribution.ts
.../themes/test/electron-browser/themes.test.contribution.ts
+12
-8
未找到文件。
src/vs/editor/common/editorCommon.ts
浏览文件 @
b6d746a0
...
...
@@ -11,7 +11,7 @@ import URI from 'vs/base/common/uri';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ServicesAccessor
,
IConstructorSignature1
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IMode
}
from
'
vs/editor/common/modes
'
;
import
{
LineTokens
}
from
'
vs/editor/common/core/lineTokens
'
;
import
{
LineTokens
,
StandardTokenType
}
from
'
vs/editor/common/core/lineTokens
'
;
import
{
ScrollbarVisibility
}
from
'
vs/base/common/scrollable
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
...
...
@@ -1295,7 +1295,7 @@ export interface IWordRange {
* @internal
*/
export
interface
ITokenInfo
{
readonly
type
:
string
;
readonly
standardType
:
StandardTokenType
;
readonly
lineNumber
:
number
;
readonly
startColumn
:
number
;
readonly
endColumn
:
number
;
...
...
src/vs/editor/common/model/tokenIterator.ts
浏览文件 @
b6d746a0
...
...
@@ -5,24 +5,24 @@
'
use strict
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
LineToken
}
from
'
vs/editor/common/core/lineTokens
'
;
import
{
LineToken
,
StandardTokenType
}
from
'
vs/editor/common/core/lineTokens
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
class
TokenInfo
implements
editorCommon
.
ITokenInfo
{
_tokenInfoBrand
:
void
;
_actual
:
LineToken
;
public
lineNumber
:
number
;
public
startColumn
:
number
;
public
endColumn
:
number
;
public
type
:
string
;
readonly
_actual
:
LineToken
;
public
readonly
lineNumber
:
number
;
public
readonly
startColumn
:
number
;
public
readonly
endColumn
:
number
;
public
readonly
standardType
:
StandardTokenType
;
constructor
(
actual
:
LineToken
,
lineNumber
:
number
)
{
this
.
_actual
=
actual
;
this
.
lineNumber
=
lineNumber
;
this
.
startColumn
=
this
.
_actual
.
startOffset
+
1
;
this
.
endColumn
=
this
.
_actual
.
endOffset
+
1
;
this
.
type
=
this
.
_actual
.
t
ype
;
this
.
standardType
=
this
.
_actual
.
standardT
ype
;
}
}
...
...
src/vs/workbench/parts/themes/test/electron-browser/themes.test.contribution.ts
浏览文件 @
b6d746a0
...
...
@@ -118,18 +118,22 @@ class Snapper {
return
this
.
modeService
.
getOrCreateModeByFilenameOrFirstLine
(
fileName
).
then
(
mode
=>
{
let
result
:
Data
[]
=
[];
let
model
=
new
TextModelWithTokens
([],
TextModel
.
toRawText
(
content
,
TextModel
.
DEFAULT_CREATION_OPTIONS
),
mode
.
getId
());
model
.
tokenIterator
({
lineNumber
:
1
,
column
:
1
},
iterator
=>
{
while
(
iterator
.
hasNext
())
{
let
tokenInfo
=
iterator
.
next
();
let
lineNumber
=
tokenInfo
.
lineNumber
;
let
content
=
model
.
getValueInRange
({
startLineNumber
:
lineNumber
,
endLineNumber
:
lineNumber
,
startColumn
:
tokenInfo
.
startColumn
,
endColumn
:
tokenInfo
.
endColumn
});
for
(
let
lineNumber
=
1
,
lineCount
=
model
.
getLineCount
();
lineNumber
<=
lineCount
;
lineNumber
++
)
{
let
lineTokens
=
model
.
getLineTokens
(
lineNumber
,
false
);
let
lineContent
=
model
.
getLineContent
(
lineNumber
);
for
(
let
i
=
0
,
len
=
lineTokens
.
getTokenCount
();
i
<
len
;
i
++
)
{
let
tokenType
=
lineTokens
.
getTokenType
(
i
);
let
tokenStartOffset
=
lineTokens
.
getTokenStartOffset
(
i
);
let
tokenEndOffset
=
lineTokens
.
getTokenEndOffset
(
i
);
result
.
push
({
c
:
content
,
t
:
this
.
normalizeType
(
token
Info
.
t
ype
),
c
:
lineContent
.
substring
(
tokenStartOffset
,
tokenEndOffset
)
,
t
:
this
.
normalizeType
(
token
T
ype
),
r
:
{}
});
}
}
);
}
return
this
.
appendThemeInformation
(
result
);
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录