Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
2b472d1e
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,发现更多精彩内容 >>
提交
2b472d1e
编写于
5月 11, 2020
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
register a marker list provider for notebooks, #96708
上级
337c788e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
72 addition
and
11 deletion
+72
-11
src/vs/editor/contrib/gotoError/markerNavigationService.ts
src/vs/editor/contrib/gotoError/markerNavigationService.ts
+24
-11
src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.ts
...contrib/notebook/browser/contrib/marker/markerProvider.ts
+47
-0
src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts
...rkbench/contrib/notebook/browser/notebook.contribution.ts
+1
-0
未找到文件。
src/vs/editor/contrib/gotoError/markerNavigationService.ts
浏览文件 @
2b472d1e
...
...
@@ -29,22 +29,38 @@ export class MarkerList {
private
readonly
_onDidChange
=
new
Emitter
<
void
>
();
readonly
onDidChange
:
Event
<
void
>
=
this
.
_onDidChange
.
event
;
private
readonly
_resourceFilter
?:
(
uri
:
URI
)
=>
boolean
;
private
readonly
_dispoables
=
new
DisposableStore
();
private
_markers
:
IMarker
[]
=
[];
private
_nextIdx
:
number
=
-
1
;
constructor
(
private
readonly
_scope
:
URI
|
undefined
,
resourceFilter
:
URI
|
((
uri
:
URI
)
=>
boolean
)
|
undefined
,
@
IMarkerService
private
readonly
_markerService
:
IMarkerService
,
)
{
if
(
URI
.
isUri
(
resourceFilter
))
{
this
.
_resourceFilter
=
uri
=>
uri
.
toString
()
===
resourceFilter
.
toString
();
}
else
if
(
resourceFilter
)
{
this
.
_resourceFilter
=
resourceFilter
;
}
const
updateMarker
=
()
=>
{
this
.
_markers
=
this
.
_markerService
.
read
({
resource
:
URI
.
isUri
(
resourceFilter
)
?
resourceFilter
:
undefined
,
severities
:
MarkerSeverity
.
Error
|
MarkerSeverity
.
Warning
|
MarkerSeverity
.
Info
});
if
(
typeof
resourceFilter
===
'
function
'
)
{
this
.
_markers
=
this
.
_markers
.
filter
(
m
=>
this
.
_resourceFilter
!
(
m
.
resource
));
}
this
.
_markers
.
sort
(
MarkerList
.
_compareMarker
);
};
const
filter
=
{
resource
:
this
.
_scope
,
severities
:
MarkerSeverity
.
Error
|
MarkerSeverity
.
Warning
|
MarkerSeverity
.
Info
};
this
.
_markers
=
this
.
_markerService
.
read
(
filter
).
sort
(
MarkerList
.
_compareMarker
);
updateMarker
();
this
.
_dispoables
.
add
(
_markerService
.
onMarkerChanged
(
e
=>
{
if
(
!
this
.
_
scope
||
e
.
some
(
e
=>
e
.
toString
()
===
_scope
?.
toString
(
)))
{
this
.
_markers
=
this
.
_markerService
.
read
(
filter
).
sort
(
MarkerList
.
_compareMarker
);
this
.
_dispoables
.
add
(
_markerService
.
onMarkerChanged
(
uris
=>
{
if
(
!
this
.
_
resourceFilter
||
uris
.
some
(
uri
=>
this
.
_resourceFilter
!
(
uri
)))
{
updateMarker
(
);
this
.
_nextIdx
=
-
1
;
this
.
_onDidChange
.
fire
();
}
...
...
@@ -57,13 +73,10 @@ export class MarkerList {
}
matches
(
uri
:
URI
|
undefined
)
{
if
(
this
.
_scope
===
uri
)
{
if
(
!
this
.
_resourceFilter
)
{
return
true
;
}
if
(
this
.
_scope
&&
uri
&&
this
.
_scope
.
toString
()
===
uri
.
toString
())
{
return
true
;
}
return
false
;
return
uri
&&
this
.
_resourceFilter
(
uri
);
}
get
selected
():
MarkerCoordinate
|
undefined
{
...
...
src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.ts
0 → 100644
浏览文件 @
2b472d1e
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Extensions
as
WorkbenchExtensions
,
IWorkbenchContributionsRegistry
}
from
'
vs/workbench/common/contributions
'
;
import
{
IMarkerListProvider
,
MarkerList
,
IMarkerNavigationService
}
from
'
vs/editor/contrib/gotoError/markerNavigationService
'
;
import
{
CellUri
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
class
MarkerListProvider
implements
IMarkerListProvider
{
private
readonly
_dispoables
:
IDisposable
;
constructor
(
@
IMarkerService
private
readonly
_markerService
:
IMarkerService
,
@
IMarkerNavigationService
markerNavigation
:
IMarkerNavigationService
,
)
{
this
.
_dispoables
=
markerNavigation
.
registerProvider
(
this
);
}
dispose
()
{
this
.
_dispoables
.
dispose
();
}
getMarkerList
(
resource
:
URI
|
undefined
):
MarkerList
|
undefined
{
if
(
!
resource
)
{
return
undefined
;
}
const
data
=
CellUri
.
parse
(
resource
);
if
(
!
data
)
{
return
undefined
;
}
return
new
MarkerList
(
uri
=>
{
const
otherData
=
CellUri
.
parse
(
uri
);
return
otherData
?.
notebook
.
toString
()
===
data
.
notebook
.
toString
();
},
this
.
_markerService
);
}
}
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
)
.
registerWorkbenchContribution
(
MarkerListProvider
,
LifecyclePhase
.
Ready
);
src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts
浏览文件 @
2b472d1e
...
...
@@ -44,6 +44,7 @@ import 'vs/workbench/contrib/notebook/browser/contrib/find/findController';
import
'
vs/workbench/contrib/notebook/browser/contrib/fold/folding
'
;
import
'
vs/workbench/contrib/notebook/browser/contrib/format/formatting
'
;
import
'
vs/workbench/contrib/notebook/browser/contrib/toc/tocProvider
'
;
import
'
vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider
'
;
// Output renderers registration
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录