Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
699a12cb
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 搜索 >>
提交
699a12cb
编写于
12月 01, 2017
作者:
R
Ramya Achutha Rao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Mapped languages shld be excluded if in emmet excludes for expand cmd #39369
上级
7696c91e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
35 addition
and
17 deletion
+35
-17
extensions/emmet/src/abbreviationActions.ts
extensions/emmet/src/abbreviationActions.ts
+12
-3
extensions/emmet/src/test/abbreviationAction.test.ts
extensions/emmet/src/test/abbreviationAction.test.ts
+23
-14
未找到文件。
extensions/emmet/src/abbreviationActions.ts
浏览文件 @
699a12cb
...
...
@@ -105,6 +105,11 @@ export function expandEmmetAbbreviation(args: any): Thenable<boolean | undefined
args
=
args
||
{};
if
(
!
args
[
'
language
'
])
{
args
[
'
language
'
]
=
vscode
.
window
.
activeTextEditor
.
document
.
languageId
;
}
else
{
const
excludedLanguages
=
vscode
.
workspace
.
getConfiguration
(
'
emmet
'
)[
'
excludeLanguages
'
]
?
vscode
.
workspace
.
getConfiguration
(
'
emmet
'
)[
'
excludeLanguages
'
]
:
[];
if
(
excludedLanguages
.
indexOf
(
vscode
.
window
.
activeTextEditor
.
document
.
languageId
)
>
-
1
)
{
return
fallbackTab
();
}
}
const
syntax
=
getSyntaxFromArgs
(
args
);
if
(
!
syntax
)
{
...
...
@@ -343,9 +348,13 @@ function expandAbbr(input: ExpandAbbreviationInput): string | undefined {
function
getSyntaxFromArgs
(
args
:
Object
):
string
|
undefined
{
const
mappedModes
=
getMappingForIncludedLanguages
();
let
language
:
string
=
args
[
'
language
'
];
let
parentMode
:
string
=
args
[
'
parentMode
'
];
let
excludedLanguages
=
vscode
.
workspace
.
getConfiguration
(
'
emmet
'
)[
'
excludeLanguages
'
]
?
vscode
.
workspace
.
getConfiguration
(
'
emmet
'
)[
'
excludeLanguages
'
]
:
[];
const
language
:
string
=
args
[
'
language
'
];
const
parentMode
:
string
=
args
[
'
parentMode
'
];
const
excludedLanguages
=
vscode
.
workspace
.
getConfiguration
(
'
emmet
'
)[
'
excludeLanguages
'
]
?
vscode
.
workspace
.
getConfiguration
(
'
emmet
'
)[
'
excludeLanguages
'
]
:
[];
if
(
excludedLanguages
.
indexOf
(
language
)
>
-
1
)
{
return
;
}
let
syntax
=
getEmmetMode
((
mappedModes
[
language
]
?
mappedModes
[
language
]
:
language
),
excludedLanguages
);
if
(
!
syntax
)
{
syntax
=
getEmmetMode
((
mappedModes
[
parentMode
]
?
mappedModes
[
parentMode
]
:
parentMode
),
excludedLanguages
);
...
...
extensions/emmet/src/test/abbreviationAction.test.ts
浏览文件 @
699a12cb
...
...
@@ -119,47 +119,47 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
});
test
(
'
Expand snippets (HTML)
'
,
()
=>
{
return
test
HtmlExpandAbbreviation
(
new
Selection
(
3
,
23
,
3
,
23
),
'
img
'
,
'
<img src=
\
"
\
" alt=
\
"
\
">
'
);
return
test
ExpandAbbreviation
(
'
html
'
,
new
Selection
(
3
,
23
,
3
,
23
),
'
img
'
,
'
<img src=
\
"
\
" alt=
\
"
\
">
'
);
});
test
(
'
Expand abbreviation (HTML)
'
,
()
=>
{
return
test
HtmlExpandAbbreviation
(
new
Selection
(
5
,
25
,
5
,
25
),
'
ul>li
'
,
'
<ul>
\n\t\t\t
<li></li>
\n\t\t
</ul>
'
);
return
test
ExpandAbbreviation
(
'
html
'
,
new
Selection
(
5
,
25
,
5
,
25
),
'
ul>li
'
,
'
<ul>
\n\t\t\t
<li></li>
\n\t\t
</ul>
'
);
});
test
(
'
Expand text that is neither an abbreviation nor a snippet to tags (HTML)
'
,
()
=>
{
return
test
HtmlExpandAbbreviation
(
new
Selection
(
4
,
20
,
4
,
27
),
'
hithere
'
,
'
<hithere></hithere>
'
);
return
test
ExpandAbbreviation
(
'
html
'
,
new
Selection
(
4
,
20
,
4
,
27
),
'
hithere
'
,
'
<hithere></hithere>
'
);
});
test
(
'
Expand abbreviation with repeaters (HTML)
'
,
()
=>
{
return
test
HtmlExpandAbbreviation
(
new
Selection
(
6
,
27
,
6
,
27
),
'
ul>li*2
'
,
'
<ul>
\n\t\t\t
<li></li>
\n\t\t\t
<li></li>
\n\t\t
</ul>
'
);
return
test
ExpandAbbreviation
(
'
html
'
,
new
Selection
(
6
,
27
,
6
,
27
),
'
ul>li*2
'
,
'
<ul>
\n\t\t\t
<li></li>
\n\t\t\t
<li></li>
\n\t\t
</ul>
'
);
});
test
(
'
Expand abbreviation with numbered repeaters (HTML)
'
,
()
=>
{
return
test
HtmlExpandAbbreviation
(
new
Selection
(
7
,
33
,
7
,
33
),
'
ul>li.item$*2
'
,
'
<ul>
\n\t\t\t
<li class="item1"></li>
\n\t\t\t
<li class="item2"></li>
\n\t\t
</ul>
'
);
return
test
ExpandAbbreviation
(
'
html
'
,
new
Selection
(
7
,
33
,
7
,
33
),
'
ul>li.item$*2
'
,
'
<ul>
\n\t\t\t
<li class="item1"></li>
\n\t\t\t
<li class="item2"></li>
\n\t\t
</ul>
'
);
});
test
(
'
Expand abbreviation with numbered repeaters with offset (HTML)
'
,
()
=>
{
return
test
HtmlExpandAbbreviation
(
new
Selection
(
8
,
36
,
8
,
36
),
'
ul>li.item$@44*2
'
,
'
<ul>
\n\t\t\t
<li class="item44"></li>
\n\t\t\t
<li class="item45"></li>
\n\t\t
</ul>
'
);
return
test
ExpandAbbreviation
(
'
html
'
,
new
Selection
(
8
,
36
,
8
,
36
),
'
ul>li.item$@44*2
'
,
'
<ul>
\n\t\t\t
<li class="item44"></li>
\n\t\t\t
<li class="item45"></li>
\n\t\t
</ul>
'
);
});
test
(
'
Expand abbreviation with numbered repeaters in groups (HTML)
'
,
()
=>
{
return
test
HtmlExpandAbbreviation
(
new
Selection
(
17
,
16
,
17
,
16
),
'
(ul>li.item$)*2
'
,
'
<ul>
\n\t\t
<li class="item1"></li>
\n\t
</ul>
\n\t
<ul>
\n\t\t
<li class="item2"></li>
\n\t
</ul>
'
);
return
test
ExpandAbbreviation
(
'
html
'
,
new
Selection
(
17
,
16
,
17
,
16
),
'
(ul>li.item$)*2
'
,
'
<ul>
\n\t\t
<li class="item1"></li>
\n\t
</ul>
\n\t
<ul>
\n\t\t
<li class="item2"></li>
\n\t
</ul>
'
);
});
test
(
'
Expand abbreviation with numbered repeaters in groups with sibling in the end (HTML)
'
,
()
=>
{
return
test
HtmlExpandAbbreviation
(
new
Selection
(
18
,
21
,
18
,
21
),
'
(ul>li.item$)*2+span
'
,
'
<ul>
\n\t\t
<li class="item1"></li>
\n\t
</ul>
\n\t
<ul>
\n\t\t
<li class="item2"></li>
\n\t
</ul>
\n\t
<span></span>
'
);
return
test
ExpandAbbreviation
(
'
html
'
,
new
Selection
(
18
,
21
,
18
,
21
),
'
(ul>li.item$)*2+span
'
,
'
<ul>
\n\t\t
<li class="item1"></li>
\n\t
</ul>
\n\t
<ul>
\n\t\t
<li class="item2"></li>
\n\t
</ul>
\n\t
<span></span>
'
);
});
test
(
'
Expand abbreviation with nested groups (HTML)
'
,
()
=>
{
return
test
HtmlExpandAbbreviation
(
new
Selection
(
19
,
19
,
19
,
19
),
'
(div>dl>(dt+dd)*2)
'
,
'
<div>
\n\t\t
<dl>
\n\t\t\t
<dt></dt>
\n\t\t\t
<dd></dd>
\n\t\t\t
<dt></dt>
\n\t\t\t
<dd></dd>
\n\t\t
</dl>
\n\t
</div>
'
);
return
test
ExpandAbbreviation
(
'
html
'
,
new
Selection
(
19
,
19
,
19
,
19
),
'
(div>dl>(dt+dd)*2)
'
,
'
<div>
\n\t\t
<dl>
\n\t\t\t
<dt></dt>
\n\t\t\t
<dd></dd>
\n\t\t\t
<dt></dt>
\n\t\t\t
<dd></dd>
\n\t\t
</dl>
\n\t
</div>
'
);
});
test
(
'
Expand tag that is opened, but not closed (HTML)
'
,
()
=>
{
return
test
HtmlExpandAbbreviation
(
new
Selection
(
9
,
6
,
9
,
6
),
'
<div
'
,
'
<div></div>
'
);
return
test
ExpandAbbreviation
(
'
html
'
,
new
Selection
(
9
,
6
,
9
,
6
),
'
<div
'
,
'
<div></div>
'
);
});
test
(
'
No expanding text inside open tag (HTML)
'
,
()
=>
{
return
test
HtmlExpandAbbreviation
(
new
Selection
(
2
,
4
,
2
,
4
),
''
,
''
,
true
);
return
test
ExpandAbbreviation
(
'
html
'
,
new
Selection
(
2
,
4
,
2
,
4
),
''
,
''
,
true
);
});
test
(
'
Expand css when inside style tag (HTML)
'
,
()
=>
{
...
...
@@ -178,12 +178,21 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
test
(
'
No expanding when html is excluded in the settings
'
,
()
=>
{
return
workspace
.
getConfiguration
(
'
emmet
'
).
update
(
'
excludeLanguages
'
,
[
'
html
'
]).
then
(()
=>
{
return
test
HtmlExpandAbbreviation
(
new
Selection
(
9
,
6
,
9
,
6
),
''
,
''
,
true
).
then
(()
=>
{
return
test
ExpandAbbreviation
(
'
html
'
,
new
Selection
(
9
,
6
,
9
,
6
),
''
,
''
,
true
).
then
(()
=>
{
return
workspace
.
getConfiguration
(
'
emmet
'
).
update
(
'
excludeLanguages
'
,
[]);
});
});
});
test
(
'
No expanding when php (mapped syntax) is excluded in the settings
'
,
()
=>
{
return
workspace
.
getConfiguration
(
'
emmet
'
).
update
(
'
excludeLanguages
'
,
[
'
php
'
]).
then
(()
=>
{
return
testExpandAbbreviation
(
'
php
'
,
new
Selection
(
9
,
6
,
9
,
6
),
''
,
''
,
true
).
then
(()
=>
{
return
workspace
.
getConfiguration
(
'
emmet
'
).
update
(
'
excludeLanguages
'
,
[]);
});
});
});
});
suite
(
'
Tests for Expand Abbreviations (CSS)
'
,
()
=>
{
...
...
@@ -399,8 +408,8 @@ suite('Tests for jsx, xml and xsl', () => {
});
function
test
HtmlExpandAbbreviation
(
selection
:
Selection
,
abbreviation
:
string
,
expandedText
:
string
,
shouldFail
?:
boolean
):
Thenable
<
any
>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
(
editor
,
doc
)
=>
{
function
test
ExpandAbbreviation
(
syntax
:
string
,
selection
:
Selection
,
abbreviation
:
string
,
expandedText
:
string
,
shouldFail
?:
boolean
):
Thenable
<
any
>
{
return
withRandomFileEditor
(
htmlContents
,
syntax
,
(
editor
,
doc
)
=>
{
editor
.
selection
=
selection
;
let
expandPromise
=
expandEmmetAbbreviation
(
null
);
if
(
!
expandPromise
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录