Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
90581c7f
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,体验更适合开发者的 AI 搜索 >>
提交
90581c7f
编写于
5月 30, 2018
作者:
R
Ramya Achutha Rao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Dont trigger emmet for # in selectors Fixes #49269
上级
8251be5d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
7 deletion
+32
-7
extensions/emmet/src/abbreviationActions.ts
extensions/emmet/src/abbreviationActions.ts
+4
-1
extensions/emmet/src/test/cssAbbreviationAction.test.ts
extensions/emmet/src/test/cssAbbreviationAction.test.ts
+22
-0
extensions/emmet/src/test/partialParsingStylesheet.test.ts
extensions/emmet/src/test/partialParsingStylesheet.test.ts
+6
-6
未找到文件。
extensions/emmet/src/abbreviationActions.ts
浏览文件 @
90581c7f
...
...
@@ -8,7 +8,7 @@ import { Node, HtmlNode, Rule, Property, Stylesheet } from 'EmmetNode';
import
{
getEmmetHelper
,
getNode
,
getInnerRange
,
getMappingForIncludedLanguages
,
parseDocument
,
validate
,
getEmmetConfiguration
,
isStyleSheet
,
getEmmetMode
,
parsePartialStylesheet
,
isStyleAttribute
,
getEmbeddedCssNodeIfAny
}
from
'
./util
'
;
const
trimRegex
=
/
[\u
00a0
]
*
[\d
|#|
\-
|
\*
|
\u
2022
]
+
\.?
/
;
const
hexColorRegex
=
/^#
\d
+
$/
;
const
hexColorRegex
=
/^#
[\d
,a-f,A-F
]{0,6}
$/
;
const
allowedMimeTypesInScriptTag
=
[
'
text/html
'
,
'
text/plain
'
,
'
text/x-template
'
,
'
text/template
'
];
const
inlineElements
=
[
'
a
'
,
'
abbr
'
,
'
acronym
'
,
'
applet
'
,
'
b
'
,
'
basefont
'
,
'
bdo
'
,
'
big
'
,
'
br
'
,
'
button
'
,
'
cite
'
,
'
code
'
,
'
del
'
,
'
dfn
'
,
'
em
'
,
'
font
'
,
'
i
'
,
...
...
@@ -402,6 +402,9 @@ export function isValidLocationForEmmetAbbreviation(document: vscode.TextDocumen
&&
abbreviation
.
indexOf
(
'
:
'
)
===
-
1
)
{
return
hexColorRegex
.
test
(
abbreviation
)
||
abbreviation
===
'
!
'
;
}
if
(
hexColorRegex
.
test
(
abbreviation
)
||
abbreviation
===
'
!
'
)
{
return
false
;
}
}
// If current node is a rule or at-rule, then perform additional checks to ensure
...
...
extensions/emmet/src/test/cssAbbreviationAction.test.ts
浏览文件 @
90581c7f
...
...
@@ -310,6 +310,28 @@ nav#
});
});
test
(
'
# shouldnt expand to hex color when in selector (CSS)
'
,
()
=>
{
const
testContent
=
`
.foo {
#
}
`
;
return
withRandomFileEditor
(
testContent
,
'
css
'
,
(
editor
,
doc
)
=>
{
editor
.
selection
=
new
Selection
(
2
,
2
,
2
,
2
);
return
expandEmmetAbbreviation
(
null
).
then
(()
=>
{
assert
.
equal
(
editor
.
document
.
getText
(),
testContent
);
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
new
Position
(
2
,
2
),
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
if
(
completionPromise
)
{
assert
.
equal
(
1
,
2
,
`Invalid completion of hex color at property name`
);
}
return
Promise
.
resolve
();
});
});
});
test
(
'
Expand abbreviation in completion list (CSS)
'
,
()
=>
{
const
abbreviation
=
'
pos:f
'
;
const
expandedText
=
'
position: fixed;
'
;
...
...
extensions/emmet/src/test/partialParsingStylesheet.test.ts
浏览文件 @
90581c7f
...
...
@@ -56,7 +56,7 @@ p {
const
sassContents
=
`
.foo
// .foo { brs
/* .foo { op.3
/* .foo { op.3
dn {
*/
@
...
...
@@ -80,7 +80,7 @@ dn {
test
(
'
Block comment between selector and open brace
'
,
function
():
any
{
const
cssContents
=
`
p
p
/* First line
of a multiline
comment */
...
...
@@ -197,7 +197,6 @@ p.#{dn} {
return
withRandomFileEditor
(
sassContents
,
'
.scss
'
,
(
editor
,
doc
)
=>
{
let
rangesForEmmet
=
[
new
vscode
.
Range
(
2
,
1
,
2
,
4
),
// p.3 inside a ruleset whose selector uses interpolation
new
vscode
.
Range
(
3
,
1
,
3
,
2
),
// # inside ruleset
new
vscode
.
Range
(
4
,
1
,
4
,
3
)
// dn inside ruleset after property with variable
];
let
rangesNotEmmet
=
[
...
...
@@ -206,7 +205,8 @@ p.#{dn} {
new
vscode
.
Range
(
1
,
4
,
1
,
6
),
// In dn inside variable in selector
new
vscode
.
Range
(
3
,
7
,
3
,
8
),
// r of attr inside variable
new
vscode
.
Range
(
5
,
2
,
5
,
4
),
// op after ruleset
new
vscode
.
Range
(
7
,
1
,
7
,
3
)
// dn inside ruleset whose selector uses nested interpolation
new
vscode
.
Range
(
7
,
1
,
7
,
3
),
// dn inside ruleset whose selector uses nested interpolation
new
vscode
.
Range
(
3
,
1
,
3
,
2
),
// # inside ruleset
];
rangesForEmmet
.
forEach
(
range
=>
{
assert
.
equal
(
isValid
(
doc
,
range
,
'
scss
'
),
true
);
...
...
@@ -230,7 +230,7 @@ om
ment */{
m10
}
.boo{
.boo{
op.3
}
`
;
...
...
@@ -256,5 +256,5 @@ ment */{
});
});
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录