Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
deb966b9
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
deb966b9
编写于
2月 09, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify modes around word definition
上级
e9dc6c02
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
9 addition
and
63 deletion
+9
-63
src/vs/editor/common/model/textModelWithTokensHelpers.ts
src/vs/editor/common/model/textModelWithTokensHelpers.ts
+1
-16
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+1
-8
src/vs/editor/common/modes/nullMode.ts
src/vs/editor/common/modes/nullMode.ts
+1
-3
src/vs/editor/common/modes/supports/richEditSupport.ts
src/vs/editor/common/modes/supports/richEditSupport.ts
+3
-5
src/vs/editor/common/modes/supports/tokenTypeClassification.ts
...s/editor/common/modes/supports/tokenTypeClassification.ts
+0
-28
src/vs/languages/css/test/common/css.test.ts
src/vs/languages/css/test/common/css.test.ts
+1
-1
src/vs/languages/javascript/test/common/javascript.test.ts
src/vs/languages/javascript/test/common/javascript.test.ts
+1
-1
src/vs/languages/php/test/common/php.test.ts
src/vs/languages/php/test/common/php.test.ts
+1
-1
未找到文件。
src/vs/editor/common/model/textModelWithTokensHelpers.ts
浏览文件 @
deb966b9
...
...
@@ -39,22 +39,7 @@ export interface INonWordTokenMap {
export
class
WordHelper
{
private
static
_safeGetWordDefinition
(
mode
:
Modes
.
IMode
):
RegExp
{
let
richEditSupport
=
mode
.
richEditSupport
;
if
(
!
richEditSupport
)
{
return
null
;
}
if
(
!
richEditSupport
.
tokenTypeClassification
)
{
return
null
;
}
var
result
:
RegExp
=
null
;
try
{
result
=
richEditSupport
.
tokenTypeClassification
.
getWordDefinition
();
}
catch
(
e
)
{
Errors
.
onUnexpectedError
(
e
);
}
return
result
;
return
(
mode
.
richEditSupport
?
mode
.
richEditSupport
.
wordDefinition
:
null
);
}
public
static
ensureValidWordDefinition
(
wordDefinition
?:
RegExp
):
RegExp
{
...
...
src/vs/editor/common/modes.ts
浏览文件 @
deb966b9
...
...
@@ -754,13 +754,6 @@ export interface IRichEditCharacterPair {
getSurroundingPairs
():
IAutoClosingPair
[];
}
/**
* Interface used to support the classification of tokens.
*/
export
interface
IRichEditTokenTypeClassification
{
getWordDefinition
():
RegExp
;
}
export
interface
IRichEditSupport
{
/**
* Optional adapter for electric characters.
...
...
@@ -780,7 +773,7 @@ export interface IRichEditSupport {
/**
* Optional adapter for classification of tokens.
*/
tokenTypeClassification
?:
IRichEditTokenTypeClassification
;
wordDefinition
?:
RegExp
;
/**
* Optional adapter for custom Enter handling.
...
...
src/vs/editor/common/modes/nullMode.ts
浏览文件 @
deb966b9
...
...
@@ -84,9 +84,7 @@ export class NullMode implements Modes.IMode {
constructor
()
{
this
.
richEditSupport
=
{
tokenTypeClassification
:
{
getWordDefinition
:
()
=>
NullMode
.
DEFAULT_WORD_REGEXP
}
wordDefinition
:
NullMode
.
DEFAULT_WORD_REGEXP
};
}
...
...
src/vs/editor/common/modes/supports/richEditSupport.ts
浏览文件 @
deb966b9
...
...
@@ -8,8 +8,8 @@ import * as Modes from 'vs/editor/common/modes';
import
{
OnEnterSupport
,
IOnEnterSupportOptions
,
IIndentationRules
,
IOnEnterRegExpRules
}
from
'
vs/editor/common/modes/supports/onEnter
'
;
import
{
CharacterPairSupport
}
from
'
vs/editor/common/modes/supports/characterPair
'
;
import
{
BracketElectricCharacterSupport
,
IBracketElectricCharacterContribution
}
from
'
vs/editor/common/modes/supports/electricCharacter
'
;
import
{
TokenTypeClassificationSupport
}
from
'
vs/editor/common/modes/supports/tokenTypeClassification
'
;
import
{
ICharacterPairContribution
}
from
'
vs/editor/common/modes/supports/characterPair
'
;
import
{
NullMode
}
from
'
vs/editor/common/modes/nullMode
'
;
export
type
CharacterPair
=
[
string
,
string
];
...
...
@@ -33,7 +33,7 @@ export class RichEditSupport implements Modes.IRichEditSupport {
public
electricCharacter
:
Modes
.
IRichEditElectricCharacter
;
public
comments
:
Modes
.
ICommentsConfiguration
;
public
characterPair
:
Modes
.
IRichEditCharacterPair
;
public
tokenTypeClassification
:
Modes
.
IRichEditTokenTypeClassification
;
public
wordDefinition
:
RegExp
;
public
onEnter
:
Modes
.
IRichEditOnEnter
;
constructor
(
modeId
:
string
,
conf
:
IRichEditConfiguration
)
{
...
...
@@ -50,9 +50,7 @@ export class RichEditSupport implements Modes.IRichEditSupport {
this
.
electricCharacter
=
new
BracketElectricCharacterSupport
(
modeId
,
conf
.
__electricCharacterSupport
);
}
this
.
tokenTypeClassification
=
new
TokenTypeClassificationSupport
({
wordDefinition
:
conf
.
wordPattern
});
this
.
wordDefinition
=
conf
.
wordPattern
||
NullMode
.
DEFAULT_WORD_REGEXP
;
}
private
_handleOnEnter
(
modeId
:
string
,
conf
:
IRichEditConfiguration
):
void
{
...
...
src/vs/editor/common/modes/supports/tokenTypeClassification.ts
已删除
100644 → 0
浏览文件 @
e9dc6c02
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
IRichEditTokenTypeClassification
}
from
'
vs/editor/common/modes
'
;
import
{
NullMode
}
from
'
vs/editor/common/modes/nullMode
'
;
export
interface
ITokenTypeClassificationSupportContribution
{
wordDefinition
?:
RegExp
;
}
export
class
TokenTypeClassificationSupport
implements
IRichEditTokenTypeClassification
{
private
_contribution
:
ITokenTypeClassificationSupportContribution
;
constructor
(
contribution
:
ITokenTypeClassificationSupportContribution
)
{
this
.
_contribution
=
contribution
;
}
public
getWordDefinition
():
RegExp
{
if
(
typeof
this
.
_contribution
.
wordDefinition
===
'
undefined
'
)
{
return
NullMode
.
DEFAULT_WORD_REGEXP
;
}
return
this
.
_contribution
.
wordDefinition
;
}
}
src/vs/languages/css/test/common/css.test.ts
浏览文件 @
deb966b9
...
...
@@ -22,7 +22,7 @@ suite('CSS Colorizing', () => {
modesUtil
.
load
(
'
css
'
).
then
(
mode
=>
{
tokenizationSupport
=
mode
.
tokenizationSupport
;
assertOnEnter
=
modesUtil
.
createOnEnterAsserter
(
mode
.
getId
(),
mode
.
richEditSupport
);
wordDefinition
=
mode
.
richEditSupport
.
tokenTypeClassification
.
getWordDefinition
()
;
wordDefinition
=
mode
.
richEditSupport
.
wordDefinition
;
done
();
});
});
...
...
src/vs/languages/javascript/test/common/javascript.test.ts
浏览文件 @
deb966b9
...
...
@@ -21,7 +21,7 @@ suite('JS - Auto Indent', () => {
modesUtil
.
load
(
'
javascript
'
).
then
(
mode
=>
{
assertOnEnter
=
modesUtil
.
createOnEnterAsserter
(
mode
.
getId
(),
mode
.
richEditSupport
);
onElectricCharacter
=
modesUtil
.
createOnElectricCharacter
(
mode
);
wordDefinition
=
mode
.
richEditSupport
.
tokenTypeClassification
.
getWordDefinition
()
;
wordDefinition
=
mode
.
richEditSupport
.
wordDefinition
;
done
();
});
});
...
...
src/vs/languages/php/test/common/php.test.ts
浏览文件 @
deb966b9
...
...
@@ -27,7 +27,7 @@ suite('Syntax Highlighting - PHP', () => {
modesUtil
.
load
(
'
php
'
).
then
(
mode
=>
{
tokenizationSupport
=
mode
.
tokenizationSupport
;
assertOnEnter
=
modesUtil
.
createOnEnterAsserter
(
mode
.
getId
(),
mode
.
richEditSupport
);
wordDefinition
=
mode
.
richEditSupport
.
tokenTypeClassification
.
getWordDefinition
()
;
wordDefinition
=
mode
.
richEditSupport
.
wordDefinition
;
done
();
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录