Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
68da4f16
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 搜索 >>
提交
68da4f16
编写于
12月 21, 2020
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove onDidChangeActive-event
上级
358f3909
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
32 deletion
+25
-32
src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts
src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts
+0
-1
src/vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsOutline.ts
...trib/codeEditor/browser/outline/documentSymbolsOutline.ts
+0
-3
src/vs/workbench/contrib/notebook/browser/contrib/outline/notebooksOutline.ts
...trib/notebook/browser/contrib/outline/notebooksOutline.ts
+25
-27
src/vs/workbench/services/outline/browser/outline.ts
src/vs/workbench/services/outline/browser/outline.ts
+0
-1
未找到文件。
src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts
浏览文件 @
68da4f16
...
...
@@ -165,7 +165,6 @@ export class BreadcrumbsModel {
if
(
outline
)
{
this
.
_outlineDisposables
.
add
(
outline
);
this
.
_outlineDisposables
.
add
(
outline
.
onDidChange
(()
=>
this
.
_onDidUpdate
.
fire
(
this
)));
this
.
_outlineDisposables
.
add
(
outline
.
onDidChangeActiveEntry
(()
=>
this
.
_onDidUpdate
.
fire
(
this
)));
}
}).
catch
(
err
=>
{
...
...
src/vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsOutline.ts
浏览文件 @
68da4f16
...
...
@@ -38,9 +38,6 @@ class DocumentSymbolsOutline implements IOutline<DocumentSymbolItem> {
private
readonly
_onDidChange
=
new
Emitter
<
this
>
();
readonly
onDidChange
:
Event
<
this
>
=
this
.
_onDidChange
.
event
;
private
readonly
_onDidChangeActiveEntry
=
new
Emitter
<
this
>
();
readonly
onDidChangeActiveEntry
:
Event
<
this
>
=
this
.
_onDidChangeActiveEntry
.
event
;
private
_outlineModel
?:
OutlineModel
;
private
_outlineElementChain
:
Array
<
OutlineModel
|
OutlineGroup
|
OutlineElement
>
=
[];
private
_outlineDisposables
=
new
DisposableStore
();
...
...
src/vs/workbench/contrib/notebook/browser/contrib/outline/notebooksOutline.ts
浏览文件 @
68da4f16
...
...
@@ -99,11 +99,8 @@ class NotebookCellOutline implements IOutline<OutlineEntry> {
private
readonly
_onDidChange
=
new
Emitter
<
this
>
();
readonly
onDidChange
:
Event
<
this
>
=
this
.
_onDidChange
.
event
;
private
readonly
_onDidChangeActiveEntry
=
new
Emitter
<
this
>
();
readonly
onDidChangeActiveEntry
:
Event
<
this
>
=
this
.
_onDidChangeActiveEntry
.
event
;
private
_activeEntry
?:
OutlineEntry
;
private
_entries
:
OutlineEntry
[]
=
[];
private
_activeEntry
:
number
=
-
1
;
private
readonly
_entriesDisposables
=
new
DisposableStore
();
readonly
config
:
OutlineTreeConfiguration
<
OutlineEntry
>
;
...
...
@@ -119,26 +116,23 @@ class NotebookCellOutline implements IOutline<OutlineEntry> {
selectionListener
.
clear
();
}
else
{
selectionListener
.
value
=
combinedDisposable
(
_editor
.
viewModel
.
onDidChangeSelection
(()
=>
this
.
_computeActive
()),
_editor
.
viewModel
.
onDidChangeSelection
(()
=>
this
.
_
re
computeActive
()),
_editor
.
viewModel
.
onDidChangeViewCells
(()
=>
{
this
.
_computeEntries
();
this
.
_computeActive
();
this
.
_recomputeState
();
}));
}
};
this
.
_dispoables
.
add
(
_editor
.
onDidChangeModel
(()
=>
{
this
.
_computeEntries
();
this
.
_computeActive
();
this
.
_recomputeState
();
installSelectionListener
();
}));
this
.
_computeEntries
();
this
.
_computeActive
();
this
.
_recomputeState
();
installSelectionListener
();
this
.
config
=
new
OutlineTreeConfiguration
<
OutlineEntry
>
(
{
getBreadcrumbElements
:
()
=>
this
.
_activeEntry
?
Iterable
.
single
(
this
.
_activeEntry
)
:
Iterable
.
empty
()
},
{
getBreadcrumbElements
:
()
=>
this
.
_activeEntry
>=
0
?
Iterable
.
single
(
this
.
_entries
[
this
.
_activeEntry
]
)
:
Iterable
.
empty
()
},
{
getQuickPickElements
:
()
=>
this
.
_entries
.
map
(
entry
=>
({
element
:
entry
,
label
:
`$(
${
entry
.
icon
.
id
}
)
${
entry
.
label
}
`
,
ariaLabel
:
entry
.
label
}))
},
{
getChildren
:
parent
=>
parent
===
this
?
this
.
_entries
:
[]
},
new
NotebookOutlineVirtualDelegate
(),
...
...
@@ -158,15 +152,18 @@ class NotebookCellOutline implements IOutline<OutlineEntry> {
this
.
_dispoables
.
dispose
();
}
// TODO@jrieken recompute entries on demand, not eagerly
private
_computeEntries
():
void
{
private
_recomputeState
():
void
{
this
.
_entriesDisposables
.
clear
();
this
.
_activeEntry
=
-
1
;
this
.
_entries
.
length
=
0
;
const
{
viewModel
}
=
this
.
_editor
;
if
(
!
viewModel
)
{
return
;
}
const
[
selected
]
=
viewModel
.
selectionHandles
;
for
(
const
cell
of
viewModel
.
viewCells
)
{
const
content
=
cell
.
getText
();
const
regexp
=
cell
.
cellKind
===
CellKind
.
Markdown
...
...
@@ -176,35 +173,36 @@ class NotebookCellOutline implements IOutline<OutlineEntry> {
const
matches
=
content
.
match
(
regexp
);
if
(
matches
&&
matches
.
length
)
{
for
(
let
j
=
0
;
j
<
matches
.
length
;
j
++
)
{
this
.
_entries
.
push
(
new
OutlineEntry
(
const
newLen
=
this
.
_entries
.
push
(
new
OutlineEntry
(
cell
,
matches
[
j
].
replace
(
/^
[
\t]
*
(\#
+
)
/
,
''
).
trim
(),
cell
.
cellKind
===
CellKind
.
Markdown
?
Codicon
.
markdown
:
Codicon
.
code
));
if
(
cell
.
handle
===
selected
)
{
this
.
_activeEntry
=
newLen
-
1
;
}
}
}
// send an event whenever any of the cells change
this
.
_entriesDisposables
.
add
(
cell
.
model
.
onDidChangeContent
(()
=>
{
this
.
_computeEntries
();
this
.
_computeActive
();
this
.
_recomputeState
();
this
.
_onDidChange
.
fire
(
this
);
}));
}
this
.
_onDidChange
.
fire
(
this
);
}
private
_computeActive
():
void
{
let
newActive
:
OutlineEntry
|
undefined
;
if
(
this
.
_editor
.
viewModel
)
{
const
[
first
]
=
this
.
_editor
.
viewModel
.
selectionHandles
;
newActive
=
typeof
first
===
'
number
'
?
this
.
_entries
.
find
(
candidate
=>
candidate
.
cell
.
handle
===
first
)
:
undefined
;
private
_recomputeActive
():
void
{
let
newIdx
=
-
1
;
const
{
viewModel
}
=
this
.
_editor
;
if
(
viewModel
)
{
const
[
selected
]
=
viewModel
.
selectionHandles
;
newIdx
=
this
.
_entries
.
findIndex
(
entry
=>
entry
.
cell
.
handle
===
selected
);
}
if
(
this
.
_activeEntry
!==
newActive
)
{
this
.
_activeEntry
=
new
Active
;
this
.
_onDidChange
ActiveEntry
.
fire
(
this
);
if
(
newIdx
!==
this
.
_activeEntry
)
{
this
.
_activeEntry
=
new
Idx
;
this
.
_onDidChange
.
fire
(
this
);
}
}
...
...
src/vs/workbench/services/outline/browser/outline.ts
浏览文件 @
68da4f16
...
...
@@ -62,7 +62,6 @@ export interface IOutline<E> {
readonly
config
:
OutlineTreeConfiguration
<
E
>
readonly
onDidChange
:
Event
<
this
>
;
readonly
onDidChangeActiveEntry
:
Event
<
this
>
readonly
isEmpty
:
boolean
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录