Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b8e43cc7
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,发现更多精彩内容 >>
提交
b8e43cc7
编写于
6月 13, 2019
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
上级
9bc4699d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
21 deletion
+22
-21
src/vs/editor/contrib/codelens/codelensController.ts
src/vs/editor/contrib/codelens/codelensController.ts
+22
-21
未找到文件。
src/vs/editor/contrib/codelens/codelensController.ts
浏览文件 @
b8e43cc7
...
...
@@ -9,7 +9,6 @@ import { toDisposable, DisposableStore, MutableDisposable } from 'vs/base/common
import
{
StableEditorScrollState
}
from
'
vs/editor/browser/core/editorState
'
;
import
*
as
editorBrowser
from
'
vs/editor/browser/editorBrowser
'
;
import
{
registerEditorContribution
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
IConfigurationChangedEvent
}
from
'
vs/editor/common/config/editorOptions
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
IModelDecorationsChangeAccessor
}
from
'
vs/editor/common/model
'
;
import
{
CodeLensProviderRegistry
,
CodeLens
}
from
'
vs/editor/common/modes
'
;
...
...
@@ -44,8 +43,8 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
this
.
_globalToDispose
.
add
(
this
.
_editor
.
onDidChangeModel
(()
=>
this
.
_onModelChange
()));
this
.
_globalToDispose
.
add
(
this
.
_editor
.
onDidChangeModelLanguage
(()
=>
this
.
_onModelChange
()));
this
.
_globalToDispose
.
add
(
this
.
_editor
.
onDidChangeConfiguration
((
e
:
IConfigurationChangedEvent
)
=>
{
le
t
prevIsEnabled
=
this
.
_isEnabled
;
this
.
_globalToDispose
.
add
(
this
.
_editor
.
onDidChangeConfiguration
(()
=>
{
cons
t
prevIsEnabled
=
this
.
_isEnabled
;
this
.
_isEnabled
=
this
.
_editor
.
getConfiguration
().
contribInfo
.
codeLens
;
if
(
prevIsEnabled
!==
this
.
_isEnabled
)
{
this
.
_onModelChange
();
...
...
@@ -146,9 +145,9 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
},
250
);
this
.
_localToDispose
.
add
(
scheduler
);
this
.
_localToDispose
.
add
(
this
.
_detectVisibleLenses
);
this
.
_localToDispose
.
add
(
this
.
_editor
.
onDidChangeModelContent
((
e
)
=>
{
this
.
_editor
.
changeDecorations
(
(
changeAccessor
)
=>
{
this
.
_editor
.
changeViewZones
(
(
viewAccessor
)
=>
{
this
.
_localToDispose
.
add
(
this
.
_editor
.
onDidChangeModelContent
(()
=>
{
this
.
_editor
.
changeDecorations
(
decorationsAccessor
=>
{
this
.
_editor
.
changeViewZones
(
viewZonesAccessor
=>
{
let
toDispose
:
CodeLensWidget
[]
=
[];
let
lastLensLineNumber
:
number
=
-
1
;
...
...
@@ -159,17 +158,17 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
toDispose
.
push
(
lens
);
}
else
{
lens
.
update
(
viewAccessor
);
lens
.
update
(
view
Zones
Accessor
);
lastLensLineNumber
=
lens
.
getLineNumber
();
}
});
let
helper
=
new
CodeLensHelper
();
toDispose
.
forEach
((
l
)
=>
{
l
.
dispose
(
helper
,
viewAccessor
);
l
.
dispose
(
helper
,
view
Zones
Accessor
);
this
.
_lenses
.
splice
(
this
.
_lenses
.
indexOf
(
l
),
1
);
});
helper
.
commit
(
change
Accessor
);
helper
.
commit
(
decorations
Accessor
);
});
});
...
...
@@ -183,15 +182,15 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
this
.
_detectVisibleLenses
.
schedule
();
}
}));
this
.
_localToDispose
.
add
(
this
.
_editor
.
onDidLayoutChange
(
e
=>
{
this
.
_localToDispose
.
add
(
this
.
_editor
.
onDidLayoutChange
(
()
=>
{
this
.
_detectVisibleLenses
.
schedule
();
}));
this
.
_localToDispose
.
add
(
toDisposable
(()
=>
{
if
(
this
.
_editor
.
getModel
())
{
const
scrollState
=
StableEditorScrollState
.
capture
(
this
.
_editor
);
this
.
_editor
.
changeDecorations
(
(
changeAccessor
)
=>
{
this
.
_editor
.
changeViewZones
(
(
accessor
)
=>
{
this
.
_disposeAllLenses
(
changeAccessor
,
a
ccessor
);
this
.
_editor
.
changeDecorations
(
decorationsAccessor
=>
{
this
.
_editor
.
changeViewZones
(
viewZonesAccessor
=>
{
this
.
_disposeAllLenses
(
decorationsAccessor
,
viewZonesA
ccessor
);
});
});
scrollState
.
restore
(
this
.
_editor
);
...
...
@@ -256,10 +255,12 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
const
scrollState
=
StableEditorScrollState
.
capture
(
this
.
_editor
);
this
.
_editor
.
changeDecorations
(
(
changeAccessor
)
=>
{
this
.
_editor
.
changeViewZones
(
(
accessor
)
=>
{
this
.
_editor
.
changeDecorations
(
decorationsAccessor
=>
{
this
.
_editor
.
changeViewZones
(
viewZoneAccessor
=>
{
let
codeLensIndex
=
0
,
groupsIndex
=
0
,
helper
=
new
CodeLensHelper
();
const
helper
=
new
CodeLensHelper
();
let
codeLensIndex
=
0
;
let
groupsIndex
=
0
;
while
(
groupsIndex
<
groups
.
length
&&
codeLensIndex
<
this
.
_lenses
.
length
)
{
...
...
@@ -267,14 +268,14 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
let
codeLensLineNumber
=
this
.
_lenses
[
codeLensIndex
].
getLineNumber
();
if
(
codeLensLineNumber
<
symbolsLineNumber
)
{
this
.
_lenses
[
codeLensIndex
].
dispose
(
helper
,
a
ccessor
);
this
.
_lenses
[
codeLensIndex
].
dispose
(
helper
,
viewZoneA
ccessor
);
this
.
_lenses
.
splice
(
codeLensIndex
,
1
);
}
else
if
(
codeLensLineNumber
===
symbolsLineNumber
)
{
this
.
_lenses
[
codeLensIndex
].
updateCodeLensSymbols
(
groups
[
groupsIndex
],
helper
);
groupsIndex
++
;
codeLensIndex
++
;
}
else
{
this
.
_lenses
.
splice
(
codeLensIndex
,
0
,
new
CodeLensWidget
(
groups
[
groupsIndex
],
this
.
_editor
,
helper
,
a
ccessor
,
()
=>
this
.
_detectVisibleLenses
.
schedule
()));
this
.
_lenses
.
splice
(
codeLensIndex
,
0
,
new
CodeLensWidget
(
groups
[
groupsIndex
],
this
.
_editor
,
helper
,
viewZoneA
ccessor
,
()
=>
this
.
_detectVisibleLenses
.
schedule
()));
codeLensIndex
++
;
groupsIndex
++
;
}
...
...
@@ -282,17 +283,17 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
// Delete extra code lenses
while
(
codeLensIndex
<
this
.
_lenses
.
length
)
{
this
.
_lenses
[
codeLensIndex
].
dispose
(
helper
,
a
ccessor
);
this
.
_lenses
[
codeLensIndex
].
dispose
(
helper
,
viewZoneA
ccessor
);
this
.
_lenses
.
splice
(
codeLensIndex
,
1
);
}
// Create extra symbols
while
(
groupsIndex
<
groups
.
length
)
{
this
.
_lenses
.
push
(
new
CodeLensWidget
(
groups
[
groupsIndex
],
this
.
_editor
,
helper
,
a
ccessor
,
()
=>
this
.
_detectVisibleLenses
.
schedule
()));
this
.
_lenses
.
push
(
new
CodeLensWidget
(
groups
[
groupsIndex
],
this
.
_editor
,
helper
,
viewZoneA
ccessor
,
()
=>
this
.
_detectVisibleLenses
.
schedule
()));
groupsIndex
++
;
}
helper
.
commit
(
change
Accessor
);
helper
.
commit
(
decorations
Accessor
);
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录