Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
fd4091b8
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,发现更多精彩内容 >>
提交
fd4091b8
编写于
10月 08, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
problems: first render success!
上级
2570a185
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
81 addition
and
89 deletion
+81
-89
src/vs/workbench/parts/markers/electron-browser/markers.ts
src/vs/workbench/parts/markers/electron-browser/markers.ts
+49
-60
src/vs/workbench/parts/markers/electron-browser/markersModel.ts
.../workbench/parts/markers/electron-browser/markersModel.ts
+6
-0
src/vs/workbench/parts/markers/electron-browser/markersPanel.ts
.../workbench/parts/markers/electron-browser/markersPanel.ts
+22
-27
src/vs/workbench/parts/markers/electron-browser/markersPanelActions.ts
...nch/parts/markers/electron-browser/markersPanelActions.ts
+1
-1
src/vs/workbench/parts/markers/electron-browser/markersTreeViewer.ts
...bench/parts/markers/electron-browser/markersTreeViewer.ts
+3
-1
未找到文件。
src/vs/workbench/parts/markers/electron-browser/markers.ts
浏览文件 @
fd4091b8
...
...
@@ -11,13 +11,7 @@ import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/co
import
{
localize
}
from
'
vs/nls
'
;
import
Constants
from
'
./constants
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
deepClone
,
mixin
}
from
'
vs/base/common/objects
'
;
import
{
IExpression
,
getEmptyExpression
}
from
'
vs/base/common/glob
'
;
import
{
IWorkspaceContextService
,
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
join
,
isAbsolute
}
from
'
vs/base/common/paths
'
;
import
{
groupBy
}
from
'
vs/base/common/arrays
'
;
export
const
IMarkersWorkbenchService
=
createDecorator
<
IMarkersWorkbenchService
>
(
'
markersWorkbenchService
'
);
...
...
@@ -30,10 +24,9 @@ export interface IFilter {
export
interface
IMarkersWorkbenchService
{
_serviceBrand
:
any
;
readonly
onDidChange
:
Event
<
URI
[]
>
;
readonly
markersModel
:
MarkersModel
;
filter
(
filter
:
IFilter
):
void
;
//
filter(filter: IFilter): void;
}
export
class
MarkersWorkbenchService
extends
Disposable
implements
IMarkersWorkbenchService
{
...
...
@@ -41,15 +34,12 @@ export class MarkersWorkbenchService extends Disposable implements IMarkersWorkb
readonly
markersModel
:
MarkersModel
;
private
readonly
_onDidChange
:
Emitter
<
URI
[]
>
=
this
.
_register
(
new
Emitter
<
URI
[]
>
());
readonly
onDidChange
:
Event
<
URI
[]
>
=
this
.
_onDidChange
.
event
;
private
useFilesExclude
:
boolean
=
false
;
// private useFilesExclude: boolean = false;
constructor
(
@
IMarkerService
private
markerService
:
IMarkerService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IWorkspaceContextService
private
workspaceContextService
:
IWorkspaceContextService
,
//
@IConfigurationService private configurationService: IConfigurationService,
//
@IWorkspaceContextService private workspaceContextService: IWorkspaceContextService,
@
IActivityService
private
activityService
:
IActivityService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
)
{
...
...
@@ -69,10 +59,10 @@ export class MarkersWorkbenchService extends Disposable implements IMarkersWorkb
// }));
}
filter
(
filter
:
IFilter
):
void
{
this
.
useFilesExclude
=
filter
.
useFilesExclude
;
this
.
doFilter
(
filter
.
filterText
,
this
.
getExcludeExpression
());
}
//
filter(filter: IFilter): void {
//
this.useFilesExclude = filter.useFilesExclude;
//
this.doFilter(filter.filterText, this.getExcludeExpression());
//
}
private
onMarkerChanged
(
resources
:
URI
[]):
void
{
for
(
const
resource
of
resources
)
{
...
...
@@ -80,34 +70,33 @@ export class MarkersWorkbenchService extends Disposable implements IMarkersWorkb
}
this
.
refreshBadge
();
this
.
_onDidChange
.
fire
(
resources
);
}
private
readMarkers
(
resource
?:
URI
):
IMarker
[]
{
return
this
.
markerService
.
read
({
resource
,
severities
:
MarkerSeverity
.
Error
|
MarkerSeverity
.
Warning
|
MarkerSeverity
.
Info
});
}
private
getExcludeExpression
():
IExpression
{
if
(
this
.
useFilesExclude
)
{
const
workspaceFolders
=
this
.
workspaceContextService
.
getWorkspace
().
folders
;
if
(
workspaceFolders
.
length
)
{
const
result
=
getEmptyExpression
();
for
(
const
workspaceFolder
of
workspaceFolders
)
{
mixin
(
result
,
this
.
getExcludesForFolder
(
workspaceFolder
));
}
return
result
;
}
else
{
return
this
.
getFilesExclude
();
}
}
return
{};
}
private
doFilter
(
filterText
:
string
,
filesExclude
:
IExpression
):
void
{
console
.
warn
(
'
marker filter not implemented
'
);
this
.
refreshBadge
();
this
.
_onDidChange
.
fire
([]);
}
//
private getExcludeExpression(): IExpression {
//
if (this.useFilesExclude) {
//
const workspaceFolders = this.workspaceContextService.getWorkspace().folders;
//
if (workspaceFolders.length) {
//
const result = getEmptyExpression();
//
for (const workspaceFolder of workspaceFolders) {
//
mixin(result, this.getExcludesForFolder(workspaceFolder));
//
}
//
return result;
//
} else {
//
return this.getFilesExclude();
//
}
//
}
//
return {};
//
}
//
private doFilter(filterText: string, filesExclude: IExpression): void {
//
console.warn('marker filter not implemented');
//
this.refreshBadge();
//
this._onDidChange.fire([]);
//
}
private
refreshBadge
():
void
{
const
{
total
}
=
this
.
markersModel
.
stats
();
...
...
@@ -115,26 +104,26 @@ export class MarkersWorkbenchService extends Disposable implements IMarkersWorkb
this
.
activityService
.
showActivity
(
Constants
.
MARKERS_PANEL_ID
,
new
NumberBadge
(
total
,
()
=>
message
));
}
private
getExcludesForFolder
(
workspaceFolder
:
IWorkspaceFolder
):
IExpression
{
const
expression
=
this
.
getFilesExclude
(
workspaceFolder
.
uri
);
return
this
.
getAbsoluteExpression
(
expression
,
workspaceFolder
.
uri
.
fsPath
);
}
private
getFilesExclude
(
resource
?:
URI
):
IExpression
{
return
deepClone
(
this
.
configurationService
.
getValue
(
'
files.exclude
'
,
{
resource
}))
||
{};
}
private
getAbsoluteExpression
(
expr
:
IExpression
,
root
:
string
):
IExpression
{
return
Object
.
keys
(
expr
)
.
reduce
((
absExpr
:
IExpression
,
key
:
string
)
=>
{
if
(
expr
[
key
]
&&
!
isAbsolute
(
key
))
{
const
absPattern
=
join
(
root
,
key
);
absExpr
[
absPattern
]
=
expr
[
key
];
}
return
absExpr
;
},
Object
.
create
(
null
));
}
//
private getExcludesForFolder(workspaceFolder: IWorkspaceFolder): IExpression {
//
const expression = this.getFilesExclude(workspaceFolder.uri);
//
return this.getAbsoluteExpression(expression, workspaceFolder.uri.fsPath);
//
}
//
private getFilesExclude(resource?: URI): IExpression {
//
return deepClone(this.configurationService.getValue('files.exclude', { resource })) || {};
//
}
//
private getAbsoluteExpression(expr: IExpression, root: string): IExpression {
//
return Object.keys(expr)
//
.reduce((absExpr: IExpression, key: string) => {
//
if (expr[key] && !isAbsolute(key)) {
//
const absPattern = join(root, key);
//
absExpr[absPattern] = expr[key];
//
}
//
return absExpr;
//
}, Object.create(null));
//
}
}
registerSingleton
(
IMarkersWorkbenchService
,
MarkersWorkbenchService
);
\ No newline at end of file
src/vs/workbench/parts/markers/electron-browser/markersModel.ts
浏览文件 @
fd4091b8
...
...
@@ -10,6 +10,7 @@ import { IMarker, MarkerSeverity, IRelatedInformation } from 'vs/platform/marker
import
{
groupBy
,
flatten
,
isFalsyOrEmpty
}
from
'
vs/base/common/arrays
'
;
import
{
values
}
from
'
vs/base/common/map
'
;
import
{
memoize
}
from
'
vs/base/common/decorators
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
function
compareUris
(
a
:
URI
,
b
:
URI
)
{
const
astr
=
a
.
toString
();
...
...
@@ -137,6 +138,9 @@ export class MarkersModel {
private
cachedSortedResources
:
ResourceMarkers
[]
|
undefined
=
undefined
;
private
readonly
_onDidChange
:
Emitter
<
URI
>
=
new
Emitter
<
URI
>
();
readonly
onDidChange
:
Event
<
URI
>
=
this
.
_onDidChange
.
event
;
get
resourceMarkers
():
ResourceMarkers
[]
{
if
(
!
this
.
cachedSortedResources
)
{
this
.
cachedSortedResources
=
values
(
this
.
resourcesByUri
).
sort
(
compareResourceMarkers
);
...
...
@@ -188,6 +192,7 @@ export class MarkersModel {
}
this
.
cachedSortedResources
=
undefined
;
this
.
_onDidChange
.
fire
(
resource
);
}
// TODO@joao
...
...
@@ -220,6 +225,7 @@ export class MarkersModel {
}
dispose
():
void
{
this
.
_onDidChange
.
dispose
();
this
.
resourcesByUri
.
clear
();
}
}
src/vs/workbench/parts/markers/electron-browser/markersPanel.ts
浏览文件 @
fd4091b8
...
...
@@ -7,7 +7,6 @@ import 'vs/css!./media/markers';
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Delayer
}
from
'
vs/base/common/async
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
IAction
,
IActionItem
,
Action
}
from
'
vs/base/common/actions
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
...
...
@@ -17,7 +16,7 @@ import Constants from 'vs/workbench/parts/markers/electron-browser/constants';
import
{
Marker
,
ResourceMarkers
,
RelatedInformation
,
MarkersModel
}
from
'
vs/workbench/parts/markers/electron-browser/markersModel
'
;
import
*
as
Viewer
from
'
vs/workbench/parts/markers/electron-browser/markersTreeViewer
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
MarkersFilterActionItem
,
MarkersFilterAction
,
QuickFixAction
,
QuickFixActionItem
,
IMarkersFilterActionChangeEvent
}
from
'
vs/workbench/parts/markers/electron-browser/markersPanelActions
'
;
import
{
MarkersFilterActionItem
,
MarkersFilterAction
,
QuickFixAction
,
QuickFixActionItem
}
from
'
vs/workbench/parts/markers/electron-browser/markersPanelActions
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
Messages
from
'
vs/workbench/parts/markers/electron-browser/messages
'
;
import
{
RangeHighlightDecorations
}
from
'
vs/workbench/browser/parts/editor/rangeDecorations
'
;
...
...
@@ -31,6 +30,7 @@ import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/c
import
{
ObjectTree
}
from
'
vs/base/browser/ui/tree/objectTree
'
;
import
{
Iterator
}
from
'
vs/base/common/iterator
'
;
import
{
ITreeElement
}
from
'
vs/base/browser/ui/tree/tree
'
;
import
{
debounceEvent
}
from
'
vs/base/common/event
'
;
type
TreeElement
=
ResourceMarkers
|
Marker
|
RelatedInformation
;
...
...
@@ -53,8 +53,6 @@ function createModelIterator(model: MarkersModel): Iterator<ITreeElement<TreeEle
export
class
MarkersPanel
extends
Panel
{
private
delayedRefresh
:
Delayer
<
void
>
;
private
lastSelectedRelativeTop
:
number
=
0
;
private
currentActiveResource
:
URI
=
null
;
...
...
@@ -86,7 +84,6 @@ export class MarkersPanel extends Panel {
)
{
super
(
Constants
.
MARKERS_PANEL_ID
,
telemetryService
,
themeService
);
this
.
panelFoucusContextKey
=
Constants
.
MarkerPanelFocusContextKey
.
bindTo
(
contextKeyService
);
this
.
delayedRefresh
=
new
Delayer
<
void
>
(
500
);
this
.
panelSettings
=
this
.
getMemento
(
storageService
,
Scope
.
WORKSPACE
);
this
.
setCurrentActiveEditor
();
}
...
...
@@ -106,7 +103,7 @@ export class MarkersPanel extends Panel {
this
.
createActions
();
this
.
createListeners
();
this
.
updateFilter
();
//
this.updateFilter();
this
.
onDidFocus
(()
=>
this
.
panelFoucusContextKey
.
set
(
true
));
this
.
onDidBlur
(()
=>
this
.
panelFoucusContextKey
.
set
(
false
));
...
...
@@ -208,15 +205,15 @@ export class MarkersPanel extends Panel {
dom
.
toggleClass
(
this
.
treeContainer
,
'
hidden
'
,
false
/* !this.markersWorkbenchService.markersModel.hasFilteredResources() */
);
this
.
renderMessage
();
// if (this.markersWorkbenchService.markersModel.hasFilteredResources()) {
// return this.tree.refresh(
);
this
.
tree
.
setChildren
(
null
,
createModelIterator
(
this
.
markersWorkbenchService
.
markersModel
)
);
// }
}
return
TPromise
.
as
(
null
);
}
private
updateFilter
()
{
this
.
markersWorkbenchService
.
filter
({
filterText
:
this
.
filterAction
.
filterText
,
useFilesExclude
:
this
.
filterAction
.
useFilesExclude
});
}
//
private updateFilter() {
//
this.markersWorkbenchService.filter({ filterText: this.filterAction.filterText, useFilesExclude: this.filterAction.useFilesExclude });
//
}
private
createMessageBox
(
parent
:
HTMLElement
):
void
{
this
.
messageBoxContainer
=
dom
.
append
(
parent
,
dom
.
$
(
'
.message-box-container
'
));
...
...
@@ -293,27 +290,27 @@ export class MarkersPanel extends Panel {
}
private
createListeners
():
void
{
this
.
_register
(
this
.
markersWorkbenchService
.
onDidChange
(
resources
=>
this
.
onDidChange
(
resources
)));
const
onModelChange
=
debounceEvent
<
URI
,
URI
[]
>
(
this
.
markersWorkbenchService
.
markersModel
.
onDidChange
,
(
uris
,
uri
)
=>
{
if
(
!
uris
)
{
uris
=
[];
}
uris
.
push
(
uri
);
return
uris
;
},
0
);
this
.
_register
(
onModelChange
(
this
.
onDidChangeModel
,
this
));
this
.
_register
(
this
.
editorService
.
onDidActiveEditorChange
(
this
.
onActiveEditorChanged
,
this
));
this
.
_register
(
this
.
tree
.
onDidChangeSelection
(()
=>
this
.
onSelected
()));
this
.
_register
(
this
.
filterAction
.
onDidChange
((
event
:
IMarkersFilterActionChangeEvent
)
=>
{
if
(
event
.
filterText
||
event
.
useFilesExclude
)
{
this
.
updateFilter
();
}
}));
//
this._register(this.filterAction.onDidChange((event: IMarkersFilterActionChangeEvent) => {
//
if (event.filterText || event.useFilesExclude) {
//
this.updateFilter();
//
}
//
}));
this
.
actions
.
forEach
(
a
=>
this
.
_register
(
a
));
}
private
onDidChange
(
resources
:
URI
[])
{
private
onDidChange
Model
(
resources
:
URI
[])
{
this
.
currentResourceGotAddedToMarkersData
=
this
.
currentResourceGotAddedToMarkersData
||
this
.
isCurrentResourceGotAddedToMarkersData
(
resources
);
this
.
delayedRefresh
.
trigger
(()
=>
{
this
.
refreshPanel
();
this
.
updateRangeHighlights
();
if
(
this
.
currentResourceGotAddedToMarkersData
)
{
this
.
autoReveal
();
this
.
currentResourceGotAddedToMarkersData
=
false
;
}
});
this
.
refreshPanel
();
this
.
updateRangeHighlights
();
if
(
this
.
currentResourceGotAddedToMarkersData
)
{
this
.
autoReveal
();
this
.
currentResourceGotAddedToMarkersData
=
false
;
}
}
private
isCurrentResourceGotAddedToMarkersData
(
changedResources
:
URI
[])
{
...
...
@@ -512,8 +509,6 @@ export class MarkersPanel extends Panel {
public
dispose
():
void
{
super
.
dispose
();
this
.
delayedRefresh
.
cancel
();
this
.
tree
.
dispose
();
}
}
src/vs/workbench/parts/markers/electron-browser/markersPanelActions.ts
浏览文件 @
fd4091b8
...
...
@@ -210,7 +210,7 @@ export class MarkersFilterActionItem extends BaseActionItem {
this
.
filterBadge
.
style
.
borderColor
=
border
;
}));
this
.
updateBadge
();
this
.
_register
(
this
.
markersWorkbenchService
.
onDidChange
(()
=>
this
.
updateBadge
()));
this
.
_register
(
this
.
markersWorkbenchService
.
markersModel
.
onDidChange
(()
=>
this
.
updateBadge
()));
}
private
createFilesExcludeCheckbox
(
container
:
HTMLElement
):
void
{
...
...
src/vs/workbench/parts/markers/electron-browser/markersTreeViewer.ts
浏览文件 @
fd4091b8
...
...
@@ -196,6 +196,8 @@ export class ResourceMarkersRenderer implements ITreeRenderer<ResourceMarkers, I
export
class
FileResourceMarkersRenderer
extends
ResourceMarkersRenderer
{
templateId
=
TemplateId
.
FileResourceMarkers
;
protected
createResourceLabel
(
container
:
HTMLElement
):
ResourceLabel
{
return
this
.
instantiationService
.
createInstance
(
FileLabel
,
container
,
{
supportHighlights
:
true
});
}
...
...
@@ -275,7 +277,7 @@ export class RelatedInformationRenderer implements ITreeRenderer<RelatedInformat
@
ILabelService
private
labelService
:
ILabelService
)
{
}
templateId
=
TemplateId
.
Marker
;
templateId
=
TemplateId
.
RelatedInformation
;
renderTemplate
(
container
:
HTMLElement
):
IRelatedInformationTemplateData
{
const
data
:
IRelatedInformationTemplateData
=
Object
.
create
(
null
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录