Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
83d20c58
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,发现更多精彩内容 >>
提交
83d20c58
编写于
5月 30, 2016
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Error list implementation
上级
10508cfb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
111 addition
and
68 deletion
+111
-68
src/vs/workbench/parts/markers/browser/MarkersPanel.ts
src/vs/workbench/parts/markers/browser/MarkersPanel.ts
+49
-24
src/vs/workbench/parts/markers/browser/MarkersTreeController.ts
.../workbench/parts/markers/browser/MarkersTreeController.ts
+31
-8
src/vs/workbench/parts/markers/browser/MarkersTreeViewer.ts
src/vs/workbench/parts/markers/browser/MarkersTreeViewer.ts
+5
-0
src/vs/workbench/parts/markers/browser/media/markers.css
src/vs/workbench/parts/markers/browser/media/markers.css
+8
-4
src/vs/workbench/parts/markers/common/MarkersModel.ts
src/vs/workbench/parts/markers/common/MarkersModel.ts
+18
-32
未找到文件。
src/vs/workbench/parts/markers/browser/MarkersPanel.ts
浏览文件 @
83d20c58
...
...
@@ -3,8 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
nls
=
require
(
'
vs/nls
'
);
import
'
vs/css!./media/markers
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
*
as
Set
from
'
vs/base/common/set
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
dom
=
require
(
'
vs/base/browser/dom
'
);
...
...
@@ -13,11 +14,13 @@ import builder = require('vs/base/browser/builder');
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
Panel
}
from
'
vs/workbench/browser/panel
'
;
import
{
IAction
}
from
'
vs/base/common/actions
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
Constants
from
'
vs/workbench/parts/markers/common/Constants
'
;
import
{
MarkersModel
}
from
'
vs/workbench/parts/markers/common/MarkersModel
'
;
import
{
Controller
}
from
'
vs/workbench/parts/markers/browser/MarkersTreeController
'
;
import
Tree
=
require
(
'
vs/base/parts/tree/browser/tree
'
);
import
{
CollapseAction
}
from
'
vs/base/parts/tree/browser/treeDefaults
'
;
import
TreeImpl
=
require
(
'
vs/base/parts/tree/browser/treeImpl
'
);
import
*
as
Viewer
from
'
vs/workbench/parts/markers/browser/MarkersTreeViewer
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -28,7 +31,9 @@ export class MarkersPanel extends Panel {
private
markersModel
:
MarkersModel
;
private
tree
:
Tree
.
ITree
;
private
_toDispose
:
lifecycle
.
IDisposable
[];
private
toDispose
:
lifecycle
.
IDisposable
[];
private
actions
:
IAction
[];
private
handled
:
Set
.
ArraySet
<
string
>
;
constructor
(
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
...
...
@@ -38,7 +43,8 @@ export class MarkersPanel extends Panel {
)
{
super
(
Constants
.
MARKERS_PANEL_ID
,
telemetryService
);
this
.
markersModel
=
new
MarkersModel
();
this
.
_toDispose
=
[];
this
.
toDispose
=
[];
this
.
handled
=
new
Set
.
ArraySet
<
string
>
();
}
public
create
(
parent
:
builder
.
Builder
):
TPromise
<
void
>
{
...
...
@@ -57,53 +63,72 @@ export class MarkersPanel extends Panel {
twistiePixels
:
20
,
});
this
.
_
toDispose
.
push
(
this
.
markerService
.
onMarkerChanged
((
changedResources
)
=>
{
this
.
toDispose
.
push
(
this
.
markerService
.
onMarkerChanged
((
changedResources
)
=>
{
this
.
updateTitleArea
();
this
.
updateResources
(
changedResources
);
this
.
tree
.
refresh
();
this
.
tree
.
refresh
()
.
then
(
this
.
autoExpand
.
bind
(
this
))
;
}));
this
.
render
();
return
TPromise
.
as
(
null
);
}
public
getTitle
():
string
{
let
title
=
''
;
let
marketStatistics
=
this
.
markerService
.
getStatistics
();
title
=
this
.
appendToTitle
(
title
,
marketStatistics
.
errors
,
'
markers.panel.single.error.label
'
,
'
markers.panel.multiple.errors.label
'
)
title
=
this
.
appendToTitle
(
title
,
marketStatistics
.
warnings
,
'
markers.panel.single.warning.label
'
,
'
markers.panel.multiple.warnings.label
'
)
title
=
this
.
appendToTitle
(
title
,
marketStatistics
.
infos
,
'
markers.panel.single.info.label
'
,
'
markers.panel.multiple.infos.label
'
)
title
=
this
.
appendToTitle
(
title
,
marketStatistics
.
unknwons
,
'
markers.panel.single.unknown.label
'
,
'
markers.panel.multiple.unknowns.label
'
)
let
markerStatistics
=
this
.
markerService
.
getStatistics
();
let
title
=
MarkersModel
.
getStatisticsLabel
(
markerStatistics
);
return
title
?
title
:
Messages
.
getString
(
'
markers.panel.no.problems
'
);
}
private
appendToTitle
(
title
:
string
,
markersCount
:
number
,
singleMarkerKey
:
string
,
multipleMarkerKey
:
string
):
string
{
if
(
markersCount
<=
0
)
{
return
title
;
}
title
=
title
?
title
+
'
,
'
:
''
;
title
+=
Messages
.
getString
(
markersCount
===
1
?
singleMarkerKey
:
multipleMarkerKey
,
''
+
markersCount
);
return
title
;
}
public
layout
(
dimension
:
builder
.
Dimension
):
void
{
this
.
tree
.
layout
(
dimension
.
height
);
}
public
focus
():
void
{
this
.
tree
.
DOMFocus
();
this
.
tree
.
focusFirst
();
}
public
getActions
():
IAction
[]
{
if
(
!
this
.
actions
)
{
this
.
actions
=
[
this
.
instantiationService
.
createInstance
(
CollapseAction
,
this
.
tree
,
true
)
];
this
.
actions
.
forEach
(
a
=>
{
this
.
toDispose
.
push
(
a
);
});
}
return
this
.
actions
;
}
private
updateResources
(
resources
:
URI
[])
{
resources
.
forEach
((
resource
)
=>
{
let
markers
=
this
.
markerService
.
read
({
resource
:
resource
}).
slice
(
0
)
let
markers
=
this
.
markerService
.
read
({
resource
:
resource
}).
slice
(
0
)
;
this
.
markersModel
.
updateResource
(
resource
,
markers
);
})
})
;
}
private
render
():
void
{
let
allMarkers
=
this
.
markerService
.
read
().
slice
(
0
);
this
.
markersModel
.
updateMarkers
(
allMarkers
);
this
.
tree
.
setInput
(
this
.
markersModel
);
this
.
tree
.
setInput
(
this
.
markersModel
).
then
(
this
.
autoExpand
.
bind
(
this
));
}
private
autoExpand
():
void
{
this
.
markersModel
.
getResources
().
forEach
((
resource
)
=>
{
if
(
this
.
handled
.
contains
(
resource
.
uri
.
toString
()))
{
return
;
}
if
(
resource
.
statistics
.
errors
>
0
&&
resource
.
statistics
.
errors
<
10
)
{
this
.
tree
.
expand
(
resource
).
done
(
null
,
errors
.
onUnexpectedError
);
}
else
{
this
.
tree
.
collapse
(
resource
).
done
(
null
,
errors
.
onUnexpectedError
);
}
this
.
handled
.
set
(
resource
.
uri
.
toString
());
});
}
public
dispose
():
void
{
this
.
_toDispose
=
lifecycle
.
dispose
(
this
.
_
toDispose
);
this
.
toDispose
=
lifecycle
.
dispose
(
this
.
toDispose
);
super
.
dispose
();
}
}
\ No newline at end of file
src/vs/workbench/parts/markers/browser/MarkersTreeController.ts
浏览文件 @
83d20c58
...
...
@@ -7,21 +7,19 @@
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
mouse
=
require
(
'
vs/base/browser/mouseEvent
'
);
import
keyboard
=
require
(
'
vs/base/browser/keyboardEvent
'
);
import
actionsrenderer
=
require
(
'
vs/base/parts/tree/browser/actionsRenderer
'
);
import
tree
=
require
(
'
vs/base/parts/tree/browser/tree
'
);
import
treedefaults
=
require
(
'
vs/base/parts/tree/browser/treeDefaults
'
);
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
CommonKeybindings
}
from
'
vs/base/common/keyCodes
'
;
import
{
Marker
}
from
'
vs/workbench/parts/markers/common/MarkersModel
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/common/services/codeEditorService
'
;
import
{
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IMarker
}
from
'
vs/platform/markers/common/markers
'
;
export
class
Controller
extends
treedefaults
.
DefaultController
{
private
contextMenuService
:
IContextMenuService
;
private
actionProvider
:
actionsrenderer
.
IActionProvider
;
constructor
(@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
)
{
constructor
(@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
ICodeEditorService
private
codeEditorService
:
ICodeEditorService
)
{
super
({
clickBehavior
:
treedefaults
.
ClickBehavior
.
ON_MOUSE_UP
});
this
.
downKeyBindingDispatcher
.
set
(
CommonKeybindings
.
SHIFT_UP_ARROW
,
this
.
onUp
.
bind
(
this
));
this
.
downKeyBindingDispatcher
.
set
(
CommonKeybindings
.
SHIFT_DOWN_ARROW
,
this
.
onDown
.
bind
(
this
));
...
...
@@ -36,7 +34,7 @@ export class Controller extends treedefaults.DefaultController {
return
super
.
onLeftClick
(
tree
,
element
,
event
);
}
protected
onEnter
(
tree
:
tree
.
ITree
,
event
:
keyboard
.
IKeyboardEvent
):
boolean
{
protected
onEnter
(
tree
:
tree
.
ITree
,
event
:
keyboard
.
IKeyboardEvent
):
boolean
{
super
.
onEnter
(
tree
,
event
);
this
.
openFileAtElement
(
tree
.
getFocus
());
return
true
;
...
...
@@ -44,7 +42,7 @@ export class Controller extends treedefaults.DefaultController {
private
openFileAtElement
(
element
:
any
)
{
if
(
element
instanceof
Marker
)
{
let
marker
=
<
IMarker
>
element
.
marker
;
let
marker
=
<
IMarker
>
element
.
marker
;
this
.
editorService
.
openEditor
({
resource
:
marker
.
resource
,
options
:
{
...
...
@@ -60,4 +58,29 @@ export class Controller extends treedefaults.DefaultController {
}
return
false
;
}
public
_preview
(
element
:
any
):
void
{
if
(
element
instanceof
Marker
)
{
let
marker
=
<
IMarker
>
element
.
marker
;
const
editors
=
this
.
codeEditorService
.
listCodeEditors
();
let
editor
:
ICommonCodeEditor
;
for
(
let
candidate
of
editors
)
{
if
(
!
candidate
.
getModel
()
||
candidate
.
getModel
().
getAssociatedResource
().
toString
()
!==
marker
.
resource
.
toString
())
{
continue
;
}
if
(
!
editor
||
this
.
editorService
.
getActiveEditor
()
&&
candidate
===
this
.
editorService
.
getActiveEditor
().
getControl
())
{
editor
=
candidate
;
}
}
if
(
editor
)
{
editor
.
revealRangeInCenter
(
marker
);
}
}
}
}
src/vs/workbench/parts/markers/browser/MarkersTreeViewer.ts
浏览文件 @
83d20c58
...
...
@@ -15,9 +15,11 @@ import { CountBadge } from 'vs/base/browser/ui/countBadge/countBadge';
import
{
FileLabel
}
from
'
vs/base/browser/ui/fileLabel/fileLabel
'
;
import
{
IMarker
}
from
'
vs/platform/markers/common/markers
'
;
import
{
MarkersModel
,
Resource
,
Marker
}
from
'
vs/workbench/parts/markers/common/MarkersModel
'
;
import
MarkersStatisticsWidget
from
'
vs/workbench/parts/markers/browser/MarkersStatisticsWidget
'
;
interface
IResourceTemplateData
{
file
:
FileLabel
;
statistics
:
MarkersStatisticsWidget
;
count
:
CountBadge
;
}
...
...
@@ -97,6 +99,8 @@ export class Renderer implements IRenderer {
var
data
:
IResourceTemplateData
=
Object
.
create
(
null
);
data
.
file
=
new
FileLabel
(
container
,
null
,
this
.
contextService
);
// data.statistics= new MarkersStatisticsWidget(dom.append(container, dom.emmet('.marker-stats')));
const
badgeWrapper
=
dom
.
append
(
container
,
dom
.
emmet
(
'
.count-badge-wrapper
'
));
data
.
count
=
new
CountBadge
(
badgeWrapper
);
...
...
@@ -121,6 +125,7 @@ export class Renderer implements IRenderer {
private
renderResourceElement
(
tree
:
ITree
,
element
:
Resource
,
templateData
:
IResourceTemplateData
)
{
templateData
.
file
.
setValue
(
element
.
uri
);
// templateData.statistics.setStatistics(element.statistics);
templateData
.
count
.
setCount
(
element
.
markers
.
length
);
}
...
...
src/vs/workbench/parts/markers/browser/media/markers.css
浏览文件 @
83d20c58
...
...
@@ -12,14 +12,18 @@
margin-left
:
4px
;
}
.markers-panel
>
.monaco-tree
.monaco-tree-row
.content
.monaco-file-label
{
.markers-panel
>
.monaco-tree
.monaco-tree-row
.content
>
*
{
vertical-align
:
middle
;
}
.markers-panel
>
.monaco-tree
.monaco-tree-row
.content
.marker-stats
{
display
:
inline-block
;
margin-left
:
10px
;
}
.markers-panel
>
.monaco-tree
.monaco-tree-row
.content
.count-badge-wrapper
{
display
:
block
;
float
:
right
;
margin-right
:
10px
;
display
:
inline-block
;
margin-left
:
10px
;
line-height
:
22px
;
}
...
...
src/vs/workbench/parts/markers/common/MarkersModel.ts
浏览文件 @
83d20c58
...
...
@@ -8,6 +8,7 @@ import * as Map from 'vs/base/common/map';
import
Severity
from
'
vs/base/common/severity
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IMarker
,
MarkerStatistics
}
from
'
vs/platform/markers/common/markers
'
;
import
Messages
from
'
vs/workbench/parts/markers/common/Messages
'
;
export
class
Resource
{
constructor
(
public
uri
:
URI
,
public
markers
:
Marker
[],
public
statistics
:
MarkerStatistics
){};
...
...
@@ -29,10 +30,6 @@ export class MarkersModel {
public
getResources
():
Resource
[]
{
var
resources
=
<
Resource
[]
>
this
.
markersByResource
.
entries
().
map
(
this
.
toResource
.
bind
(
this
));
resources
.
sort
((
a
:
Resource
,
b
:
Resource
)
=>
{
let
compare
=
this
.
compare
(
a
.
statistics
,
b
.
statistics
);
if
(
compare
!==
0
)
{
return
compare
;
}
return
a
.
uri
.
toString
().
localeCompare
(
b
.
uri
.
toString
());
});
return
resources
;
...
...
@@ -59,6 +56,23 @@ export class MarkersModel {
});
}
public
static
getStatisticsLabel
(
marketStatistics
:
MarkerStatistics
):
string
{
let
label
=
this
.
getLabel
(
''
,
marketStatistics
.
errors
,
'
markers.panel.single.error.label
'
,
'
markers.panel.multiple.errors.label
'
);
label
=
this
.
getLabel
(
label
,
marketStatistics
.
warnings
,
'
markers.panel.single.warning.label
'
,
'
markers.panel.multiple.warnings.label
'
);
label
=
this
.
getLabel
(
label
,
marketStatistics
.
infos
,
'
markers.panel.single.info.label
'
,
'
markers.panel.multiple.infos.label
'
);
label
=
this
.
getLabel
(
label
,
marketStatistics
.
unknwons
,
'
markers.panel.single.unknown.label
'
,
'
markers.panel.multiple.unknowns.label
'
);
return
label
;
}
private
static
getLabel
(
title
:
string
,
markersCount
:
number
,
singleMarkerKey
:
string
,
multipleMarkerKey
:
string
):
string
{
if
(
markersCount
<=
0
)
{
return
title
;
}
title
=
title
?
title
+
'
,
'
:
''
;
title
+=
Messages
.
getString
(
markersCount
===
1
?
singleMarkerKey
:
multipleMarkerKey
,
''
+
markersCount
);
return
title
;
}
private
toResource
(
entry
:
Map
.
Entry
<
URI
,
IMarker
[]
>
)
{
let
markers
=
entry
.
value
.
map
(
this
.
toMarker
);
let
resource
=
new
Resource
(
entry
.
key
,
markers
,
this
.
getStatistics
(
entry
.
value
));
...
...
@@ -69,34 +83,6 @@ export class MarkersModel {
return
new
Marker
(
marker
.
resource
.
toString
()
+
index
,
marker
);
}
private
compare
(
stat1
:
MarkerStatistics
,
stat2
:
MarkerStatistics
):
number
{
if
(
stat1
.
errors
>
stat2
.
errors
)
{
return
-
1
;
}
if
(
stat2
.
errors
>
stat1
.
errors
)
{
return
1
;
}
if
(
stat1
.
warnings
>
stat2
.
warnings
)
{
return
-
1
;
}
if
(
stat2
.
warnings
>
stat1
.
warnings
)
{
return
1
;
}
if
(
stat1
.
infos
>
stat2
.
infos
)
{
return
-
1
;
}
if
(
stat2
.
infos
>
stat1
.
infos
)
{
return
1
;
}
if
(
stat1
.
unknwons
>
stat2
.
unknwons
)
{
return
-
1
;
}
if
(
stat2
.
unknwons
>
stat1
.
unknwons
)
{
return
1
;
}
return
0
;
}
private
getStatistics
(
markers
:
IMarker
[]):
MarkerStatistics
{
let
errors
=
0
,
warnings
=
0
,
infos
=
0
,
unknowns
=
0
;
markers
.
forEach
((
marker
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录