Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7921c1fe
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,发现更多精彩内容 >>
提交
7921c1fe
编写于
10月 09, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add setting for scm, handle de-registration
上级
3cd39eeb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
63 addition
and
21 deletion
+63
-21
src/vs/workbench/parts/markers/browser/markersFileDecorations.ts
...workbench/parts/markers/browser/markersFileDecorations.ts
+2
-2
src/vs/workbench/parts/markers/browser/markersWorkbenchContributions.ts
...ch/parts/markers/browser/markersWorkbenchContributions.ts
+2
-2
src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts
.../workbench/parts/scm/electron-browser/scm.contribution.ts
+15
-0
src/vs/workbench/parts/scm/electron-browser/scmFileDecorations.ts
...orkbench/parts/scm/electron-browser/scmFileDecorations.ts
+25
-8
src/vs/workbench/services/decorations/browser/decorationsService.ts
...kbench/services/decorations/browser/decorationsService.ts
+19
-9
未找到文件。
src/vs/workbench/parts/markers/browser/markersFileDecorations.ts
浏览文件 @
7921c1fe
...
...
@@ -74,8 +74,8 @@ class MarkersFileDecorations implements IWorkbenchContribution {
}
private
_updateEnablement
():
void
{
let
value
=
this
.
_configurationService
.
getConfiguration
<
{
showOnFiles
:
boolean
}
>
(
'
problems
'
);
if
(
value
)
{
let
value
=
this
.
_configurationService
.
getConfiguration
<
{
fileDecorations
:
{
enabled
:
boolean
}
}
>
(
'
problems
'
);
if
(
value
.
fileDecorations
.
enabled
)
{
const
provider
=
new
MarkersDecorationsProvider
(
this
.
_markerService
);
this
.
_provider
=
this
.
_decorationsService
.
registerDecortionsProvider
(
provider
);
}
else
if
(
this
.
_provider
)
{
...
...
src/vs/workbench/parts/markers/browser/markersWorkbenchContributions.ts
浏览文件 @
7921c1fe
...
...
@@ -56,8 +56,8 @@ export function registerContributions(): void {
'
order
'
:
101
,
'
type
'
:
'
object
'
,
'
properties
'
:
{
'
problems.
showOnFiles
'
:
{
'
description
'
:
localize
(
'
markers.showOnFile
'
,
"
Show Errors & Warnings
in the file explor
er.
"
),
'
problems.
fileDecorations.enabled
'
:
{
'
description
'
:
localize
(
'
markers.showOnFile
'
,
"
Show Errors & Warnings
on files and fold
er.
"
),
'
type
'
:
'
boolean
'
,
'
default
'
:
true
}
...
...
src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts
浏览文件 @
7921c1fe
...
...
@@ -19,6 +19,7 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi
import
{
StatusUpdater
,
StatusBarController
}
from
'
./scmActivity
'
;
import
{
FileDecorations
}
from
'
./scmFileDecorations
'
;
import
{
SCMViewlet
}
from
'
vs/workbench/parts/scm/electron-browser/scmViewlet
'
;
import
{
IConfigurationRegistry
,
Extensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
class
OpenSCMViewletAction
extends
ToggleViewletAction
{
...
...
@@ -64,3 +65,17 @@ Registry.as<IWorkbenchActionRegistry>(WorkbenchActionExtensions.WorkbenchActions
'
View: Show SCM
'
,
localize
(
'
view
'
,
"
View
"
)
);
Registry
.
as
<
IConfigurationRegistry
>
(
Extensions
.
Configuration
).
registerConfiguration
({
'
id
'
:
'
scm
'
,
'
order
'
:
101
,
'
type
'
:
'
object
'
,
'
properties
'
:
{
'
scm.fileDecorations.enabled
'
:
{
'
description
'
:
localize
(
'
scm.fileDecorations.enabled
'
,
"
Show source control status on files and folders
"
),
'
type
'
:
'
boolean
'
,
'
default
'
:
true
}
}
});
src/vs/workbench/parts/scm/electron-browser/scmFileDecorations.ts
浏览文件 @
7921c1fe
...
...
@@ -12,6 +12,7 @@ import { ISCMService, ISCMRepository, ISCMProvider, ISCMResource } from 'vs/work
import
URI
from
'
vs/base/common/uri
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
class
SCMDecorationsProvider
implements
IDecorationsProvider
{
...
...
@@ -32,6 +33,7 @@ class SCMDecorationsProvider implements IDecorationsProvider {
dispose
():
void
{
this
.
_disposable
.
dispose
();
this
.
_data
.
clear
();
}
private
_updateGroups
():
void
{
...
...
@@ -67,18 +69,17 @@ class SCMDecorationsProvider implements IDecorationsProvider {
export
class
FileDecorations
implements
IWorkbenchContribution
{
private
readonly
_disposables
:
IDisposable
[];
private
readonly
_providers
=
new
Map
<
ISCMRepository
,
IDisposable
>
();
private
_providers
=
new
Map
<
ISCMRepository
,
IDisposable
>
();
private
_configListener
:
IDisposable
;
private
_repoListeners
:
IDisposable
[];
constructor
(
@
IResourceDecorationsService
private
_decorationsService
:
IResourceDecorationsService
,
@
IConfigurationService
private
_configurationService
:
IConfigurationService
,
@
ISCMService
private
_scmService
:
ISCMService
,
)
{
this
.
_scmService
.
repositories
.
forEach
(
this
.
_onDidAddRepository
,
this
);
this
.
_disposables
=
[
this
.
_scmService
.
onDidAddRepository
(
this
.
_onDidAddRepository
,
this
),
this
.
_scmService
.
onDidRemoveRepository
(
this
.
_onDidRemoveRepository
,
this
),
];
this
.
_configListener
=
this
.
_configurationService
.
onDidUpdateConfiguration
(
this
.
_update
,
this
);
this
.
_update
();
}
getId
():
string
{
...
...
@@ -86,7 +87,23 @@ export class FileDecorations implements IWorkbenchContribution {
}
dispose
():
void
{
dispose
(
this
.
_disposables
);
this
.
_providers
.
forEach
(
value
=>
dispose
(
value
));
dispose
(
this
.
_repoListeners
);
dispose
(
this
.
_configListener
,
this
.
_configListener
);
}
private
_update
():
void
{
const
value
=
this
.
_configurationService
.
getConfiguration
<
{
fileDecorations
:
{
enabled
:
boolean
}
}
>
(
'
scm
'
);
if
(
value
.
fileDecorations
.
enabled
)
{
this
.
_scmService
.
repositories
.
forEach
(
this
.
_onDidAddRepository
,
this
);
this
.
_repoListeners
=
[
this
.
_scmService
.
onDidAddRepository
(
this
.
_onDidAddRepository
,
this
),
this
.
_scmService
.
onDidRemoveRepository
(
this
.
_onDidRemoveRepository
,
this
)
];
}
else
{
this
.
_providers
.
forEach
(
value
=>
dispose
(
value
));
this
.
_repoListeners
=
dispose
(
this
.
_repoListeners
);
}
}
private
_onDidAddRepository
(
repo
:
ISCMRepository
):
void
{
...
...
src/vs/workbench/services/decorations/browser/decorationsService.ts
浏览文件 @
7921c1fe
...
...
@@ -6,7 +6,7 @@
import
URI
from
'
vs/base/common/uri
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
Event
,
{
Emitter
,
debounceEvent
}
from
'
vs/base/common/event
'
;
import
Event
,
{
Emitter
,
debounceEvent
,
any
}
from
'
vs/base/common/event
'
;
import
{
IResourceDecorationsService
,
IResourceDecoration
,
IResourceDecorationChangeEvent
,
IDecorationsProvider
}
from
'
./decorations
'
;
import
{
TernarySearchTree
}
from
'
vs/base/common/map
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -61,6 +61,10 @@ class DecorationProviderWrapper {
this
.
_data
.
clear
();
}
knowsAbout
(
uri
:
URI
):
boolean
{
return
Boolean
(
this
.
_data
.
get
(
uri
.
toString
()))
||
Boolean
(
this
.
_data
.
findSuperstr
(
uri
.
toString
()));
}
getOrRetrieve
(
uri
:
URI
,
includeChildren
:
boolean
,
callback
:
(
data
:
IResourceDecoration
)
=>
void
):
void
{
const
key
=
uri
.
toString
();
const
item
=
this
.
_data
.
get
(
key
);
...
...
@@ -110,22 +114,28 @@ export class FileDecorationsService implements IResourceDecorationsService {
_serviceBrand
:
any
;
private
readonly
_data
=
new
LinkedList
<
DecorationProviderWrapper
>
();
private
readonly
_onDidChangeFileDecoration
=
new
Emitter
<
URI
|
URI
[]
>
();
readonly
onDidChangeDecorations
:
Event
<
IResourceDecorationChangeEvent
>
=
debounceEvent
<
URI
|
URI
[],
FileDecorationChangeEvent
>
(
this
.
_onDidChangeFileDecoration
.
event
,
FileDecorationChangeEvent
.
debouncer
private
readonly
_onDidChangeDecorationsDelayed
=
new
Emitter
<
URI
|
URI
[]
>
();
private
readonly
_onDidChangeDecorations
=
new
Emitter
<
IResourceDecorationChangeEvent
>
();
readonly
onDidChangeDecorations
:
Event
<
IResourceDecorationChangeEvent
>
=
any
(
this
.
_onDidChangeDecorations
.
event
,
debounceEvent
<
URI
|
URI
[],
FileDecorationChangeEvent
>
(
this
.
_onDidChangeDecorationsDelayed
.
event
,
FileDecorationChangeEvent
.
debouncer
)
);
registerDecortionsProvider
(
provider
:
IDecorationsProvider
):
IDisposable
{
const
wrapper
=
new
DecorationProviderWrapper
(
provider
,
this
.
_onDidChange
FileDecoration
);
const
wrapper
=
new
DecorationProviderWrapper
(
provider
,
this
.
_onDidChange
DecorationsDelayed
);
const
remove
=
this
.
_data
.
push
(
wrapper
);
// fire for all
return
{
dispose
:
()
=>
{
wrapper
.
dispose
();
// fire event that says 'yes' for any resource
// known to this provider. then dispose and remove it.
remove
();
this
.
_onDidChangeDecorations
.
fire
({
affectsResource
:
uri
=>
wrapper
.
knowsAbout
(
uri
)
});
wrapper
.
dispose
();
}
};
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录