Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
32ff9427
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,发现更多精彩内容 >>
提交
32ff9427
编写于
1月 26, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #41969
上级
b7f5db99
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
98 addition
and
49 deletion
+98
-49
src/vs/workbench/parts/markers/browser/markersPanel.ts
src/vs/workbench/parts/markers/browser/markersPanel.ts
+23
-45
src/vs/workbench/parts/markers/browser/markersPanelActions.ts
...vs/workbench/parts/markers/browser/markersPanelActions.ts
+6
-4
src/vs/workbench/parts/markers/browser/markersWorkbenchContributions.ts
...ch/parts/markers/browser/markersWorkbenchContributions.ts
+4
-0
src/vs/workbench/parts/markers/common/markers.ts
src/vs/workbench/parts/markers/common/markers.ts
+65
-0
未找到文件。
src/vs/workbench/parts/markers/browser/markersPanel.ts
浏览文件 @
32ff9427
...
...
@@ -13,13 +13,12 @@ import dom = require('vs/base/browser/dom');
import
builder
=
require
(
'
vs/base/browser/builder
'
);
import
{
IAction
,
Action
}
from
'
vs/base/common/actions
'
;
import
{
IActionItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
Panel
}
from
'
vs/workbench/browser/panel
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
Constants
from
'
vs/workbench/parts/markers/common/constants
'
;
import
{
Marker
sModel
,
Marker
,
Resource
,
FilterOptions
}
from
'
vs/workbench/parts/markers/common/markersModel
'
;
import
{
Marker
,
Resource
}
from
'
vs/workbench/parts/markers/common/markersModel
'
;
import
{
Controller
}
from
'
vs/workbench/parts/markers/browser/markersTreeController
'
;
import
*
as
Viewer
from
'
vs/workbench/parts/markers/browser/markersTreeViewer
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -33,13 +32,10 @@ import { debounceEvent } from 'vs/base/common/event';
import
{
SimpleFileResourceDragAndDrop
}
from
'
vs/base/parts/tree/browser/treeDnd
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
WorkbenchTree
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IActivityService
,
NumberBadge
}
from
'
vs/workbench/services/activity/common/activity
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
IMarkersWorkbenchService
}
from
'
vs/workbench/parts/markers/common/markers
'
;
export
class
MarkersPanel
extends
Panel
{
public
markersModel
:
MarkersModel
;
private
delayedRefresh
:
Delayer
<
void
>
;
private
lastSelectedRelativeTop
:
number
=
0
;
...
...
@@ -61,13 +57,12 @@ export class MarkersPanel extends Panel {
constructor
(
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IMarkerService
private
markerService
:
IMarkerService
,
@
IEditorGroupService
private
editorGroupService
:
IEditorGroupService
,
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IThemeService
themeService
:
IThemeService
,
@
I
ActivityService
private
activityService
:
IActivity
Service
@
I
MarkersWorkbenchService
private
markersWorkbenchService
:
IMarkersWorkbench
Service
)
{
super
(
Constants
.
MARKERS_PANEL_ID
,
telemetryService
,
themeService
);
this
.
delayedRefresh
=
new
Delayer
<
void
>
(
500
);
...
...
@@ -76,7 +71,6 @@ export class MarkersPanel extends Panel {
public
create
(
parent
:
builder
.
Builder
):
TPromise
<
void
>
{
super
.
create
(
parent
);
this
.
markersModel
=
new
MarkersModel
();
this
.
rangeHighlightDecorations
=
this
.
instantiationService
.
createInstance
(
RangeHighlightDecorations
);
this
.
toUnbind
.
push
(
this
.
rangeHighlightDecorations
);
...
...
@@ -91,9 +85,7 @@ export class MarkersPanel extends Panel {
this
.
createActions
();
this
.
createListeners
();
this
.
render
();
return
TPromise
.
as
(
null
);
return
this
.
render
();
}
public
getTitle
():
string
{
...
...
@@ -109,7 +101,7 @@ export class MarkersPanel extends Panel {
return
;
}
if
(
this
.
markersModel
.
hasFilteredResources
())
{
if
(
this
.
markers
WorkbenchService
.
markers
Model
.
hasFilteredResources
())
{
this
.
tree
.
DOMFocus
();
if
(
this
.
tree
.
getSelection
().
length
===
0
)
{
this
.
tree
.
focusFirst
();
...
...
@@ -136,7 +128,7 @@ export class MarkersPanel extends Panel {
}
public
getActions
():
IAction
[]
{
this
.
collapseAllAction
.
enabled
=
this
.
markersModel
.
hasFilteredResources
();
this
.
collapseAllAction
.
enabled
=
this
.
markers
WorkbenchService
.
markers
Model
.
hasFilteredResources
();
return
this
.
actions
;
}
...
...
@@ -172,12 +164,11 @@ export class MarkersPanel extends Panel {
}
private
refreshPanel
():
TPromise
<
any
>
{
this
.
refreshBadge
();
if
(
this
.
isVisible
())
{
this
.
collapseAllAction
.
enabled
=
this
.
markersModel
.
hasFilteredResources
();
dom
.
toggleClass
(
this
.
treeContainer
,
'
hidden
'
,
!
this
.
markersModel
.
hasFilteredResources
());
this
.
collapseAllAction
.
enabled
=
this
.
markers
WorkbenchService
.
markers
Model
.
hasFilteredResources
();
dom
.
toggleClass
(
this
.
treeContainer
,
'
hidden
'
,
!
this
.
markers
WorkbenchService
.
markers
Model
.
hasFilteredResources
());
this
.
renderMessage
();
if
(
this
.
markersModel
.
hasFilteredResources
())
{
if
(
this
.
markers
WorkbenchService
.
markers
Model
.
hasFilteredResources
())
{
return
this
.
tree
.
refresh
().
then
(()
=>
{
this
.
autoExpand
();
});
...
...
@@ -187,19 +178,12 @@ export class MarkersPanel extends Panel {
}
public
updateFilter
(
filter
:
string
)
{
this
.
markers
Model
.
update
(
new
FilterOptions
(
filter
)
);
this
.
markers
WorkbenchService
.
filter
(
filter
);
this
.
autoExpanded
=
new
Set
<
string
>
();
this
.
refreshPanel
();
this
.
autoReveal
();
}
private
refreshBadge
():
void
{
const
total
=
this
.
markersModel
.
total
();
const
count
=
this
.
markersModel
.
count
();
const
message
=
total
===
count
?
localize
(
'
totalProblems
'
,
'
Total {0} Problems
'
,
total
)
:
localize
(
'
filteredProblems
'
,
'
Showing {0} of {1} Problems
'
,
count
,
total
);
this
.
activityService
.
showActivity
(
this
.
getId
(),
new
NumberBadge
(
count
,
()
=>
message
));
}
private
createMessageBox
(
parent
:
HTMLElement
):
void
{
this
.
messageBoxContainer
=
dom
.
append
(
parent
,
dom
.
$
(
'
.message-box-container
'
));
this
.
messageBox
=
dom
.
append
(
this
.
messageBoxContainer
,
dom
.
$
(
'
span
'
));
...
...
@@ -247,7 +231,7 @@ export class MarkersPanel extends Panel {
}
private
createListeners
():
void
{
this
.
toUnbind
.
push
(
this
.
marker
Service
.
onMarkerChanged
(
this
.
onMarkerChanged
,
this
));
this
.
toUnbind
.
push
(
this
.
marker
sWorkbenchService
.
onDidChangeMarkersForResources
(
this
.
onMarkerChanged
,
this
));
this
.
toUnbind
.
push
(
this
.
editorGroupService
.
onEditorsChanged
(
this
.
onEditorsChanged
,
this
));
this
.
toUnbind
.
push
(
this
.
tree
.
onDidChangeSelection
(()
=>
this
.
onSelected
()));
}
...
...
@@ -290,34 +274,29 @@ export class MarkersPanel extends Panel {
}
private
updateResources
(
resources
:
URI
[])
{
const
bulkUpdater
=
this
.
markersModel
.
getBulkUpdater
();
for
(
const
resource
of
resources
)
{
bulkUpdater
.
add
(
resource
,
this
.
markerService
.
read
({
resource
}));
}
bulkUpdater
.
done
();
for
(
const
resource
of
resources
)
{
if
(
!
this
.
markersModel
.
hasResource
(
resource
))
{
if
(
!
this
.
markersWorkbenchService
.
markersModel
.
hasResource
(
resource
))
{
this
.
autoExpanded
.
delete
(
resource
.
toString
());
}
}
}
private
render
():
void
{
let
allMarkers
=
this
.
markerService
.
read
();
this
.
markersModel
.
update
(
allMarkers
);
this
.
tree
.
setInput
(
this
.
markersModel
).
then
(
this
.
autoExpand
.
bind
(
this
));
dom
.
toggleClass
(
this
.
treeContainer
,
'
hidden
'
,
!
this
.
markersModel
.
hasFilteredResources
());
this
.
renderMessage
();
private
render
():
TPromise
<
void
>
{
dom
.
toggleClass
(
this
.
treeContainer
,
'
hidden
'
,
!
this
.
markersWorkbenchService
.
markersModel
.
hasFilteredResources
());
return
this
.
tree
.
setInput
(
this
.
markersWorkbenchService
.
markersModel
)
.
then
(()
=>
{
this
.
renderMessage
();
this
.
autoExpand
();
});
}
private
renderMessage
():
void
{
let
message
=
this
.
markersModel
.
getMessage
();
this
.
messageBox
.
textContent
=
message
;
dom
.
toggleClass
(
this
.
messageBoxContainer
,
'
hidden
'
,
this
.
markersModel
.
hasFilteredResources
());
this
.
messageBox
.
textContent
=
this
.
markersWorkbenchService
.
markersModel
.
getMessage
();
dom
.
toggleClass
(
this
.
messageBoxContainer
,
'
hidden
'
,
this
.
markersWorkbenchService
.
markersModel
.
hasFilteredResources
());
}
private
autoExpand
():
void
{
for
(
const
resource
of
this
.
markersModel
.
filteredResources
)
{
for
(
const
resource
of
this
.
markers
WorkbenchService
.
markers
Model
.
filteredResources
)
{
const
resourceUri
=
resource
.
uri
.
toString
();
if
(
!
this
.
autoExpanded
.
has
(
resourceUri
))
{
this
.
tree
.
expand
(
resource
).
done
(
null
,
errors
.
onUnexpectedError
);
...
...
@@ -356,7 +335,7 @@ export class MarkersPanel extends Panel {
private
getResourceForCurrentActiveResource
():
Resource
{
if
(
this
.
currentActiveResource
)
{
let
resources
=
this
.
markersModel
.
filteredResources
.
filter
((
resource
):
boolean
=>
{
let
resources
=
this
.
markers
WorkbenchService
.
markers
Model
.
filteredResources
.
filter
((
resource
):
boolean
=>
{
return
this
.
currentActiveResource
.
toString
()
===
resource
.
uri
.
toString
();
});
return
resources
.
length
>
0
?
resources
[
0
]
:
null
;
...
...
@@ -407,6 +386,5 @@ export class MarkersPanel extends Panel {
this
.
delayedRefresh
.
cancel
();
this
.
tree
.
dispose
();
this
.
markersModel
.
dispose
();
}
}
src/vs/workbench/parts/markers/browser/markersPanelActions.ts
浏览文件 @
32ff9427
...
...
@@ -24,6 +24,7 @@ import { CollapseAllAction as TreeCollapseAction } from 'vs/base/parts/tree/brow
import
Tree
=
require
(
'
vs/base/parts/tree/browser/tree
'
);
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
attachInputBoxStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
IMarkersWorkbenchService
}
from
'
vs/workbench/parts/markers/common/markers
'
;
export
class
ToggleMarkersPanelAction
extends
TogglePanelAction
{
...
...
@@ -80,6 +81,7 @@ export class FilterInputBoxActionItem extends BaseActionItem {
constructor
(
private
markersPanel
:
MarkersPanel
,
action
:
IAction
,
@
IContextViewService
private
contextViewService
:
IContextViewService
,
@
IThemeService
private
themeService
:
IThemeService
,
@
IMarkersWorkbenchService
private
markersWorkbenchService
:
IMarkersWorkbenchService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
)
{
super
(
markersPanel
,
action
);
this
.
toDispose
=
[];
...
...
@@ -93,7 +95,7 @@ export class FilterInputBoxActionItem extends BaseActionItem {
ariaLabel
:
Messages
.
MARKERS_PANEL_FILTER_PLACEHOLDER
});
this
.
toDispose
.
push
(
attachInputBoxStyler
(
filterInputBox
,
this
.
themeService
));
filterInputBox
.
value
=
this
.
markers
Panel
.
markersModel
.
filterOptions
.
completeFilter
;
filterInputBox
.
value
=
this
.
markers
WorkbenchService
.
markersModel
.
filterOptions
.
completeFilter
;
this
.
toDispose
.
push
(
filterInputBox
.
onDidChange
(
filter
=>
this
.
delayedFilterUpdate
.
trigger
(()
=>
this
.
updateFilter
(
filter
))));
this
.
toDispose
.
push
(
DOM
.
addStandardDisposableListener
(
filterInputBox
.
inputElement
,
'
keyup
'
,
(
keyboardEvent
)
=>
this
.
onInputKeyUp
(
keyboardEvent
,
filterInputBox
)));
this
.
toDispose
.
push
(
DOM
.
addStandardDisposableListener
(
container
,
'
keydown
'
,
this
.
handleKeyboardEvent
));
...
...
@@ -107,9 +109,9 @@ export class FilterInputBoxActionItem extends BaseActionItem {
private
reportFilteringUsed
():
void
{
let
data
=
{};
data
[
'
errors
'
]
=
this
.
markers
Panel
.
markersModel
.
filterOptions
.
filterErrors
;
data
[
'
warnings
'
]
=
this
.
markers
Panel
.
markersModel
.
filterOptions
.
filterWarnings
;
data
[
'
infos
'
]
=
this
.
markers
Panel
.
markersModel
.
filterOptions
.
filterInfos
;
data
[
'
errors
'
]
=
this
.
markers
WorkbenchService
.
markersModel
.
filterOptions
.
filterErrors
;
data
[
'
warnings
'
]
=
this
.
markers
WorkbenchService
.
markersModel
.
filterOptions
.
filterWarnings
;
data
[
'
infos
'
]
=
this
.
markers
WorkbenchService
.
markersModel
.
filterOptions
.
filterInfos
;
/* __GDPR__
"problems.filter" : {
"errors" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
...
...
src/vs/workbench/parts/markers/browser/markersWorkbenchContributions.ts
浏览文件 @
32ff9427
...
...
@@ -16,9 +16,13 @@ import { ToggleMarkersPanelAction, ShowProblemsPanelAction } from 'vs/workbench/
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
MarkersPanel
}
from
'
vs/workbench/parts/markers/browser/markersPanel
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IMarkersWorkbenchService
,
MarkersWorkbenchService
}
from
'
vs/workbench/parts/markers/common/markers
'
;
export
function
registerContributions
():
void
{
registerSingleton
(
IMarkersWorkbenchService
,
MarkersWorkbenchService
);
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
Constants
.
MARKER_OPEN_SIDE_ACTION_ID
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
...
...
src/vs/workbench/parts/markers/common/markers.ts
0 → 100644
浏览文件 @
32ff9427
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
MarkersModel
,
FilterOptions
}
from
'
vs/workbench/parts/markers/common/markersModel
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
IActivityService
,
NumberBadge
}
from
'
vs/workbench/services/activity/common/activity
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
Constants
from
'
vs/workbench/parts/markers/common/constants
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
export
const
IMarkersWorkbenchService
=
createDecorator
<
IMarkersWorkbenchService
>
(
'
markersWorkbenchService
'
);
export
interface
IMarkersWorkbenchService
{
_serviceBrand
:
any
;
readonly
onDidChangeMarkersForResources
:
Event
<
URI
[]
>
;
readonly
markersModel
:
MarkersModel
;
filter
(
filter
:
string
):
void
;
}
export
class
MarkersWorkbenchService
extends
Disposable
implements
IMarkersWorkbenchService
{
_serviceBrand
:
any
;
readonly
markersModel
:
MarkersModel
;
private
readonly
_onDidChangeMarkersForResources
:
Emitter
<
URI
[]
>
=
this
.
_register
(
new
Emitter
<
URI
[]
>
());
readonly
onDidChangeMarkersForResources
:
Event
<
URI
[]
>
=
this
.
_onDidChangeMarkersForResources
.
event
;
constructor
(
@
IMarkerService
private
markerService
:
IMarkerService
,
@
IActivityService
private
activityService
:
IActivityService
)
{
super
();
this
.
markersModel
=
this
.
_register
(
new
MarkersModel
(
this
.
markerService
.
read
()));
this
.
_register
(
markerService
.
onMarkerChanged
(
resources
=>
this
.
onMarkerChanged
(
resources
)));
}
filter
(
filter
:
string
):
void
{
this
.
markersModel
.
update
(
new
FilterOptions
(
filter
));
this
.
refreshBadge
();
}
private
onMarkerChanged
(
resources
:
URI
[]):
void
{
const
bulkUpdater
=
this
.
markersModel
.
getBulkUpdater
();
for
(
const
resource
of
resources
)
{
bulkUpdater
.
add
(
resource
,
this
.
markerService
.
read
({
resource
}));
}
bulkUpdater
.
done
();
this
.
refreshBadge
();
this
.
_onDidChangeMarkersForResources
.
fire
(
resources
);
}
private
refreshBadge
():
void
{
const
total
=
this
.
markersModel
.
total
();
const
count
=
this
.
markersModel
.
count
();
const
message
=
total
===
count
?
localize
(
'
totalProblems
'
,
'
Total {0} Problems
'
,
total
)
:
localize
(
'
filteredProblems
'
,
'
Showing {0} of {1} Problems
'
,
count
,
total
);
this
.
activityService
.
showActivity
(
Constants
.
MARKERS_PANEL_ID
,
new
NumberBadge
(
count
,
()
=>
message
));
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录