Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
da1a21d1
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
da1a21d1
编写于
1月 31, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
git: countBadge config
上级
adb32aa4
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
47 addition
and
10 deletion
+47
-10
extensions/git/package.json
extensions/git/package.json
+14
-1
extensions/git/package.nls.json
extensions/git/package.nls.json
+2
-1
extensions/git/src/scmProvider.ts
extensions/git/src/scmProvider.ts
+11
-1
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+2
-1
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-1
src/vs/workbench/api/node/extHostSCM.ts
src/vs/workbench/api/node/extHostSCM.ts
+1
-1
src/vs/workbench/api/node/mainThreadSCM.ts
src/vs/workbench/api/node/mainThreadSCM.ts
+7
-3
src/vs/workbench/parts/scm/electron-browser/scmActivity.ts
src/vs/workbench/parts/scm/electron-browser/scmActivity.ts
+8
-1
src/vs/workbench/services/scm/common/scm.ts
src/vs/workbench/services/scm/common/scm.ts
+1
-0
未找到文件。
extensions/git/package.json
浏览文件 @
da1a21d1
...
...
@@ -374,7 +374,10 @@
"title"
:
"Git"
,
"properties"
:
{
"git.path"
:
{
"type"
:
[
"string"
,
"null"
],
"type"
:
[
"string"
,
"null"
],
"description"
:
"%config.path%"
,
"default"
:
null
,
"isExecutable"
:
true
...
...
@@ -393,6 +396,16 @@
"type"
:
"boolean"
,
"description"
:
"%config.enableLongCommitWarning%"
,
"default"
:
true
},
"git.countBadge"
:
{
"type"
:
"string"
,
"enum"
:
[
"all"
,
"tracked"
,
"off"
],
"description"
:
"%config.countBadge%"
,
"default"
:
"all"
}
}
}
...
...
extensions/git/package.nls.json
浏览文件 @
da1a21d1
...
...
@@ -26,5 +26,6 @@
"config.path"
:
"Path to the git executable"
,
"config.autorefresh"
:
"Whether auto refreshing is enabled"
,
"config.autofetch"
:
"Whether auto fetching is enabled"
,
"config.enableLongCommitWarning"
:
"Whether long commit messages should be warned about"
"config.enableLongCommitWarning"
:
"Whether long commit messages should be warned about"
,
"config.countBadge"
:
"Controls the git badge counter"
}
\ No newline at end of file
extensions/git/src/scmProvider.ts
浏览文件 @
da1a21d1
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
scm
,
Uri
,
Disposable
,
SCMProvider
,
SCMResourceGroup
,
Event
,
ProviderResult
}
from
'
vscode
'
;
import
{
scm
,
Uri
,
Disposable
,
SCMProvider
,
SCMResourceGroup
,
Event
,
ProviderResult
,
workspace
}
from
'
vscode
'
;
import
{
Model
,
Resource
,
ResourceGroup
}
from
'
./model
'
;
import
{
CommandCenter
}
from
'
./commands
'
;
...
...
@@ -17,6 +17,16 @@ export class GitSCMProvider implements SCMProvider {
get
onDidChange
():
Event
<
SCMResourceGroup
[]
>
{
return
this
.
model
.
onDidChange
;
}
get
label
():
string
{
return
'
Git
'
;
}
get
count
():
number
{
const
countBadge
=
workspace
.
getConfiguration
(
'
git
'
).
get
<
string
>
(
'
countBadge
'
);
switch
(
countBadge
)
{
case
'
off
'
:
return
0
;
case
'
tracked
'
:
return
this
.
model
.
indexGroup
.
resources
.
length
;
default
:
return
this
.
model
.
resources
.
reduce
((
r
,
g
)
=>
r
+
g
.
resources
.
length
,
0
);
}
}
constructor
(
private
model
:
Model
,
private
commandCenter
:
CommandCenter
)
{
scm
.
registerSCMProvider
(
'
git
'
,
this
);
}
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
da1a21d1
...
...
@@ -133,8 +133,9 @@ declare module 'vscode' {
readonly
label
:
string
;
readonly
resources
:
SCMResourceGroup
[];
readonly
onDidChange
:
Event
<
SCMResourceGroup
[]
>
;
getOriginalResource
?(
uri
:
Uri
,
token
:
CancellationToken
):
ProviderResult
<
Uri
>
;
readonly
count
?:
number
|
undefined
;
getOriginalResource
?(
uri
:
Uri
,
token
:
CancellationToken
):
ProviderResult
<
Uri
>
;
open
?(
resource
:
SCMResource
,
token
:
CancellationToken
):
ProviderResult
<
void
>
;
drag
?(
resource
:
SCMResource
,
resourceGroup
:
SCMResourceGroup
,
token
:
CancellationToken
):
ProviderResult
<
void
>
;
}
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
da1a21d1
...
...
@@ -257,7 +257,7 @@ export type SCMRawResourceGroup = [string /*id*/, string /*label*/, SCMRawResour
export
abstract
class
MainThreadSCMShape
{
$register
(
id
:
string
,
features
:
SCMProviderFeatures
):
void
{
throw
ni
();
}
$unregister
(
id
:
string
):
void
{
throw
ni
();
}
$onChange
(
id
:
string
,
resources
:
SCMRawResourceGroup
[]):
void
{
throw
ni
();
}
$onChange
(
id
:
string
,
resources
:
SCMRawResourceGroup
[]
,
count
:
number
|
undefined
):
void
{
throw
ni
();
}
}
// -- extension host
...
...
src/vs/workbench/api/node/extHostSCM.ts
浏览文件 @
da1a21d1
...
...
@@ -151,7 +151,7 @@ export class ExtHostSCM {
return
[
g
.
id
,
g
.
label
,
rawResources
]
as
SCMRawResourceGroup
;
});
this
.
_proxy
.
$onChange
(
providerId
,
rawResourceGroups
);
this
.
_proxy
.
$onChange
(
providerId
,
rawResourceGroups
,
provider
.
count
);
});
return
new
Disposable
(()
=>
{
...
...
src/vs/workbench/api/node/mainThreadSCM.ts
浏览文件 @
da1a21d1
...
...
@@ -27,6 +27,9 @@ class MainThreadSCMProvider implements ISCMProvider {
get
id
():
string
{
return
this
.
_id
;
}
get
label
():
string
{
return
this
.
features
.
label
;
}
private
_count
:
number
|
undefined
=
undefined
;
get
count
():
number
|
undefined
{
return
this
.
_count
;
}
constructor
(
private
_id
:
string
,
private
proxy
:
ExtHostSCMShape
,
...
...
@@ -68,7 +71,7 @@ class MainThreadSCMProvider implements ISCMProvider {
// }
}
$onChange
(
rawResourceGroups
:
SCMRawResourceGroup
[]):
void
{
$onChange
(
rawResourceGroups
:
SCMRawResourceGroup
[]
,
count
:
number
|
undefined
):
void
{
this
.
_resources
=
rawResourceGroups
.
map
(
rawGroup
=>
{
const
[
id
,
label
,
rawResources
]
=
rawGroup
;
...
...
@@ -93,6 +96,7 @@ class MainThreadSCMProvider implements ISCMProvider {
return
{
id
,
label
,
resources
};
});
this
.
_count
=
count
;
this
.
_onDidChange
.
fire
(
this
.
resources
);
}
...
...
@@ -130,14 +134,14 @@ export class MainThreadSCM extends MainThreadSCMShape {
delete
this
.
providers
[
id
];
}
$onChange
(
id
:
string
,
rawResourceGroups
:
SCMRawResourceGroup
[]):
void
{
$onChange
(
id
:
string
,
rawResourceGroups
:
SCMRawResourceGroup
[]
,
count
:
number
|
undefined
):
void
{
const
provider
=
this
.
providers
[
id
];
if
(
!
provider
)
{
return
;
}
provider
.
$onChange
(
rawResourceGroups
);
provider
.
$onChange
(
rawResourceGroups
,
count
);
}
dispose
():
void
{
...
...
src/vs/workbench/parts/scm/electron-browser/scmActivity.ts
浏览文件 @
da1a21d1
...
...
@@ -41,8 +41,15 @@ export class StatusUpdater implements IWorkbenchContribution {
private
update
():
void
{
const
provider
=
this
.
scmService
.
activeProvider
;
const
count
=
provider
?
provider
.
resources
.
reduce
<
number
>
((
r
,
g
)
=>
r
+
g
.
resources
.
length
,
0
)
:
0
;
let
count
=
0
;
if
(
provider
)
{
if
(
typeof
provider
.
count
===
'
number
'
)
{
count
=
provider
.
count
;
}
else
{
count
=
provider
.
resources
.
reduce
<
number
>
((
r
,
g
)
=>
r
+
g
.
resources
.
length
,
0
);
}
}
if
(
count
>
0
)
{
const
badge
=
new
NumberBadge
(
count
,
num
=>
localize
(
'
scmPendingChangesBadge
'
,
'
{0} pending changes
'
,
num
));
...
...
src/vs/workbench/services/scm/common/scm.ts
浏览文件 @
da1a21d1
...
...
@@ -40,6 +40,7 @@ export interface ISCMProvider extends IDisposable {
readonly
label
:
string
;
readonly
resources
:
ISCMResourceGroup
[];
readonly
onDidChange
:
Event
<
ISCMResourceGroup
[]
>
;
readonly
count
?:
number
|
undefined
;
open
(
uri
:
ISCMResource
):
TPromise
<
void
>
;
drag
(
from
:
ISCMResource
,
to
:
ISCMResourceGroup
):
TPromise
<
void
>
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录