Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9fa1f52a
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,发现更多精彩内容 >>
提交
9fa1f52a
编写于
10月 05, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
start with scm file decorations
上级
7f9ff2b1
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
103 addition
and
1 deletion
+103
-1
src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts
.../workbench/parts/scm/electron-browser/scm.contribution.ts
+4
-0
src/vs/workbench/parts/scm/electron-browser/scmFileDecorations.ts
...orkbench/parts/scm/electron-browser/scmFileDecorations.ts
+94
-0
src/vs/workbench/services/fileDecorations/browser/fileDecorationsService.ts
...ervices/fileDecorations/browser/fileDecorationsService.ts
+5
-1
未找到文件。
src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts
浏览文件 @
9fa1f52a
...
...
@@ -17,6 +17,7 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
StatusUpdater
,
StatusBarController
}
from
'
./scmActivity
'
;
import
{
FileDecorations
}
from
'
./scmFileDecorations
'
;
import
{
SCMViewlet
}
from
'
vs/workbench/parts/scm/electron-browser/scmViewlet
'
;
class
OpenSCMViewletAction
extends
ToggleViewletAction
{
...
...
@@ -49,6 +50,9 @@ Registry.as(WorkbenchExtensions.Workbench)
Registry
.
as
(
WorkbenchExtensions
.
Workbench
)
.
registerWorkbenchContribution
(
StatusBarController
);
Registry
.
as
(
WorkbenchExtensions
.
Workbench
)
.
registerWorkbenchContribution
(
FileDecorations
);
// Register Action to Open Viewlet
Registry
.
as
<
IWorkbenchActionRegistry
>
(
WorkbenchActionExtensions
.
WorkbenchActions
).
registerWorkbenchAction
(
new
SyncActionDescriptor
(
OpenSCMViewletAction
,
VIEWLET_ID
,
localize
(
'
toggleSCMViewlet
'
,
"
Show SCM
"
),
{
...
...
src/vs/workbench/parts/scm/electron-browser/scmFileDecorations.ts
0 → 100644
浏览文件 @
9fa1f52a
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
import
{
IFileDecorationsService
}
from
'
vs/workbench/services/fileDecorations/browser/fileDecorations
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
ISCMService
,
ISCMRepository
}
from
'
vs/workbench/services/scm/common/scm
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
Color
}
from
'
vs/base/common/color
'
;
export
class
FileDecorations
implements
IWorkbenchContribution
{
private
readonly
_disposables
:
IDisposable
[];
// private readonly _type: DecorationType;
private
readonly
_repositoryListeners
=
new
Map
<
ISCMRepository
,
IDisposable
>
();
constructor
(
@
IFileDecorationsService
private
_decorationsService
:
IFileDecorationsService
,
@
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
),
];
}
dispose
():
void
{
dispose
(
this
.
_disposables
);
}
private
_onDidAddRepository
(
repo
:
ISCMRepository
):
void
{
const
type
=
this
.
_decorationsService
.
registerDecorationType
(
repo
.
provider
.
label
);
const
{
provider
}
=
repo
;
let
oldDecorations
=
new
Map
<
string
,
URI
>
();
const
listener
=
provider
.
onDidChangeResources
(()
=>
{
let
newDecorations
=
new
Map
<
string
,
URI
>
();
let
baseColor
=
Color
.
fromHex
(
'
#007acc
'
);
let
factor
=
0.0
;
for
(
const
group
of
provider
.
resources
)
{
factor
+=
0.1
;
let
color
=
Color
.
getDarkerColor
(
baseColor
,
Color
.
black
,
factor
);
for
(
const
resource
of
group
.
resourceCollection
.
resources
)
{
this
.
_decorationsService
.
setFileDecorations
(
type
,
resource
.
sourceUri
,
[{
severity
:
Severity
.
Info
,
message
:
resource
.
decorations
.
tooltip
,
color
}]);
newDecorations
.
set
(
resource
.
sourceUri
.
toString
(),
resource
.
sourceUri
);
}
}
oldDecorations
.
forEach
((
value
,
key
)
=>
{
if
(
!
newDecorations
.
has
(
key
))
{
this
.
_decorationsService
.
unsetFileDecorations
(
type
,
value
);
}
});
oldDecorations
=
newDecorations
;
});
this
.
_repositoryListeners
.
set
(
repo
,
{
dispose
()
{
listener
.
dispose
();
type
.
dispose
();
}
});
}
private
_onDidRemoveRepository
(
repo
:
ISCMRepository
):
void
{
let
listener
=
this
.
_repositoryListeners
.
get
(
repo
);
if
(
listener
)
{
this
.
_repositoryListeners
.
delete
(
repo
);
listener
.
dispose
();
}
}
getId
():
string
{
throw
new
Error
(
'
smc.SCMFileDecorations
'
);
}
}
src/vs/workbench/services/fileDecorations/browser/fileDecorationsService.ts
浏览文件 @
9fa1f52a
...
...
@@ -37,8 +37,12 @@ export class FileDecorationsService implements IFileDecorationsService {
super
(
label
);
}
dispose
()
{
let
tree
=
outer
.
_types
.
get
(
type
);
if
(
tree
)
{
tree
.
forEach
(([
key
])
=>
outer
.
_onDidChangeFileDecoration
.
fire
(
URI
.
parse
(
key
)));
outer
.
_types
.
delete
(
type
);
}
}
};
this
.
_types
.
set
(
type
,
TernarySearchTree
.
forPaths
<
IFileDecoration
[]
>
());
return
type
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录