Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e6b61067
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,发现更多精彩内容 >>
提交
e6b61067
编写于
4月 10, 2018
作者:
R
Ramya Achutha Rao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Validate surrounding text before providing emmet completions in jsx/xml Fixes #47612
上级
0940ea62
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
41 addition
and
1 deletion
+41
-1
extensions/emmet/src/defaultCompletionProvider.ts
extensions/emmet/src/defaultCompletionProvider.ts
+1
-1
extensions/emmet/src/test/abbreviationAction.test.ts
extensions/emmet/src/test/abbreviationAction.test.ts
+40
-0
未找到文件。
extensions/emmet/src/defaultCompletionProvider.ts
浏览文件 @
e6b61067
...
...
@@ -37,7 +37,7 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi
let
rootNode
:
Stylesheet
|
undefined
=
undefined
;
if
(
context
.
triggerKind
!==
vscode
.
CompletionTriggerKind
.
TriggerForIncompleteCompletions
)
{
validateLocation
=
syntax
===
'
html
'
||
isStyleSheet
(
document
.
languageId
);
validateLocation
=
syntax
===
'
html
'
||
syntax
===
'
jsx
'
||
syntax
===
'
xml
'
||
isStyleSheet
(
document
.
languageId
);
// If document can be css parsed, get currentNode
if
(
isStyleSheet
(
document
.
languageId
))
{
let
usePartialParsing
=
vscode
.
workspace
.
getConfiguration
(
'
emmet
'
)[
'
optimizeStylesheetParsing
'
]
===
true
;
...
...
extensions/emmet/src/test/abbreviationAction.test.ts
浏览文件 @
e6b61067
...
...
@@ -336,6 +336,46 @@ suite('Tests for jsx, xml and xsl', () => {
});
});
test
(
'
No expanding text inside open tag in completion list (jsx)
'
,
()
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
jsx
'
,
(
editor
,
doc
)
=>
{
editor
.
selection
=
new
Selection
(
2
,
4
,
2
,
4
);
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
assert
.
equal
(
!
completionPromise
,
true
,
`Got unexpected comapletion promise instead of undefined`
);
return
Promise
.
resolve
();
});
});
test
(
'
No expanding tag that is opened, but not closed in completion list (jsx)
'
,
()
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
jsx
'
,
(
editor
,
doc
)
=>
{
editor
.
selection
=
new
Selection
(
9
,
6
,
9
,
6
);
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
assert
.
equal
(
!
completionPromise
,
true
,
`Got unexpected comapletion promise instead of undefined`
);
return
Promise
.
resolve
();
});
});
test
(
'
No expanding text inside open tag when there is no closing tag in completion list (jsx)
'
,
()
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
jsx
'
,
(
editor
,
doc
)
=>
{
editor
.
selection
=
new
Selection
(
9
,
8
,
9
,
8
);
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
assert
.
equal
(
!
completionPromise
,
true
,
`Got unexpected comapletion promise instead of undefined`
);
return
Promise
.
resolve
();
});
});
test
(
'
No expanding text in completion list inside open tag when there is no closing tag when there is no parent node (jsx)
'
,
()
=>
{
const
fileContents
=
'
<img s
'
;
return
withRandomFileEditor
(
fileContents
,
'
jsx
'
,
(
editor
,
doc
)
=>
{
editor
.
selection
=
new
Selection
(
0
,
6
,
0
,
6
);
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
assert
.
equal
(
!
completionPromise
,
true
,
`Got unexpected comapletion promise instead of undefined`
);
return
Promise
.
resolve
();
});
});
});
function
testExpandAbbreviation
(
syntax
:
string
,
selection
:
Selection
,
abbreviation
:
string
,
expandedText
:
string
,
shouldFail
?:
boolean
):
Thenable
<
any
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录