Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5769bebb
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,发现更多精彩内容 >>
提交
5769bebb
编写于
8月 29, 2017
作者:
R
Ramya Achutha Rao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable the use of comment filter in emmet
上级
4d7a7a15
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
19 addition
and
30 deletion
+19
-30
extensions/emmet/npm-shrinkwrap.json
extensions/emmet/npm-shrinkwrap.json
+3
-3
extensions/emmet/package.json
extensions/emmet/package.json
+1
-1
extensions/emmet/src/abbreviationActions.ts
extensions/emmet/src/abbreviationActions.ts
+14
-14
extensions/emmet/src/test/abbreviationAction.test.ts
extensions/emmet/src/test/abbreviationAction.test.ts
+1
-12
未找到文件。
extensions/emmet/npm-shrinkwrap.json
浏览文件 @
5769bebb
...
...
@@ -38,9 +38,9 @@
"resolved"
:
"https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz"
},
"vscode-emmet-helper"
:
{
"version"
:
"1.1.
0
"
,
"from"
:
"vscode-emmet-helper@>=1.1.
0
<2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/vscode-emmet-helper/-/vscode-emmet-helper-1.1.
0
.tgz"
"version"
:
"1.1.
1
"
,
"from"
:
"vscode-emmet-helper@>=1.1.
1
<2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/vscode-emmet-helper/-/vscode-emmet-helper-1.1.
1
.tgz"
},
"vscode-languageserver-types"
:
{
"version"
:
"3.3.0"
,
...
...
extensions/emmet/package.json
浏览文件 @
5769bebb
...
...
@@ -259,7 +259,7 @@
"@emmetio/html-matcher"
:
"^0.3.1"
,
"@emmetio/css-parser"
:
"ramya-rao-a/css-parser#vscode"
,
"@emmetio/math-expression"
:
"^0.1.1"
,
"vscode-emmet-helper"
:
"^1.1.
0
"
,
"vscode-emmet-helper"
:
"^1.1.
1
"
,
"vscode-languageserver-types"
:
"^3.0.3"
,
"image-size"
:
"^0.5.2"
,
"vscode-nls"
:
"2.0.2"
...
...
extensions/emmet/src/abbreviationActions.ts
浏览文件 @
5769bebb
...
...
@@ -15,7 +15,7 @@ interface ExpandAbbreviationInput {
abbreviation
:
string
;
rangeToReplace
:
vscode
.
Range
;
textToWrap
?:
string
[];
filter
s
?:
string
[]
;
filter
?:
string
;
}
export
function
wrapWithAbbreviation
(
args
)
{
...
...
@@ -73,13 +73,13 @@ export function wrapIndividualLinesWithAbbreviation(args) {
return
;
}
let
{
abbreviation
,
filter
s
}
=
extractedResults
;
let
{
abbreviation
,
filter
}
=
extractedResults
;
let
input
:
ExpandAbbreviationInput
=
{
syntax
,
abbreviation
,
rangeToReplace
:
editor
.
selection
,
textToWrap
:
lines
,
filter
s
filter
};
return
expandAbbreviationInRange
(
editor
,
[
input
],
true
);
...
...
@@ -106,15 +106,15 @@ export function expandEmmetAbbreviation(args): Thenable<boolean> {
let
firstAbbreviation
:
string
;
let
allAbbreviationsSame
:
boolean
=
true
;
let
getAbbreviation
=
(
document
:
vscode
.
TextDocument
,
selection
:
vscode
.
Selection
,
position
:
vscode
.
Position
,
syntax
:
string
):
[
vscode
.
Range
,
string
,
string
[]
]
=>
{
let
getAbbreviation
=
(
document
:
vscode
.
TextDocument
,
selection
:
vscode
.
Selection
,
position
:
vscode
.
Position
,
syntax
:
string
):
[
vscode
.
Range
,
string
,
string
]
=>
{
let
rangeToReplace
:
vscode
.
Range
=
selection
;
let
abbr
=
document
.
getText
(
rangeToReplace
);
if
(
!
rangeToReplace
.
isEmpty
)
{
let
extractedResults
=
extractAbbreviationFromText
(
abbr
);
if
(
extractedResults
)
{
return
[
rangeToReplace
,
extractedResults
.
abbreviation
,
extractedResults
.
filter
s
];
return
[
rangeToReplace
,
extractedResults
.
abbreviation
,
extractedResults
.
filter
];
}
return
[
null
,
''
,
[]
];
return
[
null
,
''
,
''
];
}
const
currentLine
=
editor
.
document
.
lineAt
(
position
.
line
).
text
;
...
...
@@ -127,21 +127,21 @@ export function expandEmmetAbbreviation(args): Thenable<boolean> {
if
(
matches
)
{
abbr
=
matches
[
1
];
rangeToReplace
=
new
vscode
.
Range
(
position
.
translate
(
0
,
-
(
abbr
.
length
+
1
)),
position
);
return
[
rangeToReplace
,
abbr
,
[]
];
return
[
rangeToReplace
,
abbr
,
''
];
}
}
let
extractedResults
=
extractAbbreviation
(
editor
.
document
,
position
,
false
);
if
(
!
extractedResults
)
{
return
[
null
,
''
,
[]
];
return
[
null
,
''
,
''
];
}
let
{
abbreviationRange
,
abbreviation
,
filter
s
}
=
extractedResults
;
return
[
new
vscode
.
Range
(
abbreviationRange
.
start
.
line
,
abbreviationRange
.
start
.
character
,
abbreviationRange
.
end
.
line
,
abbreviationRange
.
end
.
character
),
abbreviation
,
filter
s
];
let
{
abbreviationRange
,
abbreviation
,
filter
}
=
extractedResults
;
return
[
new
vscode
.
Range
(
abbreviationRange
.
start
.
line
,
abbreviationRange
.
start
.
character
,
abbreviationRange
.
end
.
line
,
abbreviationRange
.
end
.
character
),
abbreviation
,
filter
];
};
editor
.
selections
.
forEach
(
selection
=>
{
let
position
=
selection
.
isReversed
?
selection
.
anchor
:
selection
.
active
;
let
[
rangeToReplace
,
abbreviation
,
filter
s
]
=
getAbbreviation
(
editor
.
document
,
selection
,
position
,
syntax
);
let
[
rangeToReplace
,
abbreviation
,
filter
]
=
getAbbreviation
(
editor
.
document
,
selection
,
position
,
syntax
);
if
(
!
rangeToReplace
)
{
return
;
}
...
...
@@ -160,7 +160,7 @@ export function expandEmmetAbbreviation(args): Thenable<boolean> {
allAbbreviationsSame
=
false
;
}
abbreviationList
.
push
({
syntax
,
abbreviation
,
rangeToReplace
,
filter
s
});
abbreviationList
.
push
({
syntax
,
abbreviation
,
rangeToReplace
,
filter
});
});
return
expandAbbreviationInRange
(
editor
,
abbreviationList
,
allAbbreviationsSame
).
then
(
success
=>
{
...
...
@@ -272,11 +272,11 @@ function expandAbbreviationInRange(editor: vscode.TextEditor, expandAbbrList: Ex
*/
function
expandAbbr
(
input
:
ExpandAbbreviationInput
):
string
{
const
emmetConfig
=
vscode
.
workspace
.
getConfiguration
(
'
emmet
'
);
const
expandOptions
=
getExpandOptions
(
input
.
syntax
,
emmetConfig
,
input
.
filter
s
);
const
expandOptions
=
getExpandOptions
(
input
.
syntax
,
emmetConfig
,
input
.
filter
);
if
(
input
.
textToWrap
)
{
if
(
input
.
filter
s
&&
input
.
filters
.
indexOf
(
'
t
'
)
>
-
1
)
{
if
(
input
.
filter
&&
input
.
filter
.
indexOf
(
'
t
'
)
>
-
1
)
{
input
.
textToWrap
=
input
.
textToWrap
.
map
(
line
=>
{
return
line
.
replace
(
trimRegex
,
''
).
trim
();
});
...
...
extensions/emmet/src/test/abbreviationAction.test.ts
浏览文件 @
5769bebb
...
...
@@ -40,12 +40,6 @@ const scssContents = `
}
`
const
bemFilterExample
=
'
ul.search-form._wide>li.-querystring+li.-btn_large|bem
'
;
const
expectedBemFilterOutput
=
`<ul class="search-form search-form_wide">
<li class="search-form__querystring"></li>
<li class="search-form__btn search-form__btn_large"></li>
</ul>`
;
const
htmlContents
=
`
<body class="header">
<ul class="nav main">
...
...
@@ -62,7 +56,7 @@ const htmlContents = `
m10
}
</style>
${
bemFilterExample
}
<span></span>
(ul>li.item$)*2
(ul>li.item$)*2+span
(div>dl>(dt+dd)*2)
...
...
@@ -188,11 +182,6 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
});
});
// TODO@Ramya test failing on our build machines on macOS
// test('Expand using bem filter', () => {
// return testHtmlExpandAbbreviation(new Selection(16, 55, 16, 55), bemFilterExample, expectedBemFilterOutput);
// });
});
suite
(
'
Tests for Expand Abbreviations (CSS)
'
,
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录