Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
bc2dcbf9
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,发现更多精彩内容 >>
提交
bc2dcbf9
编写于
2月 22, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move `CharacterPair` to `modes.ts` and adopt in `onEnter.ts`
上级
4a7d555d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
30 addition
and
39 deletion
+30
-39
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+2
-0
src/vs/editor/common/modes/monarch/monarchCommon.ts
src/vs/editor/common/modes/monarch/monarchCommon.ts
+1
-2
src/vs/editor/common/modes/monarch/monarchCompile.ts
src/vs/editor/common/modes/monarch/monarchCompile.ts
+1
-2
src/vs/editor/common/modes/supports/onEnter.ts
src/vs/editor/common/modes/supports/onEnter.ts
+12
-15
src/vs/editor/common/modes/supports/richEditBrackets.ts
src/vs/editor/common/modes/supports/richEditBrackets.ts
+1
-3
src/vs/editor/common/modes/supports/richEditSupport.ts
src/vs/editor/common/modes/supports/richEditSupport.ts
+8
-12
src/vs/editor/test/common/modes/supports/onEnter.test.ts
src/vs/editor/test/common/modes/supports/onEnter.test.ts
+5
-5
未找到文件。
src/vs/editor/common/modes.ts
浏览文件 @
bc2dcbf9
...
...
@@ -649,6 +649,8 @@ export interface ITaskSupport {
clean
?():
TPromise
<
void
>
;
}
export
type
CharacterPair
=
[
string
,
string
];
export
interface
IAutoClosingPairConditional
extends
IAutoClosingPair
{
notIn
?:
string
[];
}
...
...
src/vs/editor/common/modes/monarch/monarchCommon.ts
浏览文件 @
bc2dcbf9
...
...
@@ -4,8 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
Bracket
,
IAutoClosingPairConditional
,
ISuggestion
}
from
'
vs/editor/common/modes
'
;
import
{
CharacterPair
}
from
'
vs/editor/common/modes/supports/richEditBrackets
'
;
import
{
CharacterPair
,
Bracket
,
IAutoClosingPairConditional
,
ISuggestion
}
from
'
vs/editor/common/modes
'
;
/*
* This module exports common types and functionality shared between
...
...
src/vs/editor/common/modes/monarch/monarchCompile.ts
浏览文件 @
bc2dcbf9
...
...
@@ -10,10 +10,9 @@
*/
import
*
as
objects
from
'
vs/base/common/objects
'
;
import
{
Bracket
,
IAutoClosingPairConditional
}
from
'
vs/editor/common/modes
'
;
import
{
Bracket
,
IAutoClosingPairConditional
,
CharacterPair
}
from
'
vs/editor/common/modes
'
;
import
*
as
monarchCommon
from
'
vs/editor/common/modes/monarch/monarchCommon
'
;
import
{
ILanguage
,
ILanguageBracket
}
from
'
vs/editor/common/modes/monarch/monarchTypes
'
;
import
{
CharacterPair
}
from
'
vs/editor/common/modes/supports/richEditBrackets
'
;
/*
* Type helpers
...
...
src/vs/editor/common/modes/supports/onEnter.ts
浏览文件 @
bc2dcbf9
...
...
@@ -8,14 +8,9 @@ import {onUnexpectedError} from 'vs/base/common/errors';
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
IPosition
,
ITextModel
,
ITokenizedModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEnterAction
,
ILineContext
,
IMode
,
IRichEditOnEnter
,
IndentAction
}
from
'
vs/editor/common/modes
'
;
import
{
IEnterAction
,
ILineContext
,
IMode
,
IRichEditOnEnter
,
IndentAction
,
CharacterPair
}
from
'
vs/editor/common/modes
'
;
import
{
handleEvent
}
from
'
vs/editor/common/modes/supports
'
;
export
interface
IBracketPair
{
open
:
string
;
close
:
string
;
}
export
interface
IIndentationRules
{
decreaseIndentPattern
:
RegExp
;
increaseIndentPattern
:
RegExp
;
...
...
@@ -30,12 +25,14 @@ export interface IOnEnterRegExpRules {
}
export
interface
IOnEnterSupportOptions
{
brackets
?:
IBracket
Pair
[];
brackets
?:
Character
Pair
[];
indentationRules
?:
IIndentationRules
;
regExpRules
?:
IOnEnterRegExpRules
[];
}
interface
IProcessedBracketPair
extends
IBracketPair
{
interface
IProcessedBracketPair
{
open
:
string
;
close
:
string
;
openRegExp
:
RegExp
;
closeRegExp
:
RegExp
;
}
...
...
@@ -54,18 +51,18 @@ export class OnEnterSupport implements IRichEditOnEnter {
constructor
(
modeId
:
string
,
opts
?:
IOnEnterSupportOptions
)
{
opts
=
opts
||
{};
opts
.
brackets
=
opts
.
brackets
||
[
{
open
:
'
(
'
,
close
:
'
)
'
}
,
{
open
:
'
{
'
,
close
:
'
}
'
}
,
{
open
:
'
[
'
,
close
:
'
]
'
}
[
'
(
'
,
'
)
'
]
,
[
'
{
'
,
'
}
'
]
,
[
'
[
'
,
'
]
'
]
];
this
.
_modeId
=
modeId
;
this
.
_brackets
=
opts
.
brackets
.
map
((
bracket
)
=>
{
return
{
open
:
bracket
.
open
,
openRegExp
:
OnEnterSupport
.
_createOpenBracketRegExp
(
bracket
.
open
),
close
:
bracket
.
close
,
closeRegExp
:
OnEnterSupport
.
_createCloseBracketRegExp
(
bracket
.
close
),
open
:
bracket
[
0
]
,
openRegExp
:
OnEnterSupport
.
_createOpenBracketRegExp
(
bracket
[
0
]
),
close
:
bracket
[
1
]
,
closeRegExp
:
OnEnterSupport
.
_createCloseBracketRegExp
(
bracket
[
1
]
),
};
});
this
.
_regExpRules
=
opts
.
regExpRules
||
[];
...
...
src/vs/editor/common/modes/supports/richEditBrackets.ts
浏览文件 @
bc2dcbf9
...
...
@@ -9,8 +9,6 @@ import {Range} from 'vs/editor/common/core/range';
import
{
IRichEditBracket
}
from
'
vs/editor/common/editorCommon
'
;
import
*
as
modes
from
'
vs/editor/common/modes
'
;
export
type
CharacterPair
=
[
string
,
string
];
interface
ISimpleInternalBracket
{
open
:
string
;
close
:
string
;
...
...
@@ -25,7 +23,7 @@ export class RichEditBrackets implements modes.IRichEditBrackets {
public
textIsBracket
:
{[
text
:
string
]:
IRichEditBracket
;};
public
textIsOpenBracket
:
{[
text
:
string
]:
boolean
;};
constructor
(
modeId
:
string
,
brackets
:
CharacterPair
[])
{
constructor
(
modeId
:
string
,
brackets
:
modes
.
CharacterPair
[])
{
this
.
brackets
=
brackets
.
map
((
b
)
=>
{
return
{
modeId
:
modeId
,
...
...
src/vs/editor/common/modes/supports/richEditSupport.ts
浏览文件 @
bc2dcbf9
...
...
@@ -4,13 +4,13 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
ICommentsConfiguration
,
IRichEditBrackets
,
IRichEditCharacterPair
,
IRichEditOnEnter
,
IRichEditSupport
}
from
'
vs/editor/common/modes
'
;
import
{
ICommentsConfiguration
,
IRichEditBrackets
,
IRichEditCharacterPair
,
IRichEditOnEnter
,
IRichEditSupport
,
CharacterPair
}
from
'
vs/editor/common/modes
'
;
import
{
NullMode
}
from
'
vs/editor/common/modes/nullMode
'
;
import
{
CharacterPairSupport
}
from
'
vs/editor/common/modes/supports/characterPair
'
;
import
{
ICharacterPairContribution
}
from
'
vs/editor/common/modes/supports/characterPair
'
;
import
{
BracketElectricCharacterSupport
,
IBracketElectricCharacterContribution
}
from
'
vs/editor/common/modes/supports/electricCharacter
'
;
import
{
IIndentationRules
,
IOnEnterRegExpRules
,
IOnEnterSupportOptions
,
OnEnterSupport
}
from
'
vs/editor/common/modes/supports/onEnter
'
;
import
{
CharacterPair
,
RichEditBrackets
}
from
'
vs/editor/common/modes/supports/richEditBrackets
'
;
import
{
RichEditBrackets
}
from
'
vs/editor/common/modes/supports/richEditBrackets
'
;
export
interface
CommentRule
{
lineComment
?:
string
;
...
...
@@ -82,22 +82,18 @@ export class RichEditSupport implements IRichEditSupport {
// on enter
let
onEnter
:
IOnEnterSupportOptions
=
{};
let
empty
=
true
;
let
{
brackets
,
indentationRules
,
onEnterRules
}
=
conf
;
if
(
brackets
)
{
if
(
conf
.
brackets
)
{
empty
=
false
;
onEnter
.
brackets
=
brackets
.
map
(
pair
=>
{
let
[
open
,
close
]
=
pair
;
return
{
open
,
close
};
});
onEnter
.
brackets
=
conf
.
brackets
;
}
if
(
indentationRules
)
{
if
(
conf
.
indentationRules
)
{
empty
=
false
;
onEnter
.
indentationRules
=
indentationRules
;
onEnter
.
indentationRules
=
conf
.
indentationRules
;
}
if
(
onEnterRules
)
{
if
(
conf
.
onEnterRules
)
{
empty
=
false
;
onEnter
.
regExpRules
=
<
any
>
onEnterRules
;
onEnter
.
regExpRules
=
conf
.
onEnterRules
;
}
if
(
!
empty
)
{
...
...
src/vs/editor/test/common/modes/supports/onEnter.test.ts
浏览文件 @
bc2dcbf9
...
...
@@ -5,8 +5,8 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
IndentAction
}
from
'
vs/editor/common/modes
'
;
import
{
IBracketPair
,
OnEnterSupport
}
from
'
vs/editor/common/modes/supports/onEnter
'
;
import
{
IndentAction
,
CharacterPair
}
from
'
vs/editor/common/modes
'
;
import
{
OnEnterSupport
}
from
'
vs/editor/common/modes/supports/onEnter
'
;
suite
(
'
OnEnter
'
,
()
=>
{
...
...
@@ -38,9 +38,9 @@ suite('OnEnter', () => {
});
test
(
'
uses brackets
'
,
()
=>
{
var
brackets
:
IBracket
Pair
[]
=
[
{
open
:
'
(
'
,
close
:
'
)
'
}
,
{
open
:
'
begin
'
,
close
:
'
end
'
}
var
brackets
:
Character
Pair
[]
=
[
[
'
(
'
,
'
)
'
]
,
[
'
begin
'
,
'
end
'
]
];
var
support
=
new
OnEnterSupport
(
null
,
{
brackets
:
brackets
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录