Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
dce7b0cd
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dce7b0cd
编写于
1月 04, 2021
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
simplify outline model again
上级
1e5b337c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
18 addition
and
23 deletion
+18
-23
src/vs/editor/common/services/markerDecorationsServiceImpl.ts
...vs/editor/common/services/markerDecorationsServiceImpl.ts
+4
-4
src/vs/editor/common/services/markersDecorationService.ts
src/vs/editor/common/services/markersDecorationService.ts
+3
-2
src/vs/editor/contrib/documentSymbols/outlineModel.ts
src/vs/editor/contrib/documentSymbols/outlineModel.ts
+5
-4
src/vs/editor/contrib/hover/markerHoverParticipant.ts
src/vs/editor/contrib/hover/markerHoverParticipant.ts
+1
-1
src/vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsOutline.ts
...trib/codeEditor/browser/outline/documentSymbolsOutline.ts
+4
-3
src/vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsTree.ts
...contrib/codeEditor/browser/outline/documentSymbolsTree.ts
+1
-9
未找到文件。
src/vs/editor/common/services/markerDecorationsServiceImpl.ts
浏览文件 @
dce7b0cd
...
...
@@ -87,13 +87,13 @@ export class MarkerDecorationsService extends Disposable implements IMarkerDecor
this
.
_markerDecorations
.
clear
();
}
getMarker
(
model
:
ITextModel
,
decoration
:
IModelDecoration
):
IMarker
|
null
{
const
markerDecorations
=
this
.
_markerDecorations
.
get
(
MODEL_ID
(
model
.
uri
));
getMarker
(
uri
:
URI
,
decoration
:
IModelDecoration
):
IMarker
|
null
{
const
markerDecorations
=
this
.
_markerDecorations
.
get
(
MODEL_ID
(
uri
));
return
markerDecorations
?
(
markerDecorations
.
getMarker
(
decoration
)
||
null
)
:
null
;
}
getLiveMarkers
(
model
:
ITextModel
):
[
Range
,
IMarker
][]
{
const
markerDecorations
=
this
.
_markerDecorations
.
get
(
MODEL_ID
(
model
.
uri
));
getLiveMarkers
(
uri
:
URI
):
[
Range
,
IMarker
][]
{
const
markerDecorations
=
this
.
_markerDecorations
.
get
(
MODEL_ID
(
uri
));
return
markerDecorations
?
markerDecorations
.
getMarkers
()
:
[];
}
...
...
src/vs/editor/common/services/markersDecorationService.ts
浏览文件 @
dce7b0cd
...
...
@@ -8,6 +8,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
import
{
IMarker
}
from
'
vs/platform/markers/common/markers
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
export
const
IMarkerDecorationsService
=
createDecorator
<
IMarkerDecorationsService
>
(
'
markerDecorationsService
'
);
...
...
@@ -16,7 +17,7 @@ export interface IMarkerDecorationsService {
onDidChangeMarker
:
Event
<
ITextModel
>
;
getMarker
(
model
:
ITextModel
,
decoration
:
IModelDecoration
):
IMarker
|
null
;
getMarker
(
uri
:
URI
,
decoration
:
IModelDecoration
):
IMarker
|
null
;
getLiveMarkers
(
model
:
ITextModel
):
[
Range
,
IMarker
][];
getLiveMarkers
(
uri
:
URI
):
[
Range
,
IMarker
][];
}
src/vs/editor/contrib/documentSymbols/outlineModel.ts
浏览文件 @
dce7b0cd
...
...
@@ -15,6 +15,7 @@ import { DocumentSymbol, DocumentSymbolProvider, DocumentSymbolProviderRegistry
import
{
MarkerSeverity
}
from
'
vs/platform/markers/common/markers
'
;
import
{
Iterable
}
from
'
vs/base/common/iterator
'
;
import
{
LanguageFeatureRequestDelays
}
from
'
vs/editor/common/modes/languageFeatureRegistry
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
export
abstract
class
TreeElement
{
...
...
@@ -287,7 +288,7 @@ export class OutlineModel extends TreeElement {
private
static
_create
(
textModel
:
ITextModel
,
token
:
CancellationToken
):
Promise
<
OutlineModel
>
{
const
cts
=
new
CancellationTokenSource
(
token
);
const
result
=
new
OutlineModel
(
textModel
);
const
result
=
new
OutlineModel
(
textModel
.
uri
);
const
provider
=
DocumentSymbolProviderRegistry
.
ordered
(
textModel
);
const
promises
=
provider
.
map
((
provider
,
index
)
=>
{
...
...
@@ -356,7 +357,7 @@ export class OutlineModel extends TreeElement {
protected
_groups
=
new
Map
<
string
,
OutlineGroup
>
();
children
=
new
Map
<
string
,
OutlineGroup
|
OutlineElement
>
();
protected
constructor
(
readonly
textModel
:
ITextModel
)
{
protected
constructor
(
readonly
uri
:
URI
)
{
super
();
this
.
id
=
'
root
'
;
...
...
@@ -364,7 +365,7 @@ export class OutlineModel extends TreeElement {
}
adopt
():
OutlineModel
{
let
res
=
new
OutlineModel
(
this
.
textModel
);
let
res
=
new
OutlineModel
(
this
.
uri
);
for
(
const
[
key
,
value
]
of
this
.
_groups
)
{
res
.
_groups
.
set
(
key
,
value
.
adopt
(
res
));
}
...
...
@@ -395,7 +396,7 @@ export class OutlineModel extends TreeElement {
}
merge
(
other
:
OutlineModel
):
boolean
{
if
(
this
.
textModel
.
uri
.
toString
()
!==
other
.
textModel
.
uri
.
toString
())
{
if
(
this
.
uri
.
toString
()
!==
other
.
uri
.
toString
())
{
return
false
;
}
if
(
this
.
_groups
.
size
!==
other
.
_groups
.
size
)
{
...
...
src/vs/editor/contrib/hover/markerHoverParticipant.ts
浏览文件 @
dce7b0cd
...
...
@@ -75,7 +75,7 @@ export class MarkerHoverParticipant implements IEditorHoverParticipant<MarkerHov
const
startColumn
=
(
d
.
range
.
startLineNumber
===
lineNumber
)
?
d
.
range
.
startColumn
:
1
;
const
endColumn
=
(
d
.
range
.
endLineNumber
===
lineNumber
)
?
d
.
range
.
endColumn
:
maxColumn
;
const
marker
=
this
.
_markerDecorationsService
.
getMarker
(
model
,
d
);
const
marker
=
this
.
_markerDecorationsService
.
getMarker
(
model
.
uri
,
d
);
if
(
!
marker
)
{
continue
;
}
...
...
src/vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsOutline.ts
浏览文件 @
dce7b0cd
...
...
@@ -33,6 +33,7 @@ import { localize } from 'vs/nls';
import
{
OutlineConfigKeys
}
from
'
vs/editor/contrib/documentSymbols/outline
'
;
import
{
IMarkerDecorationsService
}
from
'
vs/editor/common/services/markersDecorationService
'
;
import
{
MarkerSeverity
}
from
'
vs/platform/markers/common/markers
'
;
import
{
isEqual
}
from
'
vs/base/common/resources
'
;
type
DocumentSymbolItem
=
OutlineGroup
|
OutlineElement
;
...
...
@@ -232,7 +233,7 @@ class DocumentSymbolsOutline implements IOutline<DocumentSymbolItem> {
return
;
}
await
this
.
_codeEditorService
.
openCodeEditor
({
resource
:
model
.
textModel
.
uri
,
resource
:
model
.
uri
,
options
:
{
...
options
,
selection
:
Range
.
collapseToStart
(
entry
.
symbol
.
selectionRange
),
...
...
@@ -327,7 +328,7 @@ class DocumentSymbolsOutline implements IOutline<DocumentSymbolItem> {
// feature: show markers with outline element
this
.
_applyMarkersToOutline
(
model
);
this
.
_outlineDisposables
.
add
(
this
.
_markerDecorationsService
.
onDidChangeMarker
(
textModel
=>
{
if
(
model
?.
textModel
===
textModel
)
{
if
(
isEqual
(
model
.
uri
,
textModel
.
uri
)
)
{
this
.
_applyMarkersToOutline
(
model
);
this
.
_onDidChange
.
fire
({});
}
...
...
@@ -386,7 +387,7 @@ class DocumentSymbolsOutline implements IOutline<DocumentSymbolItem> {
return
;
}
const
markers
:
IOutlineMarker
[]
=
[];
for
(
const
[
range
,
marker
]
of
this
.
_markerDecorationsService
.
getLiveMarkers
(
model
.
textModel
))
{
for
(
const
[
range
,
marker
]
of
this
.
_markerDecorationsService
.
getLiveMarkers
(
model
.
uri
))
{
if
(
marker
.
severity
===
MarkerSeverity
.
Error
||
marker
.
severity
===
MarkerSeverity
.
Warning
)
{
markers
.
push
({
...
range
,
severity
:
marker
.
severity
});
}
...
...
src/vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsTree.ts
浏览文件 @
dce7b0cd
...
...
@@ -21,7 +21,6 @@ import { IThemeService, registerThemingParticipant, IColorTheme, ICssStyleCollec
import
{
registerColor
,
listErrorForeground
,
listWarningForeground
,
foreground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
IdleValue
}
from
'
vs/base/common/async
'
;
import
{
ITextResourceConfigurationService
}
from
'
vs/editor/common/services/textResourceConfigurationService
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IListAccessibilityProvider
}
from
'
vs/base/browser/ui/list/listWidget
'
;
import
{
Codicon
}
from
'
vs/base/common/codicons
'
;
import
{
IOutlineComparator
}
from
'
vs/workbench/services/outline/browser/outline
'
;
...
...
@@ -267,19 +266,12 @@ export class DocumentSymbolFilter implements ITreeFilter<DocumentSymbolItem> {
filter
(
element
:
DocumentSymbolItem
):
boolean
{
const
outline
=
OutlineModel
.
get
(
element
);
let
uri
:
URI
|
undefined
;
if
(
outline
)
{
uri
=
outline
.
textModel
.
uri
;
}
if
(
!
(
element
instanceof
OutlineElement
))
{
return
true
;
}
const
configName
=
DocumentSymbolFilter
.
kindToConfigName
[
element
.
symbol
.
kind
];
const
configKey
=
`
${
this
.
_prefix
}
.
${
configName
}
`
;
return
this
.
_textResourceConfigService
.
getValue
(
uri
,
configKey
);
return
this
.
_textResourceConfigService
.
getValue
(
outline
?.
uri
,
configKey
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录