Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
49ff1263
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,发现更多精彩内容 >>
提交
49ff1263
编写于
7月 24, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "fix #31124"
This reverts commit
552957ee
.
上级
e1e3051d
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
3 addition
and
47 deletion
+3
-47
src/vs/editor/contrib/snippet/browser/snippetSession.ts
src/vs/editor/contrib/snippet/browser/snippetSession.ts
+1
-20
src/vs/editor/contrib/snippet/browser/snippetVariables.ts
src/vs/editor/contrib/snippet/browser/snippetVariables.ts
+2
-2
src/vs/editor/contrib/snippet/test/browser/snippetSession.test.ts
...ditor/contrib/snippet/test/browser/snippetSession.test.ts
+0
-25
未找到文件。
src/vs/editor/contrib/snippet/browser/snippetSession.ts
浏览文件 @
49ff1263
...
@@ -212,25 +212,6 @@ export class OneSnippet {
...
@@ -212,25 +212,6 @@ export class OneSnippet {
}
}
}
}
class
WhitespaceAwareSnippetResolver
extends
EditorSnippetVariableResolver
{
constructor
(
model
:
IModel
,
selection
:
Selection
,
private
_snippetStart
:
IPosition
)
{
super
(
model
,
selection
);
}
resolve
(
name
:
string
):
string
{
let
ret
=
super
.
resolve
(
name
);
if
(
ret
)
{
ret
=
SnippetSession
.
adjustWhitespace
(
this
.
_model
,
this
.
_snippetStart
,
ret
);
}
return
ret
;
}
}
export
class
SnippetSession
{
export
class
SnippetSession
{
static
adjustWhitespace
(
model
:
IModel
,
position
:
IPosition
,
template
:
string
):
string
{
static
adjustWhitespace
(
model
:
IModel
,
position
:
IPosition
,
template
:
string
):
string
{
...
@@ -315,7 +296,7 @@ export class SnippetSession {
...
@@ -315,7 +296,7 @@ export class SnippetSession {
const
snippet
=
new
SnippetParser
()
const
snippet
=
new
SnippetParser
()
.
parse
(
adjustedTemplate
,
true
,
enforceFinalTabstop
)
.
parse
(
adjustedTemplate
,
true
,
enforceFinalTabstop
)
.
resolveVariables
(
new
WhitespaceAwareSnippetResolver
(
model
,
selection
,
start
));
.
resolveVariables
(
new
EditorSnippetVariableResolver
(
model
,
selection
));
const
offset
=
model
.
getOffsetAt
(
start
)
+
delta
;
const
offset
=
model
.
getOffsetAt
(
start
)
+
delta
;
delta
+=
snippet
.
text
.
length
-
model
.
getValueLengthInRange
(
snippetSelection
);
delta
+=
snippet
.
text
.
length
-
model
.
getValueLengthInRange
(
snippetSelection
);
...
...
src/vs/editor/contrib/snippet/browser/snippetVariables.ts
浏览文件 @
49ff1263
...
@@ -24,8 +24,8 @@ export class EditorSnippetVariableResolver {
...
@@ -24,8 +24,8 @@ export class EditorSnippetVariableResolver {
});
});
constructor
(
constructor
(
pr
otected
readonly
_model
:
IModel
,
pr
ivate
readonly
_model
:
IModel
,
pr
otected
readonly
_selection
:
Selection
pr
ivate
readonly
_selection
:
Selection
)
{
)
{
//
//
}
}
...
...
src/vs/editor/contrib/snippet/test/browser/snippetSession.test.ts
浏览文件 @
49ff1263
...
@@ -462,30 +462,5 @@ suite('SnippetSession', function () {
...
@@ -462,30 +462,5 @@ suite('SnippetSession', function () {
assert
.
equal
(
editor
.
getModel
().
getValue
(),
'
test 1
\n
test 2
\n
test 3
\n
test 4
\n
'
);
assert
.
equal
(
editor
.
getModel
().
getValue
(),
'
test 1
\n
test 2
\n
test 3
\n
test 4
\n
'
);
});
});
test
(
'
Snippet variable text isn
\'
t whitespace normalised, #31124
'
,
function
()
{
editor
.
getModel
().
setValue
([
'
start
'
,
'
\t
-one
'
,
'
\t
-two
'
,
'
end
'
].
join
(
'
\n
'
));
editor
.
getModel
().
updateOptions
({
insertSpaces
:
false
});
editor
.
setSelection
(
new
Selection
(
2
,
2
,
3
,
6
));
new
SnippetSession
(
editor
,
'
<div>
\n\t
$TM_SELECTED_TEXT
\n
</div>$0
'
).
insert
();
const
expected
=
[
'
start
'
,
'
\t
<div>
'
,
'
\t\t
-one
'
,
'
\t\t
-two
'
,
'
\t
</div>
'
,
'
end
'
].
join
(
'
\n
'
);
assert
.
equal
(
editor
.
getModel
().
getValue
(),
expected
);
});
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录