Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
eeb3ae98
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,发现更多精彩内容 >>
提交
eeb3ae98
编写于
2月 11, 2016
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[folding] clicking on folding ellipses
上级
d90d8b4a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
41 addition
and
18 deletion
+41
-18
src/vs/editor/contrib/folding/browser/folding.css
src/vs/editor/contrib/folding/browser/folding.css
+1
-1
src/vs/editor/contrib/folding/browser/folding.ts
src/vs/editor/contrib/folding/browser/folding.ts
+40
-17
未找到文件。
src/vs/editor/contrib/folding/browser/folding.css
浏览文件 @
eeb3ae98
...
...
@@ -29,7 +29,7 @@
color
:
grey
;
margin
:
0.1em
0.2em
0
0.2em
;
content
:
"⋯"
;
display
:
inline
-block
;
display
:
inline
;
line-height
:
1em
;
}
src/vs/editor/contrib/folding/browser/folding.ts
浏览文件 @
eeb3ae98
...
...
@@ -39,10 +39,6 @@ class CollapsableRegion {
return
this
.
_isCollapsed
;
}
public
get
lastRange
()
:
IFoldingRange
{
return
this
.
_lastRange
;
}
public
setCollapsed
(
isCollaped
:
boolean
,
changeAccessor
:
EditorCommon
.
IModelDecorationsChangeAccessor
)
:
void
{
this
.
_isCollapsed
=
isCollaped
;
if
(
this
.
decorationIds
.
length
>
0
)
{
...
...
@@ -108,6 +104,17 @@ class CollapsableRegion {
this
.
_lastRange
=
null
;
this
.
decorationIds
=
changeAccessor
.
deltaDecorations
(
this
.
decorationIds
,
[]);
}
public
toString
():
string
{
var
str
=
this
.
isCollapsed
?
'
collapsed
'
:
'
expanded
'
;
if
(
this
.
_lastRange
)
{
str
+=
(
this
.
_lastRange
.
startLineNumber
+
'
/
'
+
this
.
_lastRange
.
endLineNumber
);
}
else
{
str
+=
'
no range
'
;
}
return
str
;
}
}
export
class
Folding
implements
EditorCommon
.
IEditorContribution
{
...
...
@@ -178,7 +185,7 @@ export class Folding implements EditorCommon.IEditorContribution {
let
dec
=
this
.
decorations
[
i
];
var
decRange
=
dec
.
getDecorationRange
(
model
);
if
(
!
decRange
)
{
log
(
'
range no longer valid, was
'
+
rangeToString
(
dec
.
lastRange
));
log
(
'
range no longer valid, was
'
+
dec
.
toString
(
));
dec
.
dispose
(
changeAccessor
);
i
++
;
}
else
{
...
...
@@ -190,7 +197,7 @@ export class Folding implements EditorCommon.IEditorContribution {
if
(
k
<
regions
.
length
)
{
let
currRange
=
regions
[
k
];
if
(
decRange
.
startLineNumber
<
currRange
.
startLineNumber
)
{
log
(
'
range no longer valid, was
'
+
rangeToString
(
dec
.
lastRange
));
log
(
'
range no longer valid, was
'
+
dec
.
toString
(
));
dec
.
dispose
(
changeAccessor
);
i
++
;
}
else
if
(
decRange
.
startLineNumber
===
currRange
.
startLineNumber
)
{
...
...
@@ -203,7 +210,7 @@ export class Folding implements EditorCommon.IEditorContribution {
}
}
while
(
i
<
this
.
decorations
.
length
)
{
log
(
'
range no longer valid, was
'
+
rangeToString
(
this
.
decorations
[
i
].
lastRange
));
log
(
'
range no longer valid, was
'
+
this
.
decorations
[
i
].
toString
(
));
this
.
decorations
[
i
].
dispose
(
changeAccessor
);
i
++
;
}
...
...
@@ -223,8 +230,8 @@ export class Folding implements EditorCommon.IEditorContribution {
this
.
localToDispose
.
push
(
this
.
editor
.
addListener2
(
'
change
'
,
()
=>
this
.
updateScheduler
.
schedule
()));
this
.
localToDispose
.
push
({
dispose
:
()
=>
{
++
this
.
computeToken
;
this
.
editor
.
changeDecorations
(
(
changeAccessor
:
EditorCommon
.
IModelDecorationsChangeAccessor
)
=>
{
this
.
decorations
.
forEach
(
(
dec
)
=>
dec
.
dispose
(
changeAccessor
));
this
.
editor
.
changeDecorations
(
changeAccessor
=>
{
this
.
decorations
.
forEach
(
dec
=>
dec
.
dispose
(
changeAccessor
));
});
}});
this
.
localToDispose
.
push
(
this
.
editor
.
addListener2
(
EditorCommon
.
EventType
.
MouseDown
,
(
e
)
=>
this
.
_onEditorMouseDown
(
e
)));
...
...
@@ -244,29 +251,45 @@ export class Folding implements EditorCommon.IEditorContribution {
return
TPromise
.
as
(
ranges
);
}
private
_onEditorMouseDown
(
e
:
IMouseEvent
):
void
{
if
(
e
.
target
.
type
!==
EditorCommon
.
MouseTargetType
.
GUTTER_LINE_DECORATIONS
)
{
private
_onEditorMouseDown
(
e
:
IMouseEvent
):
void
{
if
(
this
.
decorations
.
length
===
0
)
{
return
;
}
if
(
this
.
decorations
.
length
===
0
)
{
var
range
=
e
.
target
.
range
;
if
(
!
range
||
!
range
.
isEmpty
)
{
return
;
}
var
position
=
e
.
target
.
position
;
if
(
!
position
)
{
if
(
!
e
.
event
.
leftButton
)
{
return
;
}
var
model
=
this
.
editor
.
getModel
();
var
toggleClicked
=
false
;
switch
(
e
.
target
.
type
)
{
case
EditorCommon
.
MouseTargetType
.
GUTTER_LINE_DECORATIONS
:
toggleClicked
=
true
;
break
;
case
EditorCommon
.
MouseTargetType
.
CONTENT_TEXT
:
if
(
range
.
isEmpty
&&
range
.
startColumn
===
model
.
getLineMaxColumn
(
range
.
startLineNumber
))
{
break
;
}
return
;
default
:
return
;
}
var
hasChanges
=
false
;
this
.
editor
.
changeDecorations
(
changeAccessor
=>
{
for
(
var
i
=
0
;
i
<
this
.
decorations
.
length
;
i
++
)
{
var
dec
=
this
.
decorations
[
i
];
var
decRange
=
dec
.
getDecorationRange
(
model
);
if
(
decRange
.
startLineNumber
===
position
.
lineNumber
)
{
dec
.
setCollapsed
(
!
dec
.
isCollapsed
,
changeAccessor
);
hasChanges
=
true
;
if
(
decRange
.
startLineNumber
===
range
.
startLineNumber
)
{
if
(
toggleClicked
||
dec
.
isCollapsed
)
{
dec
.
setCollapsed
(
!
dec
.
isCollapsed
,
changeAccessor
);
hasChanges
=
true
;
}
break
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录