Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
31bf4cca
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,发现更多精彩内容 >>
提交
31bf4cca
编写于
9月 11, 2018
作者:
R
Ramya Achutha Rao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Balance inward should go to inner contents even when no selection Fixes #58173
上级
95049810
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
4 deletion
+28
-4
extensions/emmet/src/balance.ts
extensions/emmet/src/balance.ts
+8
-4
extensions/emmet/src/test/editPointSelectItemBalance.test.ts
extensions/emmet/src/test/editPointSelectItemBalance.test.ts
+20
-0
未找到文件。
extensions/emmet/src/balance.ts
浏览文件 @
31bf4cca
...
...
@@ -87,10 +87,14 @@ function getRangeToBalanceIn(document: vscode.TextDocument, selection: vscode.Se
return
selection
;
}
if
(
selection
.
start
.
isEqual
(
nodeToBalance
.
start
)
&&
selection
.
end
.
isEqual
(
nodeToBalance
.
end
)
&&
nodeToBalance
.
close
)
{
return
new
vscode
.
Selection
(
nodeToBalance
.
open
.
end
,
nodeToBalance
.
close
.
start
);
if
(
nodeToBalance
.
close
)
{
const
entireNodeSelected
=
selection
.
start
.
isEqual
(
nodeToBalance
.
start
)
&&
selection
.
end
.
isEqual
(
nodeToBalance
.
end
);
const
startInOpenTag
=
selection
.
start
.
isAfter
(
nodeToBalance
.
open
.
start
)
&&
selection
.
start
.
isBefore
(
nodeToBalance
.
open
.
end
);
const
startInCloseTag
=
selection
.
start
.
isAfter
(
nodeToBalance
.
close
.
start
)
&&
selection
.
start
.
isBefore
(
nodeToBalance
.
close
.
end
);
if
(
entireNodeSelected
||
startInOpenTag
||
startInCloseTag
)
{
return
new
vscode
.
Selection
(
nodeToBalance
.
open
.
end
,
nodeToBalance
.
close
.
start
);
}
}
if
(
!
nodeToBalance
.
firstChild
)
{
...
...
extensions/emmet/src/test/editPointSelectItemBalance.test.ts
浏览文件 @
31bf4cca
...
...
@@ -250,6 +250,7 @@ suite('Tests for Next/Previous Select/Edit point and Balance actions', () => {
editor
.
selections
=
[
new
Selection
(
12
,
7
,
12
,
7
)];
let
expectedBalanceInRanges
:
[
number
,
number
,
number
,
number
][]
=
[
[
12
,
21
,
17
,
1
],
// inner contents of <div class="header">
[
13
,
2
,
16
,
7
],
// outer contents of <ul class="nav main">
[
13
,
23
,
16
,
2
],
// inner contents of <ul class="nav main">
[
14
,
3
,
14
,
32
],
// <li class="item1">Item 1</li>
...
...
@@ -293,6 +294,25 @@ suite('Tests for Next/Previous Select/Edit point and Balance actions', () => {
});
});
test
(
'
Emmet Balance In when selection doesnt span entire node or its inner contents
'
,
function
():
any
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
(
editor
,
doc
)
=>
{
editor
.
selection
=
new
Selection
(
13
,
7
,
13
,
10
);
// Inside the open tag of <ul class="nav main">
balanceIn
();
testSelection
(
editor
.
selection
,
23
,
13
,
2
,
16
);
// inner contents of <ul class="nav main">
editor
.
selection
=
new
Selection
(
16
,
4
,
16
,
5
);
// Inside the open close of <ul class="nav main">
balanceIn
();
testSelection
(
editor
.
selection
,
23
,
13
,
2
,
16
);
// inner contents of <ul class="nav main">
editor
.
selection
=
new
Selection
(
13
,
7
,
14
,
2
);
// Inside the open tag of <ul class="nav main"> and the next line
balanceIn
();
testSelection
(
editor
.
selection
,
23
,
13
,
2
,
16
);
// inner contents of <ul class="nav main">
return
Promise
.
resolve
();
});
});
test
(
'
Emmet Balance In/Out in html template
'
,
function
():
any
{
const
htmlTemplate
=
`
<script type="text/html">
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录