Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
482b6972
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,发现更多精彩内容 >>
提交
482b6972
编写于
9月 21, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TokensInflatorMap holds on to top level mode id
上级
7cbc3587
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
15 deletion
+18
-15
src/vs/editor/common/model/modelLine.ts
src/vs/editor/common/model/modelLine.ts
+2
-2
src/vs/editor/common/model/textModelWithTokens.ts
src/vs/editor/common/model/textModelWithTokens.ts
+2
-2
src/vs/editor/common/model/tokensBinaryEncoding.ts
src/vs/editor/common/model/tokensBinaryEncoding.ts
+4
-1
src/vs/editor/test/common/model/model.line.test.ts
src/vs/editor/test/common/model/model.line.test.ts
+10
-10
未找到文件。
src/vs/editor/common/model/modelLine.ts
浏览文件 @
482b6972
...
...
@@ -186,9 +186,9 @@ export class ModelLine {
// --- BEGIN TOKENS
public
setTokens
(
map
:
TokensInflatorMap
,
tokens
:
Token
[],
topLevelModeId
:
string
,
modeTransitions
:
ModeTransition
[]):
void
{
public
setTokens
(
map
:
TokensInflatorMap
,
tokens
:
Token
[],
modeTransitions
:
ModeTransition
[]):
void
{
this
.
_lineTokens
=
toLineTokensFromInflated
(
map
,
tokens
,
this
.
_text
.
length
);
this
.
_modeTransitions
=
toModeTransitions
(
topLevelModeId
,
modeTransitions
);
this
.
_modeTransitions
=
toModeTransitions
(
map
.
topLevelModeId
,
modeTransitions
);
}
private
_setLineTokensFromDeflated
(
tokens
:
number
[]):
void
{
...
...
src/vs/editor/common/model/textModelWithTokens.ts
浏览文件 @
482b6972
...
...
@@ -155,7 +155,7 @@ export class TextModelWithTokens extends TextModel implements editorCommon.IToke
}
this
.
_lastState
=
null
;
this
.
_tokensInflatorMap
=
new
TokensInflatorMap
();
this
.
_tokensInflatorMap
=
new
TokensInflatorMap
(
this
.
getModeId
()
);
this
.
_invalidLineStartIndex
=
0
;
this
.
_beginBackgroundTokenization
();
}
...
...
@@ -405,7 +405,7 @@ export class TextModelWithTokens extends TextModel implements editorCommon.IToke
// Make sure there is at least the transition to the top-most mode
r
.
modeTransitions
.
push
(
new
ModeTransition
(
0
,
this
.
getModeId
()));
}
this
.
_lines
[
lineIndex
].
setTokens
(
this
.
_tokensInflatorMap
,
r
.
tokens
,
this
.
getModeId
(),
r
.
modeTransitions
);
this
.
_lines
[
lineIndex
].
setTokens
(
this
.
_tokensInflatorMap
,
r
.
tokens
,
r
.
modeTransitions
);
this
.
_lines
[
lineIndex
].
isInvalid
=
false
;
if
(
endStateIndex
<
linesLength
)
{
...
...
src/vs/editor/common/model/tokensBinaryEncoding.ts
浏览文件 @
482b6972
...
...
@@ -23,14 +23,17 @@ const INFLATED_TOKENS_NON_EMPTY_TEXT:ViewLineToken[] = [DEFAULT_VIEW_TOKEN];
const
DEFLATED_TOKENS_NON_EMPTY_TEXT
:
number
[]
=
[
0
];
export
class
TokensInflatorMap
{
_tokensInflatorMapBrand
:
void
;
public
topLevelModeId
:
string
;
public
_inflate
:
string
[];
public
_deflate
:
{
[
token
:
string
]:
number
;
};
constructor
()
{
constructor
(
topLevelModeId
:
string
)
{
this
.
topLevelModeId
=
topLevelModeId
;
this
.
_inflate
=
[
''
];
this
.
_deflate
=
{
''
:
0
};
}
...
...
src/vs/editor/test/common/model/model.line.test.ts
浏览文件 @
482b6972
...
...
@@ -264,8 +264,8 @@ suite('Editor Model - modelLine.append text', () => {
suite
(
'
Editor Model - modelLine.applyEdits text & tokens
'
,
()
=>
{
function
testLineEditTokens
(
initialText
:
string
,
initialTokens
:
Token
[],
edits
:
ILineEdit
[],
expectedText
:
string
,
expectedTokens
:
Token
[]):
void
{
let
line
=
new
ModelLine
(
1
,
initialText
,
NO_TAB_SIZE
);
let
map
=
new
TokensInflatorMap
();
line
.
setTokens
(
map
,
initialTokens
,
null
,
[]);
let
map
=
new
TokensInflatorMap
(
null
);
line
.
setTokens
(
map
,
initialTokens
,
[]);
line
.
applyEdits
({},
edits
,
NO_TAB_SIZE
);
...
...
@@ -275,11 +275,11 @@ suite('Editor Model - modelLine.applyEdits text & tokens', () => {
test
(
'
insertion on empty line
'
,
()
=>
{
let
line
=
new
ModelLine
(
1
,
'
some text
'
,
NO_TAB_SIZE
);
let
map
=
new
TokensInflatorMap
();
line
.
setTokens
(
map
,
[
new
Token
(
0
,
'
bar
'
)],
null
,
[]);
let
map
=
new
TokensInflatorMap
(
null
);
line
.
setTokens
(
map
,
[
new
Token
(
0
,
'
bar
'
)],
[]);
line
.
applyEdits
({},
[{
startColumn
:
1
,
endColumn
:
10
,
text
:
''
,
forceMoveMarkers
:
false
}],
NO_TAB_SIZE
);
line
.
setTokens
(
map
,
[],
null
,
[]);
line
.
setTokens
(
map
,
[],
[]);
line
.
applyEdits
({},
[{
startColumn
:
1
,
endColumn
:
1
,
text
:
'
a
'
,
forceMoveMarkers
:
false
}],
NO_TAB_SIZE
);
assertLineTokens
(
line
.
getTokens
(
map
),
[
new
Token
(
0
,
''
)]);
...
...
@@ -836,8 +836,8 @@ suite('Editor Model - modelLine.applyEdits text & tokens', () => {
suite
(
'
Editor Model - modelLine.split text & tokens
'
,
()
=>
{
function
testLineSplitTokens
(
initialText
:
string
,
initialTokens
:
Token
[],
splitColumn
:
number
,
expectedText1
:
string
,
expectedText2
:
string
,
expectedTokens
:
Token
[]):
void
{
let
line
=
new
ModelLine
(
1
,
initialText
,
NO_TAB_SIZE
);
let
map
=
new
TokensInflatorMap
();
line
.
setTokens
(
map
,
initialTokens
,
null
,
[]);
let
map
=
new
TokensInflatorMap
(
null
);
line
.
setTokens
(
map
,
initialTokens
,
[]);
let
other
=
line
.
split
({},
splitColumn
,
false
,
NO_TAB_SIZE
);
...
...
@@ -918,13 +918,13 @@ suite('Editor Model - modelLine.split text & tokens', () => {
suite
(
'
Editor Model - modelLine.append text & tokens
'
,
()
=>
{
function
testLineAppendTokens
(
aText
:
string
,
aTokens
:
Token
[],
bText
:
string
,
bTokens
:
Token
[],
expectedText
:
string
,
expectedTokens
:
Token
[]):
void
{
let
inflator
=
new
TokensInflatorMap
();
let
inflator
=
new
TokensInflatorMap
(
null
);
let
a
=
new
ModelLine
(
1
,
aText
,
NO_TAB_SIZE
);
a
.
setTokens
(
inflator
,
aTokens
,
null
,
[]);
a
.
setTokens
(
inflator
,
aTokens
,
[]);
let
b
=
new
ModelLine
(
2
,
bText
,
NO_TAB_SIZE
);
b
.
setTokens
(
inflator
,
bTokens
,
null
,
[]);
b
.
setTokens
(
inflator
,
bTokens
,
[]);
a
.
append
({},
b
,
NO_TAB_SIZE
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录