Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
32320753
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,发现更多精彩内容 >>
提交
32320753
编写于
12月 21, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Merge IState and IState2
上级
b43b2c6f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
48 deletion
+12
-48
build/monaco/monaco.d.ts.recipe
build/monaco/monaco.d.ts.recipe
+1
-1
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+6
-14
src/vs/editor/common/services/modeServiceImpl.ts
src/vs/editor/common/services/modeServiceImpl.ts
+5
-33
未找到文件。
build/monaco/monaco.d.ts.recipe
浏览文件 @
32320753
...
...
@@ -71,7 +71,7 @@ declare module monaco.languages {
#includeAll(vs/editor/browser/standalone/standaloneLanguages;modes.=>;editorCommon.=>editor.;IMarkerData=>editor.IMarkerData):
#includeAll(vs/editor/common/modes/languageConfiguration):
#includeAll(vs/editor/common/modes;editorCommon.IRange=>IRange;editorCommon.IPosition=>IPosition;editorCommon.=>editor.;IToken2=>IToken;ILineTokens2=>ILineTokens
;IState2=>IState
):
#includeAll(vs/editor/common/modes;editorCommon.IRange=>IRange;editorCommon.IPosition=>IPosition;editorCommon.=>editor.;IToken2=>IToken;ILineTokens2=>ILineTokens):
#include(vs/editor/common/services/modeService): ILanguageExtensionPoint
#includeAll(vs/editor/common/modes/monarch/monarchTypes):
...
...
src/vs/editor/common/modes.ts
浏览文件 @
32320753
...
...
@@ -17,14 +17,6 @@ import { Position } from 'vs/editor/common/core/position';
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
/**
* @internal
*/
export
interface
IState
{
clone
():
IState
;
equals
(
other
:
IState
):
boolean
;
}
/**
* @internal
*/
...
...
@@ -82,16 +74,16 @@ export interface ILineTokens2 {
* The tokenization end state.
* A pointer will be held to this and the object should not be modified by the tokenizer after the pointer is returned.
*/
endState
:
IState
2
;
endState
:
IState
;
}
/**
* The state of the tokenizer between two lines.
* It is useful to store flags such as in multiline comment, etc.
* The model will clone the previous line's state and pass it in to tokenize the next line.
*/
export
interface
IState
2
{
clone
():
IState
2
;
equals
(
other
:
IState
2
):
boolean
;
export
interface
IState
{
clone
():
IState
;
equals
(
other
:
IState
):
boolean
;
}
/**
* A "manual" provider of tokens.
...
...
@@ -100,11 +92,11 @@ export interface TokensProvider {
/**
* The initial state of a language. Will be the state passed in to tokenize the first line.
*/
getInitialState
():
IState
2
;
getInitialState
():
IState
;
/**
* Tokenize a line given the state at the beginning of the line.
*/
tokenize
(
line
:
string
,
state
:
IState
2
):
ILineTokens2
;
tokenize
(
line
:
string
,
state
:
IState
):
ILineTokens2
;
}
/**
...
...
src/vs/editor/common/services/modeServiceImpl.ts
浏览文件 @
32320753
...
...
@@ -305,30 +305,6 @@ export class ModeServiceImpl implements IModeService {
}
}
export
class
TokenizationState2Adapter
implements
modes
.
IState
{
public
readonly
actual
:
modes
.
IState2
;
constructor
(
actual
:
modes
.
IState2
)
{
this
.
actual
=
actual
;
}
public
clone
():
TokenizationState2Adapter
{
let
actualClone
=
this
.
actual
.
clone
();
if
(
actualClone
===
this
.
actual
)
{
return
this
;
}
return
new
TokenizationState2Adapter
(
actualClone
);
}
public
equals
(
other
:
modes
.
IState
):
boolean
{
return
(
other
instanceof
TokenizationState2Adapter
&&
this
.
actual
.
equals
(
other
.
actual
)
);
}
}
export
class
TokenizationSupport2Adapter
implements
modes
.
ITokenizationSupport
{
private
_modeId
:
string
;
...
...
@@ -340,15 +316,11 @@ export class TokenizationSupport2Adapter implements modes.ITokenizationSupport {
}
public
getInitialState
():
modes
.
IState
{
return
new
TokenizationState2Adapter
(
this
.
_actual
.
getInitialState
()
);
return
this
.
_actual
.
getInitialState
(
);
}
public
tokenize
(
line
:
string
,
state
:
modes
.
IState
,
offsetDelta
:
number
=
0
,
stopAtOffset
?:
number
):
modes
.
ILineTokens
{
if
(
!
(
state
instanceof
TokenizationState2Adapter
))
{
throw
new
Error
(
'
Unexpected state to tokenize with!
'
);
}
let
actualResult
=
this
.
_actual
.
tokenize
(
line
,
state
.
actual
);
let
actualResult
=
this
.
_actual
.
tokenize
(
line
,
state
);
let
tokens
:
Token
[]
=
[];
actualResult
.
tokens
.
forEach
((
t
)
=>
{
if
(
typeof
t
.
scopes
===
'
string
'
)
{
...
...
@@ -360,12 +332,12 @@ export class TokenizationSupport2Adapter implements modes.ITokenizationSupport {
}
});
let
endState
:
TokenizationState2Adapter
;
let
endState
:
modes
.
IState
;
// try to save an object if possible
if
(
actualResult
.
endState
.
equals
(
state
.
actual
))
{
if
(
actualResult
.
endState
.
equals
(
state
))
{
endState
=
state
;
}
else
{
endState
=
new
TokenizationState2Adapter
(
actualResult
.
endState
)
;
endState
=
actualResult
.
endState
;
}
return
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录