Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4ad0fd04
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,发现更多精彩内容 >>
提交
4ad0fd04
编写于
5月 26, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - renames
上级
f2cf819a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
14 deletion
+14
-14
src/vs/editor/contrib/snippet/browser/snippetController2.ts
src/vs/editor/contrib/snippet/browser/snippetController2.ts
+1
-1
src/vs/editor/contrib/snippet/browser/snippetSession.ts
src/vs/editor/contrib/snippet/browser/snippetSession.ts
+1
-1
src/vs/editor/contrib/snippet/test/browser/snippetSession.test.ts
...ditor/contrib/snippet/test/browser/snippetSession.test.ts
+12
-12
未找到文件。
src/vs/editor/contrib/snippet/browser/snippetController2.ts
浏览文件 @
4ad0fd04
...
...
@@ -90,7 +90,7 @@ export class SnippetController2 {
return
this
.
cancel
();
}
if
(
this
.
_snippet
.
isAtFinalPlaceholder
||
!
this
.
_snippet
.
isSelectionWithPlaceholders
())
{
if
(
this
.
_snippet
.
isAtFinalPlaceholder
||
!
this
.
_snippet
.
isSelectionWith
in
Placeholders
())
{
return
this
.
cancel
();
}
...
...
src/vs/editor/contrib/snippet/browser/snippetSession.ts
浏览文件 @
4ad0fd04
...
...
@@ -321,7 +321,7 @@ export class SnippetSession {
return
this
.
_snippets
[
0
].
hasPlaceholder
;
}
isSelectionWithPlaceholders
():
boolean
{
isSelectionWith
in
Placeholders
():
boolean
{
const
selections
=
this
.
_editor
.
getSelections
();
if
(
selections
.
length
<
this
.
_snippets
.
length
)
{
// this means we started snippet mode with N
...
...
src/vs/editor/contrib/snippet/test/browser/snippetSession.test.ts
浏览文件 @
4ad0fd04
...
...
@@ -299,28 +299,28 @@ suite('SnippetSession', function () {
assert
.
equal
(
model
.
getValue
(),
'
foofarboobarfunction foo() {
\n
foofarboobarconsole.log(a);
\n
}
'
);
assertSelections
(
editor
,
new
Selection
(
1
,
1
,
1
,
4
),
new
Selection
(
2
,
5
,
2
,
8
));
assert
.
equal
(
session
.
isSelectionWithPlaceholders
(),
true
);
assert
.
equal
(
session
.
isSelectionWith
in
Placeholders
(),
true
);
editor
.
setSelections
([
new
Selection
(
1
,
1
,
1
,
1
)]);
assert
.
equal
(
session
.
isSelectionWithPlaceholders
(),
false
);
assert
.
equal
(
session
.
isSelectionWith
in
Placeholders
(),
false
);
editor
.
setSelections
([
new
Selection
(
1
,
6
,
1
,
6
),
new
Selection
(
2
,
10
,
2
,
10
)]);
assert
.
equal
(
session
.
isSelectionWithPlaceholders
(),
false
);
// in snippet, outside placeholder
assert
.
equal
(
session
.
isSelectionWith
in
Placeholders
(),
false
);
// in snippet, outside placeholder
editor
.
setSelections
([
new
Selection
(
1
,
6
,
1
,
6
),
new
Selection
(
2
,
10
,
2
,
10
),
new
Selection
(
1
,
1
,
1
,
1
)]);
assert
.
equal
(
session
.
isSelectionWithPlaceholders
(),
false
);
// in snippet, outside placeholder
assert
.
equal
(
session
.
isSelectionWith
in
Placeholders
(),
false
);
// in snippet, outside placeholder
editor
.
setSelections
([
new
Selection
(
1
,
6
,
1
,
6
),
new
Selection
(
2
,
10
,
2
,
10
),
new
Selection
(
2
,
20
,
2
,
21
)]);
assert
.
equal
(
session
.
isSelectionWithPlaceholders
(),
false
);
assert
.
equal
(
session
.
isSelectionWith
in
Placeholders
(),
false
);
// reset selection to placeholder
session
.
next
();
assert
.
equal
(
session
.
isSelectionWithPlaceholders
(),
true
);
assert
.
equal
(
session
.
isSelectionWith
in
Placeholders
(),
true
);
assertSelections
(
editor
,
new
Selection
(
1
,
10
,
1
,
13
),
new
Selection
(
2
,
14
,
2
,
17
));
// reset selection to placeholder
session
.
next
();
assert
.
equal
(
session
.
isSelectionWithPlaceholders
(),
true
);
assert
.
equal
(
session
.
isSelectionWith
in
Placeholders
(),
true
);
assert
.
equal
(
session
.
isAtFinalPlaceholder
,
true
);
assertSelections
(
editor
,
new
Selection
(
1
,
13
,
1
,
13
),
new
Selection
(
2
,
17
,
2
,
17
));
});
...
...
@@ -354,10 +354,10 @@ suite('SnippetSession', function () {
const
session
=
new
SnippetSession
(
editor
);
session
.
insert
(
'
farboo$0
'
);
assert
.
equal
(
session
.
isAtFinalPlaceholder
,
true
);
assert
.
equal
(
session
.
isSelectionWithPlaceholders
(),
false
);
assert
.
equal
(
session
.
isSelectionWith
in
Placeholders
(),
false
);
editor
.
trigger
(
'
test
'
,
'
type
'
,
{
text
:
'
XXX
'
});
assert
.
equal
(
session
.
isSelectionWithPlaceholders
(),
false
);
assert
.
equal
(
session
.
isSelectionWith
in
Placeholders
(),
false
);
});
test
(
'
snippets, typing at beginning
'
,
function
()
{
...
...
@@ -367,12 +367,12 @@ suite('SnippetSession', function () {
session
.
insert
(
'
farboo$0
'
);
editor
.
setSelection
(
new
Selection
(
1
,
2
,
1
,
2
));
assert
.
equal
(
session
.
isSelectionWithPlaceholders
(),
false
);
assert
.
equal
(
session
.
isSelectionWith
in
Placeholders
(),
false
);
assert
.
equal
(
session
.
isAtFinalPlaceholder
,
true
);
editor
.
trigger
(
'
test
'
,
'
type
'
,
{
text
:
'
XXX
'
});
assert
.
equal
(
model
.
getLineContent
(
1
),
'
fXXXfarboounction foo() {
'
);
assert
.
equal
(
session
.
isSelectionWithPlaceholders
(),
false
);
assert
.
equal
(
session
.
isSelectionWith
in
Placeholders
(),
false
);
session
.
next
();
assertSelections
(
editor
,
new
Selection
(
1
,
11
,
1
,
11
));
...
...
@@ -410,7 +410,7 @@ suite('SnippetSession', function () {
assertSelections
(
editor
,
new
Selection
(
1
,
4
,
1
,
4
),
new
Selection
(
2
,
8
,
2
,
8
));
session
.
insert
(
'
bar
'
);
assert
.
ok
(
session
.
isSelectionWithPlaceholders
());
assert
.
ok
(
session
.
isSelectionWith
in
Placeholders
());
assertSelections
(
editor
,
new
Selection
(
1
,
7
,
1
,
7
),
new
Selection
(
2
,
11
,
2
,
11
));
session
.
next
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录