Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3719c2f6
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,发现更多精彩内容 >>
提交
3719c2f6
编写于
6月 03, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reduce usage of `richEditSupport`
上级
a89447cc
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
315 addition
and
293 deletion
+315
-293
src/vs/editor/common/modes/languageConfigurationRegistry.ts
src/vs/editor/common/modes/languageConfigurationRegistry.ts
+29
-17
src/vs/editor/common/modes/nullMode.ts
src/vs/editor/common/modes/nullMode.ts
+0
-5
src/vs/editor/standalone-languages/test/testUtil.ts
src/vs/editor/standalone-languages/test/testUtil.ts
+1
-3
src/vs/editor/test/common/mocks/mockMode.ts
src/vs/editor/test/common/mocks/mockMode.ts
+4
-1
src/vs/editor/test/common/modesUtil.ts
src/vs/editor/test/common/modesUtil.ts
+3
-1
src/vs/languages/css/common/css.ts
src/vs/languages/css/common/css.ts
+25
-23
src/vs/languages/css/test/common/css.test.ts
src/vs/languages/css/test/common/css.test.ts
+1
-1
src/vs/languages/handlebars/common/handlebars.ts
src/vs/languages/handlebars/common/handlebars.ts
+45
-44
src/vs/languages/html/common/html.ts
src/vs/languages/html/common/html.ts
+44
-43
src/vs/languages/json/common/json.ts
src/vs/languages/json/common/json.ts
+22
-21
src/vs/languages/json/test/common/json.test.ts
src/vs/languages/json/test/common/json.test.ts
+1
-1
src/vs/languages/less/common/less.ts
src/vs/languages/less/common/less.ts
+20
-18
src/vs/languages/less/test/common/colorizer.test.ts
src/vs/languages/less/test/common/colorizer.test.ts
+1
-1
src/vs/languages/markdown/common/markdown.ts
src/vs/languages/markdown/common/markdown.ts
+10
-8
src/vs/languages/php/common/php.ts
src/vs/languages/php/common/php.ts
+25
-23
src/vs/languages/php/test/common/php.test.ts
src/vs/languages/php/test/common/php.test.ts
+1
-1
src/vs/languages/razor/common/razor.ts
src/vs/languages/razor/common/razor.ts
+44
-43
src/vs/languages/sass/common/sass.ts
src/vs/languages/sass/common/sass.ts
+20
-18
src/vs/languages/sass/test/common/sass.test.ts
src/vs/languages/sass/test/common/sass.test.ts
+1
-1
src/vs/languages/typescript/common/mode.ts
src/vs/languages/typescript/common/mode.ts
+2
-6
src/vs/languages/typescript/test/common/tokenization.test.ts
src/vs/languages/typescript/test/common/tokenization.test.ts
+2
-2
src/vs/workbench/parts/output/common/outputMode.ts
src/vs/workbench/parts/output/common/outputMode.ts
+14
-12
未找到文件。
src/vs/editor/common/modes/languageConfigurationRegistry.ts
浏览文件 @
3719c2f6
...
...
@@ -131,52 +131,63 @@ export class RichEditSupport implements IRichEditSupport {
export
class
LanguageConfigurationRegistryImpl
{
//
private _entries: {[languageId:string]:RichEditSupport;};
private
_entries
:
{[
languageId
:
string
]:
RichEditSupport
;};
private
_onDidChange
:
Emitter
<
void
>
=
new
Emitter
<
void
>
();
public
onDidChange
:
Event
<
void
>
=
this
.
_onDidChange
.
event
;
constructor
()
{
//
this._entries = Object.create(null);
this
.
_entries
=
Object
.
create
(
null
);
}
// public register(languageId:string, configuration:IRichLanguageConfiguration): void {
// console.log('TODO!');
// }
public
register
(
languageId
:
string
,
configuration
:
IRichLanguageConfiguration
):
void
{
let
previous
=
this
.
_entries
[
languageId
]
||
null
;
this
.
_entries
[
languageId
]
=
new
RichEditSupport
(
languageId
,
previous
,
configuration
);
this
.
_onDidChange
.
fire
(
void
0
);
}
private
_getRichEditSupport
(
mode
:
IMode
):
IRichEditSupport
{
return
/*this._entries[mode.getId()] || */
mode
.
richEditSupport
;
}
public
getElectricCharacterSupport
(
mode
:
IMode
):
IRichEditElectricCharacter
{
if
(
!
mode
.
richEditSupport
)
{
let
value
=
this
.
_getRichEditSupport
(
mode
);
if
(
!
value
)
{
return
null
;
}
return
mode
.
richEditSupport
.
electricCharacter
||
null
;
return
value
.
electricCharacter
||
null
;
}
public
getComments
(
mode
:
IMode
):
ICommentsConfiguration
{
if
(
!
mode
.
richEditSupport
)
{
let
value
=
this
.
_getRichEditSupport
(
mode
);
if
(
!
value
)
{
return
null
;
}
return
mode
.
richEditSupport
.
comments
||
null
;
return
value
.
comments
||
null
;
}
public
getCharacterPairSupport
(
mode
:
IMode
):
IRichEditCharacterPair
{
if
(
!
mode
.
richEditSupport
)
{
let
value
=
this
.
_getRichEditSupport
(
mode
);
if
(
!
value
)
{
return
null
;
}
return
mode
.
richEditSupport
.
characterPair
||
null
;
return
value
.
characterPair
||
null
;
}
public
getWordDefinition
(
mode
:
IMode
):
RegExp
{
if
(
!
mode
.
richEditSupport
)
{
let
value
=
this
.
_getRichEditSupport
(
mode
);
if
(
!
value
)
{
return
null
;
}
return
mode
.
richEditSupport
.
wordDefinition
||
null
;
return
value
.
wordDefinition
||
null
;
}
public
getOnEnterSupport
(
mode
:
IMode
):
IRichEditOnEnter
{
if
(
!
mode
.
richEditSupport
)
{
let
value
=
this
.
_getRichEditSupport
(
mode
);
if
(
!
value
)
{
return
null
;
}
return
mode
.
richEditSupport
.
onEnter
||
null
;
return
value
.
onEnter
||
null
;
}
public
getRawEnterActionAtPosition
(
model
:
ITokenizedModel
,
lineNumber
:
number
,
column
:
number
):
IEnterAction
{
...
...
@@ -232,10 +243,11 @@ export class LanguageConfigurationRegistryImpl {
}
public
getBracketsSupport
(
mode
:
IMode
):
IRichEditBrackets
{
if
(
!
mode
.
richEditSupport
)
{
let
value
=
this
.
_getRichEditSupport
(
mode
);
if
(
!
value
)
{
return
null
;
}
return
mode
.
richEditSupport
.
brackets
||
null
;
return
value
.
brackets
||
null
;
}
}
...
...
src/vs/editor/common/modes/nullMode.ts
浏览文件 @
3719c2f6
...
...
@@ -81,12 +81,7 @@ export class NullMode implements modes.IMode {
public
static
ID
=
'
vs.editor.modes.nullMode
'
;
public
richEditSupport
:
modes
.
IRichEditSupport
;
constructor
()
{
this
.
richEditSupport
=
{
wordDefinition
:
NullMode
.
DEFAULT_WORD_REGEXP
};
}
public
getId
():
string
{
...
...
src/vs/editor/standalone-languages/test/testUtil.ts
浏览文件 @
3719c2f6
...
...
@@ -5,7 +5,6 @@
'
use strict
'
;
import
{
RichEditSupport
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
createOnEnterAsserter
,
executeMonarchTokenizationTests
}
from
'
vs/editor/test/common/modesUtil
'
;
import
{
ILanguage
,
IRichLanguageConfiguration
}
from
'
../types
'
;
...
...
@@ -36,8 +35,7 @@ export function testTokenization(name:string, language: ILanguage, tests:ITestIt
export
function
testOnEnter
(
name
:
string
,
conf
:
IRichLanguageConfiguration
,
callback
:(
assertOnEnter
:
IOnEnterAsserter
)
=>
void
):
void
{
suite
(
name
,
()
=>
{
test
(
'
onEnter
'
,
()
=>
{
var
richEditSupport
=
new
RichEditSupport
(
'
test
'
,
null
,
conf
);
callback
(
createOnEnterAsserter
(
'
test
'
,
richEditSupport
));
callback
(
createOnEnterAsserter
(
'
test
'
,
conf
));
});
});
}
src/vs/editor/test/common/mocks/mockMode.ts
浏览文件 @
3719c2f6
...
...
@@ -9,10 +9,13 @@ import {AbstractState} from 'vs/editor/common/modes/abstractState';
import
{
TokenizationSupport
}
from
'
vs/editor/common/modes/supports/tokenizationSupport
'
;
export
class
MockMode
implements
IMode
{
private
static
instanceCount
=
0
;
private
_id
:
string
;
constructor
(
id
:
string
=
'
mockMode
'
)
{
if
(
typeof
id
===
'
undefined
'
)
{
id
=
'
mockMode
'
+
(
++
MockMode
.
instanceCount
);
}
this
.
_id
=
id
;
}
...
...
src/vs/editor/test/common/modesUtil.ts
浏览文件 @
3719c2f6
...
...
@@ -12,6 +12,7 @@ import {createTokenizationSupport} from 'vs/editor/common/modes/monarch/monarchL
import
{
ILanguage
}
from
'
vs/editor/common/modes/monarch/monarchTypes
'
;
import
{
createMockModeService
}
from
'
vs/editor/test/common/servicesTestUtils
'
;
import
{
MockMode
}
from
'
vs/editor/test/common/mocks/mockMode
'
;
import
{
RichEditSupport
,
IRichLanguageConfiguration
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
export
interface
ITestItem
{
line
:
string
;
...
...
@@ -47,13 +48,14 @@ export interface IOnEnterAsserter {
indentsOutdents
(
oneLineAboveText
:
string
,
beforeText
:
string
,
afterText
:
string
):
void
;
}
export
function
createOnEnterAsserter
(
modeId
:
string
,
richEditSupport
:
modes
.
IRichEditSupport
):
IOnEnterAsserter
{
export
function
createOnEnterAsserter
(
modeId
:
string
,
conf
:
IRichLanguageConfiguration
):
IOnEnterAsserter
{
var
assertOne
=
(
oneLineAboveText
:
string
,
beforeText
:
string
,
afterText
:
string
,
expected
:
modes
.
IndentAction
)
=>
{
var
model
=
new
Model
(
[
oneLineAboveText
,
beforeText
+
afterText
].
join
(
'
\n
'
),
Model
.
DEFAULT_CREATION_OPTIONS
,
new
MockMode
(
modeId
)
);
var
richEditSupport
=
new
RichEditSupport
(
modeId
,
null
,
conf
);
var
actual
=
richEditSupport
.
onEnter
.
onEnter
(
model
,
{
lineNumber
:
2
,
column
:
beforeText
.
length
+
1
});
if
(
expected
===
modes
.
IndentAction
.
None
)
{
assert
.
equal
(
actual
,
null
,
oneLineAboveText
+
'
\\
n
'
+
beforeText
+
'
|
'
+
afterText
);
...
...
src/vs/languages/css/common/css.ts
浏览文件 @
3719c2f6
...
...
@@ -17,7 +17,7 @@ import {AbstractState} from 'vs/editor/common/modes/abstractState';
import
{
IMarker
}
from
'
vs/platform/markers/common/markers
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IThreadService
,
ThreadAffinity
}
from
'
vs/platform/thread/common/thread
'
;
import
{
RichEditSupport
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
RichEditSupport
,
IRichLanguageConfiguration
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
TokenizationSupport
}
from
'
vs/editor/common/modes/supports/tokenizationSupport
'
;
import
{
wireCancellationToken
}
from
'
vs/base/common/async
'
;
...
...
@@ -278,6 +278,29 @@ export class State extends AbstractState {
export
class
CSSMode
extends
AbstractMode
{
public
static
LANG_CONFIG
:
IRichLanguageConfiguration
=
{
// TODO@Martin: This definition does not work with umlauts for example
wordPattern
:
/
(
#
?
-
?\d
*
\.\d\w
*%
?)
|
((
::|
[
@#.!:
])?[\w
-?
]
+%
?)
|::|
[
@#.!:
]
/g
,
comments
:
{
blockComment
:
[
'
/*
'
,
'
*/
'
]
},
brackets
:
[
[
'
{
'
,
'
}
'
],
[
'
[
'
,
'
]
'
],
[
'
(
'
,
'
)
'
]
],
autoClosingPairs
:
[
{
open
:
'
{
'
,
close
:
'
}
'
},
{
open
:
'
[
'
,
close
:
'
]
'
},
{
open
:
'
(
'
,
close
:
'
)
'
},
{
open
:
'
"
'
,
close
:
'
"
'
,
notIn
:
[
'
string
'
]
},
{
open
:
'
\'
'
,
close
:
'
\'
'
,
notIn
:
[
'
string
'
]
}
]
};
public
tokenizationSupport
:
modes
.
ITokenizationSupport
;
public
richEditSupport
:
modes
.
IRichEditSupport
;
public
inplaceReplaceSupport
:
modes
.
IInplaceReplaceSupport
;
...
...
@@ -299,28 +322,7 @@ export class CSSMode extends AbstractMode {
getInitialState
:
()
=>
new
State
(
this
,
States
.
Selector
,
false
,
null
,
false
,
0
)
},
false
,
false
);
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
{
// TODO@Martin: This definition does not work with umlauts for example
wordPattern
:
/
(
#
?
-
?\d
*
\.\d\w
*%
?)
|
((
::|
[
@#.!:
])?[\w
-?
]
+%
?)
|::|
[
@#.!:
]
/g
,
comments
:
{
blockComment
:
[
'
/*
'
,
'
*/
'
]
},
brackets
:
[
[
'
{
'
,
'
}
'
],
[
'
[
'
,
'
]
'
],
[
'
(
'
,
'
)
'
]
],
autoClosingPairs
:
[
{
open
:
'
{
'
,
close
:
'
}
'
},
{
open
:
'
[
'
,
close
:
'
]
'
},
{
open
:
'
(
'
,
close
:
'
)
'
},
{
open
:
'
"
'
,
close
:
'
"
'
,
notIn
:
[
'
string
'
]
},
{
open
:
'
\'
'
,
close
:
'
\'
'
,
notIn
:
[
'
string
'
]
}
]
});
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
CSSMode
.
LANG_CONFIG
);
this
.
inplaceReplaceSupport
=
this
;
this
.
configSupport
=
this
;
...
...
src/vs/languages/css/test/common/css.test.ts
浏览文件 @
3719c2f6
...
...
@@ -32,7 +32,7 @@ suite('CSS Colorizing', () => {
);
tokenizationSupport
=
mode
.
tokenizationSupport
;
assertOnEnter
=
modesUtil
.
createOnEnterAsserter
(
mode
.
getId
(),
mode
.
richEditSupport
);
assertOnEnter
=
modesUtil
.
createOnEnterAsserter
(
mode
.
getId
(),
CSSMode
.
LANG_CONFIG
);
wordDefinition
=
LanguageConfigurationRegistry
.
getWordDefinition
(
mode
);
})();
...
...
src/vs/languages/handlebars/common/handlebars.ts
浏览文件 @
3719c2f6
...
...
@@ -10,7 +10,7 @@ import handlebarsTokenTypes = require('vs/languages/handlebars/common/handlebars
import
htmlWorker
=
require
(
'
vs/languages/html/common/htmlWorker
'
);
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
RichEditSupport
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
RichEditSupport
,
IRichLanguageConfiguration
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
createWordRegExp
}
from
'
vs/editor/common/modes/abstractMode
'
;
import
{
ILeavingNestedModeData
}
from
'
vs/editor/common/modes/supports/tokenizationSupport
'
;
import
{
IThreadService
}
from
'
vs/platform/thread/common/thread
'
;
...
...
@@ -107,6 +107,49 @@ export class HandlebarsState extends htmlMode.State {
export
class
HandlebarsMode
extends
htmlMode
.
HTMLMode
<
htmlWorker
.
HTMLWorker
>
{
public
static
LANG_CONFIG
:
IRichLanguageConfiguration
=
{
wordPattern
:
createWordRegExp
(
'
#-?%
'
),
comments
:
{
blockComment
:
[
'
<!--
'
,
'
-->
'
]
},
brackets
:
[
[
'
<!--
'
,
'
-->
'
],
[
'
{{
'
,
'
}}
'
]
],
__electricCharacterSupport
:
{
embeddedElectricCharacters
:
[
'
*
'
,
'
}
'
,
'
]
'
,
'
)
'
]
},
autoClosingPairs
:
[
{
open
:
'
{
'
,
close
:
'
}
'
},
{
open
:
'
[
'
,
close
:
'
]
'
},
{
open
:
'
(
'
,
close
:
'
)
'
},
{
open
:
'
"
'
,
close
:
'
"
'
},
{
open
:
'
\'
'
,
close
:
'
\'
'
}
],
surroundingPairs
:
[
{
open
:
'
<
'
,
close
:
'
>
'
},
{
open
:
'
"
'
,
close
:
'
"
'
},
{
open
:
'
\'
'
,
close
:
'
\'
'
}
],
onEnterRules
:
[
{
beforeText
:
new
RegExp
(
`<(?!(?:
${
htmlMode
.
EMPTY_ELEMENTS
.
join
(
'
|
'
)}
))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`
,
'
i
'
),
afterText
:
/^<
\/(\w[\w\d]
*
)\s
*>$/i
,
action
:
{
indentAction
:
modes
.
IndentAction
.
IndentOutdent
}
},
{
beforeText
:
new
RegExp
(
`<(?!(?:
${
htmlMode
.
EMPTY_ELEMENTS
.
join
(
'
|
'
)}
))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`
,
'
i
'
),
action
:
{
indentAction
:
modes
.
IndentAction
.
Indent
}
}
],
};
constructor
(
descriptor
:
modes
.
IModeDescriptor
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
...
...
@@ -151,49 +194,7 @@ export class HandlebarsMode extends htmlMode.HTMLMode<htmlWorker.HTMLWorker> {
}
protected
_createRichEditSupport
():
modes
.
IRichEditSupport
{
return
new
RichEditSupport
(
this
.
getId
(),
null
,
{
wordPattern
:
createWordRegExp
(
'
#-?%
'
),
comments
:
{
blockComment
:
[
'
<!--
'
,
'
-->
'
]
},
brackets
:
[
[
'
<!--
'
,
'
-->
'
],
[
'
{{
'
,
'
}}
'
]
],
__electricCharacterSupport
:
{
embeddedElectricCharacters
:
[
'
*
'
,
'
}
'
,
'
]
'
,
'
)
'
]
},
autoClosingPairs
:
[
{
open
:
'
{
'
,
close
:
'
}
'
},
{
open
:
'
[
'
,
close
:
'
]
'
},
{
open
:
'
(
'
,
close
:
'
)
'
},
{
open
:
'
"
'
,
close
:
'
"
'
},
{
open
:
'
\'
'
,
close
:
'
\'
'
}
],
surroundingPairs
:
[
{
open
:
'
<
'
,
close
:
'
>
'
},
{
open
:
'
"
'
,
close
:
'
"
'
},
{
open
:
'
\'
'
,
close
:
'
\'
'
}
],
onEnterRules
:
[
{
beforeText
:
new
RegExp
(
`<(?!(?:
${
htmlMode
.
EMPTY_ELEMENTS
.
join
(
'
|
'
)}
))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`
,
'
i
'
),
afterText
:
/^<
\/(\w[\w\d]
*
)\s
*>$/i
,
action
:
{
indentAction
:
modes
.
IndentAction
.
IndentOutdent
}
},
{
beforeText
:
new
RegExp
(
`<(?!(?:
${
htmlMode
.
EMPTY_ELEMENTS
.
join
(
'
|
'
)}
))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`
,
'
i
'
),
action
:
{
indentAction
:
modes
.
IndentAction
.
Indent
}
}
],
});
return
new
RichEditSupport
(
this
.
getId
(),
null
,
HandlebarsMode
.
LANG_CONFIG
);
}
public
getInitialState
()
:
modes
.
IState
{
...
...
src/vs/languages/html/common/html.ts
浏览文件 @
3719c2f6
...
...
@@ -16,7 +16,7 @@ import {IModeService} from 'vs/editor/common/services/modeService';
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
*
as
htmlTokenTypes
from
'
vs/languages/html/common/htmlTokenTypes
'
;
import
{
EMPTY_ELEMENTS
}
from
'
vs/languages/html/common/htmlEmptyTagsShared
'
;
import
{
RichEditSupport
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
RichEditSupport
,
IRichLanguageConfiguration
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
TokenizationSupport
,
IEnteringNestedModeData
,
ILeavingNestedModeData
,
ITokenizationCustomization
}
from
'
vs/editor/common/modes/supports/tokenizationSupport
'
;
import
{
IThreadService
}
from
'
vs/platform/thread/common/thread
'
;
import
{
wireCancellationToken
}
from
'
vs/base/common/async
'
;
...
...
@@ -285,6 +285,48 @@ export class State extends AbstractState {
export
class
HTMLMode
<
W
extends
htmlWorker
.
HTMLWorker
>
extends
AbstractMode
implements
ITokenizationCustomization
{
public
static
LANG_CONFIG
:
IRichLanguageConfiguration
=
{
wordPattern
:
createWordRegExp
(
'
#-?%
'
),
comments
:
{
blockComment
:
[
'
<!--
'
,
'
-->
'
]
},
brackets
:
[
[
'
<!--
'
,
'
-->
'
],
[
'
<
'
,
'
>
'
],
],
__electricCharacterSupport
:
{
embeddedElectricCharacters
:
[
'
*
'
,
'
}
'
,
'
]
'
,
'
)
'
]
},
autoClosingPairs
:
[
{
open
:
'
{
'
,
close
:
'
}
'
},
{
open
:
'
[
'
,
close
:
'
]
'
},
{
open
:
'
(
'
,
close
:
'
)
'
},
{
open
:
'
"
'
,
close
:
'
"
'
},
{
open
:
'
\'
'
,
close
:
'
\'
'
}
],
surroundingPairs
:
[
{
open
:
'
"
'
,
close
:
'
"
'
},
{
open
:
'
\'
'
,
close
:
'
\'
'
}
],
onEnterRules
:
[
{
beforeText
:
new
RegExp
(
`<(?!(?:
${
EMPTY_ELEMENTS
.
join
(
'
|
'
)}
))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`
,
'
i
'
),
afterText
:
/^<
\/([
_:
\w][
_:
\w
-.
\d]
*
)\s
*>$/i
,
action
:
{
indentAction
:
modes
.
IndentAction
.
IndentOutdent
}
},
{
beforeText
:
new
RegExp
(
`<(?!(?:
${
EMPTY_ELEMENTS
.
join
(
'
|
'
)}
))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`
,
'
i
'
),
action
:
{
indentAction
:
modes
.
IndentAction
.
Indent
}
}
],
};
public
tokenizationSupport
:
modes
.
ITokenizationSupport
;
public
richEditSupport
:
modes
.
IRichEditSupport
;
public
configSupport
:
modes
.
IConfigurationSupport
;
...
...
@@ -373,48 +415,7 @@ export class HTMLMode<W extends htmlWorker.HTMLWorker> extends AbstractMode impl
}
protected
_createRichEditSupport
():
modes
.
IRichEditSupport
{
return
new
RichEditSupport
(
this
.
getId
(),
null
,
{
wordPattern
:
createWordRegExp
(
'
#-?%
'
),
comments
:
{
blockComment
:
[
'
<!--
'
,
'
-->
'
]
},
brackets
:
[
[
'
<!--
'
,
'
-->
'
],
[
'
<
'
,
'
>
'
],
],
__electricCharacterSupport
:
{
embeddedElectricCharacters
:
[
'
*
'
,
'
}
'
,
'
]
'
,
'
)
'
]
},
autoClosingPairs
:
[
{
open
:
'
{
'
,
close
:
'
}
'
},
{
open
:
'
[
'
,
close
:
'
]
'
},
{
open
:
'
(
'
,
close
:
'
)
'
},
{
open
:
'
"
'
,
close
:
'
"
'
},
{
open
:
'
\'
'
,
close
:
'
\'
'
}
],
surroundingPairs
:
[
{
open
:
'
"
'
,
close
:
'
"
'
},
{
open
:
'
\'
'
,
close
:
'
\'
'
}
],
onEnterRules
:
[
{
beforeText
:
new
RegExp
(
`<(?!(?:
${
EMPTY_ELEMENTS
.
join
(
'
|
'
)}
))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`
,
'
i
'
),
afterText
:
/^<
\/([
_:
\w][
_:
\w
-.
\d]
*
)\s
*>$/i
,
action
:
{
indentAction
:
modes
.
IndentAction
.
IndentOutdent
}
},
{
beforeText
:
new
RegExp
(
`<(?!(?:
${
EMPTY_ELEMENTS
.
join
(
'
|
'
)}
))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`
,
'
i
'
),
action
:
{
indentAction
:
modes
.
IndentAction
.
Indent
}
}
],
});
return
new
RichEditSupport
(
this
.
getId
(),
null
,
HTMLMode
.
LANG_CONFIG
);
}
// TokenizationSupport
...
...
src/vs/languages/json/common/json.ts
浏览文件 @
3719c2f6
...
...
@@ -16,11 +16,31 @@ import {OneWorkerAttr, AllWorkersAttr} from 'vs/platform/thread/common/threadSer
import
{
IThreadService
,
ThreadAffinity
}
from
'
vs/platform/thread/common/thread
'
;
import
{
IJSONContributionRegistry
,
Extensions
,
ISchemaContributions
}
from
'
vs/platform/jsonschemas/common/jsonContributionRegistry
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
RichEditSupport
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
RichEditSupport
,
IRichLanguageConfiguration
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
wireCancellationToken
}
from
'
vs/base/common/async
'
;
export
class
JSONMode
extends
AbstractMode
{
public
static
LANG_CONFIG
:
IRichLanguageConfiguration
=
{
wordPattern
:
createWordRegExp
(
'
.-
'
),
comments
:
{
lineComment
:
'
//
'
,
blockComment
:
[
'
/*
'
,
'
*/
'
]
},
brackets
:
[
[
'
{
'
,
'
}
'
],
[
'
[
'
,
'
]
'
]
],
autoClosingPairs
:
[
{
open
:
'
{
'
,
close
:
'
}
'
,
notIn
:
[
'
string
'
]
},
{
open
:
'
[
'
,
close
:
'
]
'
,
notIn
:
[
'
string
'
]
},
{
open
:
'
"
'
,
close
:
'
"
'
,
notIn
:
[
'
string
'
]
}
]
};
public
tokenizationSupport
:
modes
.
ITokenizationSupport
;
public
richEditSupport
:
modes
.
IRichEditSupport
;
public
configSupport
:
modes
.
IConfigurationSupport
;
...
...
@@ -40,26 +60,7 @@ export class JSONMode extends AbstractMode {
this
.
tokenizationSupport
=
tokenization
.
createTokenizationSupport
(
this
,
true
);
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
{
wordPattern
:
createWordRegExp
(
'
.-
'
),
comments
:
{
lineComment
:
'
//
'
,
blockComment
:
[
'
/*
'
,
'
*/
'
]
},
brackets
:
[
[
'
{
'
,
'
}
'
],
[
'
[
'
,
'
]
'
]
],
autoClosingPairs
:
[
{
open
:
'
{
'
,
close
:
'
}
'
,
notIn
:
[
'
string
'
]
},
{
open
:
'
[
'
,
close
:
'
]
'
,
notIn
:
[
'
string
'
]
},
{
open
:
'
"
'
,
close
:
'
"
'
,
notIn
:
[
'
string
'
]
}
]
});
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
JSONMode
.
LANG_CONFIG
);
modes
.
HoverProviderRegistry
.
register
(
this
.
getId
(),
{
provideHover
:
(
model
,
position
,
token
):
Thenable
<
modes
.
Hover
>
=>
{
...
...
src/vs/languages/json/test/common/json.test.ts
浏览文件 @
3719c2f6
...
...
@@ -33,7 +33,7 @@ suite('JSON - tokenization', () => {
);
tokenizationSupport
=
mode
.
tokenizationSupport
;
assertOnEnter
=
modesUtil
.
createOnEnterAsserter
(
mode
.
getId
(),
mode
.
richEditSupport
);
assertOnEnter
=
modesUtil
.
createOnEnterAsserter
(
mode
.
getId
(),
jsonMode
.
JSONMode
.
LANG_CONFIG
);
})();
...
...
src/vs/languages/less/common/less.ts
浏览文件 @
3719c2f6
...
...
@@ -21,7 +21,7 @@ import {IModelService} from 'vs/editor/common/services/modelService';
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
wireCancellationToken
}
from
'
vs/base/common/async
'
;
import
{
createTokenizationSupport
}
from
'
vs/editor/common/modes/monarch/monarchLexer
'
;
import
{
RichEditSupport
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
RichEditSupport
,
IRichLanguageConfiguration
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
export
var
language
:
Types
.
ILanguage
=
<
Types
.
ILanguage
>
{
defaultToken
:
''
,
...
...
@@ -168,6 +168,24 @@ export var language: Types.ILanguage = <Types.ILanguage> {
export
class
LESSMode
extends
AbstractMode
{
public
static
LANG_CONFIG
:
IRichLanguageConfiguration
=
{
// TODO@Martin: This definition does not work with umlauts for example
wordPattern
:
/
(
#
?
-
?\d
*
\.\d\w
*%
?)
|
([
@#!.:
]?[\w
-?
]
+%
?)
|
[
@#!.
]
/g
,
comments
:
{
blockComment
:
[
'
/*
'
,
'
*/
'
],
lineComment
:
'
//
'
},
brackets
:
[[
'
{
'
,
'
}
'
],
[
'
[
'
,
'
]
'
],
[
'
(
'
,
'
)
'
],
[
'
<
'
,
'
>
'
]],
autoClosingPairs
:
[
{
open
:
'
"
'
,
close
:
'
"
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
\'
'
,
close
:
'
\'
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
{
'
,
close
:
'
}
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
[
'
,
close
:
'
]
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
(
'
,
close
:
'
)
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
<
'
,
close
:
'
>
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
]
};
public
inplaceReplaceSupport
:
modes
.
IInplaceReplaceSupport
;
public
configSupport
:
modes
.
IConfigurationSupport
;
public
tokenizationSupport
:
modes
.
ITokenizationSupport
;
...
...
@@ -231,23 +249,7 @@ export class LESSMode extends AbstractMode {
this
.
tokenizationSupport
=
createTokenizationSupport
(
modeService
,
this
,
lexer
);
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
{
// TODO@Martin: This definition does not work with umlauts for example
wordPattern
:
/
(
#
?
-
?\d
*
\.\d\w
*%
?)
|
([
@#!.:
]?[\w
-?
]
+%
?)
|
[
@#!.
]
/g
,
comments
:
{
blockComment
:
[
'
/*
'
,
'
*/
'
],
lineComment
:
'
//
'
},
brackets
:
[[
'
{
'
,
'
}
'
],
[
'
[
'
,
'
]
'
],
[
'
(
'
,
'
)
'
],
[
'
<
'
,
'
>
'
]],
autoClosingPairs
:
[
{
open
:
'
"
'
,
close
:
'
"
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
\'
'
,
close
:
'
\'
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
{
'
,
close
:
'
}
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
[
'
,
close
:
'
]
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
(
'
,
close
:
'
)
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
<
'
,
close
:
'
>
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
]
});
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
LESSMode
.
LANG_CONFIG
);
}
public
creationDone
():
void
{
...
...
src/vs/languages/less/test/common/colorizer.test.ts
浏览文件 @
3719c2f6
...
...
@@ -63,7 +63,7 @@ suite('LESS-tokenization', () => {
);
tokenizationSupport
=
mode
.
tokenizationSupport
;
assertOnEnter
=
modesUtil
.
createOnEnterAsserter
(
mode
.
getId
(),
mode
.
richEditSupport
);
assertOnEnter
=
modesUtil
.
createOnEnterAsserter
(
mode
.
getId
(),
LESSMode
.
LANG_CONFIG
);
})();
test
(
''
,
()
=>
{
...
...
src/vs/languages/markdown/common/markdown.ts
浏览文件 @
3719c2f6
...
...
@@ -20,7 +20,7 @@ import {IConfigurationService} from 'vs/platform/configuration/common/configurat
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
AbstractMode
,
ModeWorkerManager
}
from
'
vs/editor/common/modes/abstractMode
'
;
import
{
createTokenizationSupport
}
from
'
vs/editor/common/modes/monarch/monarchLexer
'
;
import
{
RichEditSupport
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
RichEditSupport
,
IRichLanguageConfiguration
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
wireCancellationToken
}
from
'
vs/base/common/async
'
;
export
const
language
=
...
...
@@ -199,6 +199,14 @@ export const language =
export
class
MarkdownMode
extends
AbstractMode
implements
Modes
.
IEmitOutputSupport
{
public
static
LANG_CONFIG
:
IRichLanguageConfiguration
=
{
comments
:
{
blockComment
:
[
'
<!--
'
,
'
-->
'
,]
},
brackets
:
[[
'
{
'
,
'
}
'
],
[
'
[
'
,
'
]
'
],
[
'
(
'
,
'
)
'
],
[
'
<
'
,
'
>
'
]],
autoClosingPairs
:
[]
};
public
emitOutputSupport
:
Modes
.
IEmitOutputSupport
;
public
configSupport
:
Modes
.
IConfigurationSupport
;
public
tokenizationSupport
:
Modes
.
ITokenizationSupport
;
...
...
@@ -226,13 +234,7 @@ export class MarkdownMode extends AbstractMode implements Modes.IEmitOutputSuppo
this
.
tokenizationSupport
=
createTokenizationSupport
(
modeService
,
this
,
lexer
);
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
{
comments
:
{
blockComment
:
[
'
<!--
'
,
'
-->
'
,]
},
brackets
:
[[
'
{
'
,
'
}
'
],
[
'
[
'
,
'
]
'
],
[
'
(
'
,
'
)
'
],
[
'
<
'
,
'
>
'
]],
autoClosingPairs
:
[]
});
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
MarkdownMode
.
LANG_CONFIG
);
Modes
.
SuggestRegistry
.
register
(
this
.
getId
(),
{
triggerCharacters
:
[],
...
...
src/vs/languages/php/common/php.ts
浏览文件 @
3719c2f6
...
...
@@ -10,7 +10,7 @@ import Modes = require('vs/editor/common/modes');
import
{
AbstractMode
,
isDigit
,
createWordRegExp
}
from
'
vs/editor/common/modes/abstractMode
'
;
import
{
AbstractState
}
from
'
vs/editor/common/modes/abstractState
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
RichEditSupport
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
RichEditSupport
,
IRichLanguageConfiguration
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
TokenizationSupport
,
ILeavingNestedModeData
,
ITokenizationCustomization
}
from
'
vs/editor/common/modes/supports/tokenizationSupport
'
;
import
{
TextualSuggestSupport
}
from
'
vs/editor/common/modes/supports/suggestSupport
'
;
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
...
...
@@ -452,6 +452,29 @@ export class PHPEnterHTMLState extends PHPState {
export
class
PHPMode
extends
AbstractMode
implements
ITokenizationCustomization
{
public
static
LANG_CONFIG
:
IRichLanguageConfiguration
=
{
wordPattern
:
createWordRegExp
(
'
$_
'
),
comments
:
{
lineComment
:
'
//
'
,
blockComment
:
[
'
/*
'
,
'
*/
'
]
},
brackets
:
[
[
'
{
'
,
'
}
'
],
[
'
[
'
,
'
]
'
],
[
'
(
'
,
'
)
'
]
],
autoClosingPairs
:
[
{
open
:
'
{
'
,
close
:
'
}
'
,
notIn
:
[
'
string.php
'
]
},
{
open
:
'
[
'
,
close
:
'
]
'
,
notIn
:
[
'
string.php
'
]
},
{
open
:
'
(
'
,
close
:
'
)
'
,
notIn
:
[
'
string.php
'
]
},
{
open
:
'
"
'
,
close
:
'
"
'
,
notIn
:
[
'
string.php
'
]
},
{
open
:
'
\'
'
,
close
:
'
\'
'
,
notIn
:
[
'
string.php
'
]
}
]
};
public
tokenizationSupport
:
Modes
.
ITokenizationSupport
;
public
richEditSupport
:
Modes
.
IRichEditSupport
;
...
...
@@ -468,28 +491,7 @@ export class PHPMode extends AbstractMode implements ITokenizationCustomization
this
.
tokenizationSupport
=
new
TokenizationSupport
(
this
,
this
,
true
,
false
);
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
{
wordPattern
:
createWordRegExp
(
'
$_
'
),
comments
:
{
lineComment
:
'
//
'
,
blockComment
:
[
'
/*
'
,
'
*/
'
]
},
brackets
:
[
[
'
{
'
,
'
}
'
],
[
'
[
'
,
'
]
'
],
[
'
(
'
,
'
)
'
]
],
autoClosingPairs
:
[
{
open
:
'
{
'
,
close
:
'
}
'
,
notIn
:
[
'
string.php
'
]
},
{
open
:
'
[
'
,
close
:
'
]
'
,
notIn
:
[
'
string.php
'
]
},
{
open
:
'
(
'
,
close
:
'
)
'
,
notIn
:
[
'
string.php
'
]
},
{
open
:
'
"
'
,
close
:
'
"
'
,
notIn
:
[
'
string.php
'
]
},
{
open
:
'
\'
'
,
close
:
'
\'
'
,
notIn
:
[
'
string.php
'
]
}
]
});
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
PHPMode
.
LANG_CONFIG
);
if
(
editorWorkerService
)
{
Modes
.
SuggestRegistry
.
register
(
this
.
getId
(),
new
TextualSuggestSupport
(
editorWorkerService
,
configurationService
),
true
);
...
...
src/vs/languages/php/test/common/php.test.ts
浏览文件 @
3719c2f6
...
...
@@ -75,7 +75,7 @@ suite('Syntax Highlighting - PHP', () => {
);
tokenizationSupport
=
mode
.
tokenizationSupport
;
assertOnEnter
=
modesUtil
.
createOnEnterAsserter
(
mode
.
getId
(),
mode
.
richEditSupport
);
assertOnEnter
=
modesUtil
.
createOnEnterAsserter
(
mode
.
getId
(),
PHPMode
.
LANG_CONFIG
);
wordDefinition
=
LanguageConfigurationRegistry
.
getWordDefinition
(
mode
);
})();
...
...
src/vs/languages/razor/common/razor.ts
浏览文件 @
3719c2f6
...
...
@@ -12,7 +12,7 @@ import razorTokenTypes = require('vs/languages/razor/common/razorTokenTypes');
import
{
RAZORWorker
}
from
'
vs/languages/razor/common/razorWorker
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
RichEditSupport
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
RichEditSupport
,
IRichLanguageConfiguration
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
ILeavingNestedModeData
}
from
'
vs/editor/common/modes/supports/tokenizationSupport
'
;
import
{
IThreadService
}
from
'
vs/platform/thread/common/thread
'
;
import
{
wireCancellationToken
}
from
'
vs/base/common/async
'
;
...
...
@@ -56,6 +56,48 @@ class RAZORState extends htmlMode.State {
export
class
RAZORMode
extends
htmlMode
.
HTMLMode
<
RAZORWorker
>
{
public
static
LANG_CONFIG
:
IRichLanguageConfiguration
=
{
wordPattern
:
createWordRegExp
(
'
#?%
'
),
comments
:
{
blockComment
:
[
'
<!--
'
,
'
-->
'
]
},
brackets
:
[
[
'
<!--
'
,
'
-->
'
],
[
'
{
'
,
'
}
'
],
[
'
(
'
,
'
)
'
]
],
__electricCharacterSupport
:
{
embeddedElectricCharacters
:
[
'
*
'
,
'
}
'
,
'
]
'
,
'
)
'
]
},
autoClosingPairs
:
[
{
open
:
'
{
'
,
close
:
'
}
'
},
{
open
:
'
[
'
,
close
:
'
]
'
},
{
open
:
'
(
'
,
close
:
'
)
'
},
{
open
:
'
"
'
,
close
:
'
"
'
},
{
open
:
'
\'
'
,
close
:
'
\'
'
}
],
surroundingPairs
:
[
{
open
:
'
"
'
,
close
:
'
"
'
},
{
open
:
'
\'
'
,
close
:
'
\'
'
}
],
onEnterRules
:
[
{
beforeText
:
new
RegExp
(
`<(?!(?:
${
htmlMode
.
EMPTY_ELEMENTS
.
join
(
'
|
'
)}
))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`
,
'
i
'
),
afterText
:
/^<
\/(\w[\w\d]
*
)\s
*>$/i
,
action
:
{
indentAction
:
modes
.
IndentAction
.
IndentOutdent
}
},
{
beforeText
:
new
RegExp
(
`<(?!(?:
${
htmlMode
.
EMPTY_ELEMENTS
.
join
(
'
|
'
)}
))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`
,
'
i
'
),
action
:
{
indentAction
:
modes
.
IndentAction
.
Indent
}
}
],
};
constructor
(
descriptor
:
modes
.
IModeDescriptor
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
...
...
@@ -104,48 +146,7 @@ export class RAZORMode extends htmlMode.HTMLMode<RAZORWorker> {
}
protected
_createRichEditSupport
():
modes
.
IRichEditSupport
{
return
new
RichEditSupport
(
this
.
getId
(),
null
,
{
wordPattern
:
createWordRegExp
(
'
#?%
'
),
comments
:
{
blockComment
:
[
'
<!--
'
,
'
-->
'
]
},
brackets
:
[
[
'
<!--
'
,
'
-->
'
],
[
'
{
'
,
'
}
'
],
[
'
(
'
,
'
)
'
]
],
__electricCharacterSupport
:
{
embeddedElectricCharacters
:
[
'
*
'
,
'
}
'
,
'
]
'
,
'
)
'
]
},
autoClosingPairs
:
[
{
open
:
'
{
'
,
close
:
'
}
'
},
{
open
:
'
[
'
,
close
:
'
]
'
},
{
open
:
'
(
'
,
close
:
'
)
'
},
{
open
:
'
"
'
,
close
:
'
"
'
},
{
open
:
'
\'
'
,
close
:
'
\'
'
}
],
surroundingPairs
:
[
{
open
:
'
"
'
,
close
:
'
"
'
},
{
open
:
'
\'
'
,
close
:
'
\'
'
}
],
onEnterRules
:
[
{
beforeText
:
new
RegExp
(
`<(?!(?:
${
htmlMode
.
EMPTY_ELEMENTS
.
join
(
'
|
'
)}
))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`
,
'
i
'
),
afterText
:
/^<
\/(\w[\w\d]
*
)\s
*>$/i
,
action
:
{
indentAction
:
modes
.
IndentAction
.
IndentOutdent
}
},
{
beforeText
:
new
RegExp
(
`<(?!(?:
${
htmlMode
.
EMPTY_ELEMENTS
.
join
(
'
|
'
)}
))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`
,
'
i
'
),
action
:
{
indentAction
:
modes
.
IndentAction
.
Indent
}
}
],
});
return
new
RichEditSupport
(
this
.
getId
(),
null
,
RAZORMode
.
LANG_CONFIG
);
}
public
getInitialState
():
modes
.
IState
{
...
...
src/vs/languages/sass/common/sass.ts
浏览文件 @
3719c2f6
...
...
@@ -21,7 +21,7 @@ import {IModelService} from 'vs/editor/common/services/modelService';
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
wireCancellationToken
}
from
'
vs/base/common/async
'
;
import
{
createTokenizationSupport
}
from
'
vs/editor/common/modes/monarch/monarchLexer
'
;
import
{
RichEditSupport
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
RichEditSupport
,
IRichLanguageConfiguration
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
export
var
language
=
<
Types
.
ILanguage
>
{
defaultToken
:
''
,
...
...
@@ -270,6 +270,24 @@ export var language = <Types.ILanguage>{
export
class
SASSMode
extends
AbstractMode
{
public
static
LANG_CONFIG
:
IRichLanguageConfiguration
=
{
// TODO@Martin: This definition does not work with umlauts for example
wordPattern
:
/
(
#
?
-
?\d
*
\.\d\w
*%
?)
|
([
@#!.:
]?[\w
-?
]
+%
?)
|
[
@#!.
]
/g
,
comments
:
{
blockComment
:
[
'
/*
'
,
'
*/
'
],
lineComment
:
'
//
'
},
brackets
:
[[
'
{
'
,
'
}
'
],
[
'
[
'
,
'
]
'
],
[
'
(
'
,
'
)
'
],
[
'
<
'
,
'
>
'
]],
autoClosingPairs
:
[
{
open
:
'
"
'
,
close
:
'
"
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
\'
'
,
close
:
'
\'
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
{
'
,
close
:
'
}
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
[
'
,
close
:
'
]
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
(
'
,
close
:
'
)
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
<
'
,
close
:
'
>
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
]
};
public
inplaceReplaceSupport
:
modes
.
IInplaceReplaceSupport
;
public
configSupport
:
modes
.
IConfigurationSupport
;
public
tokenizationSupport
:
modes
.
ITokenizationSupport
;
...
...
@@ -332,23 +350,7 @@ export class SASSMode extends AbstractMode {
this
.
tokenizationSupport
=
createTokenizationSupport
(
modeService
,
this
,
lexer
);
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
{
// TODO@Martin: This definition does not work with umlauts for example
wordPattern
:
/
(
#
?
-
?\d
*
\.\d\w
*%
?)
|
([
@#!.:
]?[\w
-?
]
+%
?)
|
[
@#!.
]
/g
,
comments
:
{
blockComment
:
[
'
/*
'
,
'
*/
'
],
lineComment
:
'
//
'
},
brackets
:
[[
'
{
'
,
'
}
'
],
[
'
[
'
,
'
]
'
],
[
'
(
'
,
'
)
'
],
[
'
<
'
,
'
>
'
]],
autoClosingPairs
:
[
{
open
:
'
"
'
,
close
:
'
"
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
\'
'
,
close
:
'
\'
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
{
'
,
close
:
'
}
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
[
'
,
close
:
'
]
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
(
'
,
close
:
'
)
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
<
'
,
close
:
'
>
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
]
});
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
SASSMode
.
LANG_CONFIG
);
}
public
creationDone
():
void
{
...
...
src/vs/languages/sass/test/common/sass.test.ts
浏览文件 @
3719c2f6
...
...
@@ -41,7 +41,7 @@ suite('Sass Colorizer', () => {
);
tokenizationSupport
=
mode
.
tokenizationSupport
;
assertOnEnter
=
modesUtil
.
createOnEnterAsserter
(
mode
.
getId
(),
mode
.
richEditSupport
);
assertOnEnter
=
modesUtil
.
createOnEnterAsserter
(
mode
.
getId
(),
SASS
.
SASSMode
.
LANG_CONFIG
);
})();
...
...
src/vs/languages/typescript/common/mode.ts
浏览文件 @
3719c2f6
...
...
@@ -8,7 +8,7 @@ import * as modes from 'vs/editor/common/modes';
import
*
as
lifecycle
from
'
vs/base/common/lifecycle
'
;
import
{
createTokenizationSupport2
,
Language
}
from
'
vs/languages/typescript/common/tokenization
'
;
import
{
createWordRegExp
}
from
'
vs/editor/common/modes/abstractMode
'
;
import
{
RichEditSupport
,
IRichLanguageConfiguration
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
IRichLanguageConfiguration
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
...
...
@@ -38,7 +38,7 @@ function setupMode(modelService:IModelService, markerService:IMarkerService, mod
disposables
.
push
(
modeService
.
registerTokenizationSupport2
(
modeId
,
createTokenizationSupport2
(
language
)));
}
const
richEditConfiguration
:
IRichLanguageConfiguration
=
{
export
const
richEditConfiguration
:
IRichLanguageConfiguration
=
{
wordPattern
:
createWordRegExp
(
'
$
'
),
comments
:
{
...
...
@@ -95,10 +95,6 @@ const richEditConfiguration:IRichLanguageConfiguration = {
]
};
export
function
createRichEditSupport
(
modeId
:
string
):
RichEditSupport
{
return
new
RichEditSupport
(
modeId
,
null
,
richEditConfiguration
);
}
let
isActivated
=
false
;
export
function
activate
(
ctx
:
ServicesAccessor
):
void
{
if
(
isActivated
)
{
...
...
src/vs/languages/typescript/test/common/tokenization.test.ts
浏览文件 @
3719c2f6
...
...
@@ -6,12 +6,12 @@
import
modesUtil
=
require
(
'
vs/editor/test/common/modesUtil
'
);
import
{
createTokenizationSupport2
,
Language
}
from
'
vs/languages/typescript/common/tokenization
'
;
import
{
createRichEditSupport
}
from
'
vs/languages/typescript/common/mode
'
;
import
{
richEditConfiguration
}
from
'
vs/languages/typescript/common/mode
'
;
suite
(
'
TS/JS - syntax highlighting
'
,
()
=>
{
var
tokenizationSupport
=
createTokenizationSupport2
(
Language
.
EcmaScript5
);
var
assertOnEnter
=
modesUtil
.
createOnEnterAsserter
(
'
javascript
'
,
createRichEditSupport
(
'
javascript
'
)
);
var
assertOnEnter
=
modesUtil
.
createOnEnterAsserter
(
'
javascript
'
,
richEditConfiguration
);
test
(
'
onEnter
'
,
function
()
{
assertOnEnter
.
nothing
(
''
,
''
,
'
var f = function() {
'
);
...
...
src/vs/workbench/parts/output/common/outputMode.ts
浏览文件 @
3719c2f6
...
...
@@ -18,7 +18,7 @@ import * as modes from 'vs/editor/common/modes';
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
AbstractMode
,
ModeWorkerManager
}
from
'
vs/editor/common/modes/abstractMode
'
;
import
{
createTokenizationSupport
}
from
'
vs/editor/common/modes/monarch/monarchLexer
'
;
import
{
RichEditSupport
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
RichEditSupport
,
IRichLanguageConfiguration
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
wireCancellationToken
}
from
'
vs/base/common/async
'
;
export
const
language
:
types
.
ILanguage
=
{
...
...
@@ -46,6 +46,18 @@ export const language: types.ILanguage = {
export
class
OutputMode
extends
AbstractMode
{
public
static
LANG_CONFIG
:
IRichLanguageConfiguration
=
{
brackets
:
[[
'
{
'
,
'
}
'
],
[
'
[
'
,
'
]
'
],
[
'
(
'
,
'
)
'
],
[
'
<
'
,
'
>
'
]],
autoClosingPairs
:
[
{
open
:
'
"
'
,
close
:
'
"
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
\'
'
,
close
:
'
\'
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
{
'
,
close
:
'
}
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
[
'
,
close
:
'
]
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
(
'
,
close
:
'
)
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
<
'
,
close
:
'
>
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
]
};
public
tokenizationSupport
:
modes
.
ITokenizationSupport
;
public
richEditSupport
:
modes
.
IRichEditSupport
;
...
...
@@ -64,17 +76,7 @@ export class OutputMode extends AbstractMode {
this
.
tokenizationSupport
=
createTokenizationSupport
(
modeService
,
this
,
lexer
);
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
{
brackets
:
[[
'
{
'
,
'
}
'
],
[
'
[
'
,
'
]
'
],
[
'
(
'
,
'
)
'
],
[
'
<
'
,
'
>
'
]],
autoClosingPairs
:
[
{
open
:
'
"
'
,
close
:
'
"
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
\'
'
,
close
:
'
\'
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
{
'
,
close
:
'
}
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
[
'
,
close
:
'
]
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
(
'
,
close
:
'
)
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
{
open
:
'
<
'
,
close
:
'
>
'
,
notIn
:
[
'
string
'
,
'
comment
'
]
},
]
});
this
.
richEditSupport
=
new
RichEditSupport
(
this
.
getId
(),
null
,
OutputMode
.
LANG_CONFIG
);
modes
.
LinkProviderRegistry
.
register
(
this
.
getId
(),
{
provideLinks
:
(
model
,
token
):
Thenable
<
modes
.
ILink
[]
>
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录