Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9b7a8813
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,发现更多精彩内容 >>
提交
9b7a8813
编写于
4月 27, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
🐛
SourceControlResourceDecorations.faded
fixes #24097
上级
3f0c6c8a
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
56 addition
and
27 deletion
+56
-27
extensions/git/src/model.ts
extensions/git/src/model.ts
+32
-20
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+6
-0
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+2
-1
src/vs/workbench/api/node/extHostSCM.ts
src/vs/workbench/api/node/extHostSCM.ts
+2
-1
src/vs/workbench/api/node/mainThreadSCM.ts
src/vs/workbench/api/node/mainThreadSCM.ts
+6
-4
src/vs/workbench/parts/scm/electron-browser/media/scmViewlet.css
...workbench/parts/scm/electron-browser/media/scmViewlet.css
+4
-0
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
+3
-1
src/vs/workbench/services/scm/common/scm.ts
src/vs/workbench/services/scm/common/scm.ts
+1
-0
未找到文件。
extensions/git/src/model.ts
浏览文件 @
9b7a8813
...
...
@@ -132,14 +132,23 @@ export class Resource implements SourceControlResourceState {
}
}
@
memoize
private
get
faded
():
boolean
{
const
workspaceRootPath
=
this
.
workspaceRoot
.
fsPath
;
return
this
.
resourceUri
.
fsPath
.
substr
(
0
,
workspaceRootPath
.
length
)
!==
workspaceRootPath
;
}
get
decorations
():
SourceControlResourceDecorations
{
const
light
=
{
iconPath
:
this
.
getIconPath
(
'
light
'
)
};
const
dark
=
{
iconPath
:
this
.
getIconPath
(
'
dark
'
)
};
const
strikeThrough
=
this
.
strikeThrough
;
const
faded
=
this
.
faded
;
return
{
strikeThrough
:
this
.
strikeThrough
,
light
,
dark
};
return
{
strikeThrough
,
faded
,
light
,
dark
};
}
constructor
(
private
workspaceRoot
:
Uri
,
private
_resourceGroup
:
ResourceGroup
,
private
_resourceUri
:
Uri
,
private
_type
:
Status
,
...
...
@@ -351,6 +360,7 @@ export class Model implements Disposable {
this
.
_onDidChangeResources
.
fire
();
}
private
workspaceRoot
:
Uri
;
private
onWorkspaceChange
:
Event
<
Uri
>
;
private
isRepositoryHuge
=
false
;
private
didWarnAboutLimit
=
false
;
...
...
@@ -359,8 +369,10 @@ export class Model implements Disposable {
constructor
(
private
_git
:
Git
,
private
workspaceRootPath
:
string
workspaceRootPath
:
string
)
{
this
.
workspaceRoot
=
Uri
.
file
(
workspaceRootPath
);
const
fsWatcher
=
workspace
.
createFileSystemWatcher
(
'
**
'
);
this
.
onWorkspaceChange
=
anyEvent
(
fsWatcher
.
onDidChange
,
fsWatcher
.
onDidCreate
,
fsWatcher
.
onDidDelete
);
this
.
disposables
.
push
(
fsWatcher
);
...
...
@@ -374,7 +386,7 @@ export class Model implements Disposable {
return
;
}
await
this
.
_git
.
init
(
this
.
workspaceRootPath
);
await
this
.
_git
.
init
(
this
.
workspaceRoot
.
fs
Path
);
await
this
.
status
();
}
...
...
@@ -567,7 +579,7 @@ export class Model implements Disposable {
this
.
repositoryDisposable
.
dispose
();
const
disposables
:
Disposable
[]
=
[];
const
repositoryRoot
=
await
this
.
_git
.
getRepositoryRoot
(
this
.
workspaceRootPath
);
const
repositoryRoot
=
await
this
.
_git
.
getRepositoryRoot
(
this
.
workspaceRoot
.
fs
Path
);
this
.
repository
=
this
.
_git
.
open
(
repositoryRoot
);
const
dotGitPath
=
path
.
join
(
repositoryRoot
,
'
.git
'
);
...
...
@@ -640,30 +652,30 @@ export class Model implements Disposable {
const
renameUri
=
raw
.
rename
?
Uri
.
file
(
path
.
join
(
this
.
repository
.
root
,
raw
.
rename
))
:
undefined
;
switch
(
raw
.
x
+
raw
.
y
)
{
case
'
??
'
:
return
workingTree
.
push
(
new
Resource
(
this
.
workingTreeGroup
,
uri
,
Status
.
UNTRACKED
));
case
'
!!
'
:
return
workingTree
.
push
(
new
Resource
(
this
.
workingTreeGroup
,
uri
,
Status
.
IGNORED
));
case
'
DD
'
:
return
merge
.
push
(
new
Resource
(
this
.
mergeGroup
,
uri
,
Status
.
BOTH_DELETED
));
case
'
AU
'
:
return
merge
.
push
(
new
Resource
(
this
.
mergeGroup
,
uri
,
Status
.
ADDED_BY_US
));
case
'
UD
'
:
return
merge
.
push
(
new
Resource
(
this
.
mergeGroup
,
uri
,
Status
.
DELETED_BY_THEM
));
case
'
UA
'
:
return
merge
.
push
(
new
Resource
(
this
.
mergeGroup
,
uri
,
Status
.
ADDED_BY_THEM
));
case
'
DU
'
:
return
merge
.
push
(
new
Resource
(
this
.
mergeGroup
,
uri
,
Status
.
DELETED_BY_US
));
case
'
AA
'
:
return
merge
.
push
(
new
Resource
(
this
.
mergeGroup
,
uri
,
Status
.
BOTH_ADDED
));
case
'
UU
'
:
return
merge
.
push
(
new
Resource
(
this
.
mergeGroup
,
uri
,
Status
.
BOTH_MODIFIED
));
case
'
??
'
:
return
workingTree
.
push
(
new
Resource
(
this
.
work
spaceRoot
,
this
.
work
ingTreeGroup
,
uri
,
Status
.
UNTRACKED
));
case
'
!!
'
:
return
workingTree
.
push
(
new
Resource
(
this
.
work
spaceRoot
,
this
.
work
ingTreeGroup
,
uri
,
Status
.
IGNORED
));
case
'
DD
'
:
return
merge
.
push
(
new
Resource
(
this
.
workspaceRoot
,
this
.
mergeGroup
,
uri
,
Status
.
BOTH_DELETED
));
case
'
AU
'
:
return
merge
.
push
(
new
Resource
(
this
.
workspaceRoot
,
this
.
mergeGroup
,
uri
,
Status
.
ADDED_BY_US
));
case
'
UD
'
:
return
merge
.
push
(
new
Resource
(
this
.
workspaceRoot
,
this
.
mergeGroup
,
uri
,
Status
.
DELETED_BY_THEM
));
case
'
UA
'
:
return
merge
.
push
(
new
Resource
(
this
.
workspaceRoot
,
this
.
mergeGroup
,
uri
,
Status
.
ADDED_BY_THEM
));
case
'
DU
'
:
return
merge
.
push
(
new
Resource
(
this
.
workspaceRoot
,
this
.
mergeGroup
,
uri
,
Status
.
DELETED_BY_US
));
case
'
AA
'
:
return
merge
.
push
(
new
Resource
(
this
.
workspaceRoot
,
this
.
mergeGroup
,
uri
,
Status
.
BOTH_ADDED
));
case
'
UU
'
:
return
merge
.
push
(
new
Resource
(
this
.
workspaceRoot
,
this
.
mergeGroup
,
uri
,
Status
.
BOTH_MODIFIED
));
}
let
isModifiedInIndex
=
false
;
switch
(
raw
.
x
)
{
case
'
M
'
:
index
.
push
(
new
Resource
(
this
.
indexGroup
,
uri
,
Status
.
INDEX_MODIFIED
));
isModifiedInIndex
=
true
;
break
;
case
'
A
'
:
index
.
push
(
new
Resource
(
this
.
indexGroup
,
uri
,
Status
.
INDEX_ADDED
));
break
;
case
'
D
'
:
index
.
push
(
new
Resource
(
this
.
indexGroup
,
uri
,
Status
.
INDEX_DELETED
));
break
;
case
'
R
'
:
index
.
push
(
new
Resource
(
this
.
indexGroup
,
uri
,
Status
.
INDEX_RENAMED
,
renameUri
));
break
;
case
'
C
'
:
index
.
push
(
new
Resource
(
this
.
indexGroup
,
uri
,
Status
.
INDEX_COPIED
));
break
;
case
'
M
'
:
index
.
push
(
new
Resource
(
this
.
workspaceRoot
,
this
.
indexGroup
,
uri
,
Status
.
INDEX_MODIFIED
));
isModifiedInIndex
=
true
;
break
;
case
'
A
'
:
index
.
push
(
new
Resource
(
this
.
workspaceRoot
,
this
.
indexGroup
,
uri
,
Status
.
INDEX_ADDED
));
break
;
case
'
D
'
:
index
.
push
(
new
Resource
(
this
.
workspaceRoot
,
this
.
indexGroup
,
uri
,
Status
.
INDEX_DELETED
));
break
;
case
'
R
'
:
index
.
push
(
new
Resource
(
this
.
workspaceRoot
,
this
.
indexGroup
,
uri
,
Status
.
INDEX_RENAMED
,
renameUri
));
break
;
case
'
C
'
:
index
.
push
(
new
Resource
(
this
.
workspaceRoot
,
this
.
indexGroup
,
uri
,
Status
.
INDEX_COPIED
));
break
;
}
switch
(
raw
.
y
)
{
case
'
M
'
:
workingTree
.
push
(
new
Resource
(
this
.
workingTreeGroup
,
uri
,
Status
.
MODIFIED
,
renameUri
));
break
;
case
'
D
'
:
workingTree
.
push
(
new
Resource
(
this
.
workingTreeGroup
,
uri
,
Status
.
DELETED
,
renameUri
));
break
;
case
'
M
'
:
workingTree
.
push
(
new
Resource
(
this
.
work
spaceRoot
,
this
.
work
ingTreeGroup
,
uri
,
Status
.
MODIFIED
,
renameUri
));
break
;
case
'
D
'
:
workingTree
.
push
(
new
Resource
(
this
.
work
spaceRoot
,
this
.
work
ingTreeGroup
,
uri
,
Status
.
DELETED
,
renameUri
));
break
;
}
});
...
...
src/vs/vscode.d.ts
浏览文件 @
9b7a8813
...
...
@@ -4680,6 +4680,12 @@ declare module 'vscode' {
*/
readonly
strikeThrough
?:
boolean
;
/**
* Whether the [source control resource state](#SourceControlResourceState) should
* be striked-through in the UI.
*/
readonly
faded
?:
boolean
;
/**
* The light theme decorations.
*/
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
9b7a8813
...
...
@@ -284,7 +284,8 @@ export type SCMRawResource = [
string
/*resourceUri*/
,
modes
.
Command
/*command*/
,
string
[]
/*icons: light, dark*/
,
boolean
/*strike through*/
boolean
/*strike through*/
,
boolean
/*faded*/
];
export
abstract
class
MainThreadSCMShape
{
...
...
src/vs/workbench/api/node/extHostSCM.ts
浏览文件 @
9b7a8813
...
...
@@ -115,8 +115,9 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
}
const
strikeThrough
=
r
.
decorations
&&
!!
r
.
decorations
.
strikeThrough
;
const
faded
=
r
.
decorations
&&
!!
r
.
decorations
.
faded
;
return
[
handle
,
sourceUri
,
command
,
icons
,
strikeThrough
]
as
SCMRawResource
;
return
[
handle
,
sourceUri
,
command
,
icons
,
strikeThrough
,
faded
]
as
SCMRawResource
;
});
this
.
_proxy
.
$updateGroupResourceStates
(
this
.
_sourceControlHandle
,
this
.
_handle
,
rawResources
);
...
...
src/vs/workbench/api/node/mainThreadSCM.ts
浏览文件 @
9b7a8813
...
...
@@ -2,6 +2,7 @@
* 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
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
...
...
@@ -10,7 +11,7 @@ import Event, { Emitter } from 'vs/base/common/event';
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
ISCMService
,
ISCMProvider
,
ISCMResource
,
ISCMResourceGroup
}
from
'
vs/workbench/services/scm/common/scm
'
;
import
{
ISCMService
,
ISCMProvider
,
ISCMResource
,
ISCMResourceGroup
,
ISCMResourceDecorations
}
from
'
vs/workbench/services/scm/common/scm
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
ExtHostContext
,
MainThreadSCMShape
,
ExtHostSCMShape
,
SCMProviderFeatures
,
SCMRawResource
,
SCMGroupFeatures
}
from
'
./extHost.protocol
'
;
...
...
@@ -46,7 +47,7 @@ class MainThreadSCMResource implements ISCMResource {
public
sourceUri
:
URI
,
public
command
:
Command
|
undefined
,
public
resourceGroup
:
ISCMResourceGroup
,
public
decorations
public
decorations
:
ISCMResourceDecorations
)
{
}
toJSON
():
any
{
...
...
@@ -144,13 +145,14 @@ class MainThreadSCMProvider implements ISCMProvider {
}
group
.
resources
=
resources
.
map
(
rawResource
=>
{
const
[
handle
,
sourceUri
,
command
,
icons
,
strikeThrough
]
=
rawResource
;
const
[
handle
,
sourceUri
,
command
,
icons
,
strikeThrough
,
faded
]
=
rawResource
;
const
icon
=
icons
[
0
];
const
iconDark
=
icons
[
1
]
||
icon
;
const
decorations
=
{
icon
:
icon
&&
URI
.
parse
(
icon
),
iconDark
:
iconDark
&&
URI
.
parse
(
iconDark
),
strikeThrough
strikeThrough
,
faded
};
return
new
MainThreadSCMResource
(
...
...
src/vs/workbench/parts/scm/electron-browser/media/scmViewlet.css
浏览文件 @
9b7a8813
...
...
@@ -36,6 +36,10 @@
height
:
100%
;
}
.scm-viewlet
.monaco-list-row
>
.resource.faded
{
opacity
:
0.7
;
}
.scm-viewlet
.monaco-list-row
>
.resource
>
.name
{
flex
:
1
;
overflow
:
hidden
;
...
...
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
浏览文件 @
9b7a8813
...
...
@@ -117,6 +117,7 @@ class ResourceGroupRenderer implements IRenderer<ISCMResourceGroup, ResourceGrou
}
interface
ResourceTemplate
{
element
:
HTMLElement
;
name
:
HTMLElement
;
fileLabel
:
FileLabel
;
decorationIcon
:
HTMLElement
;
...
...
@@ -170,7 +171,7 @@ class ResourceRenderer implements IRenderer<ISCMResource, ResourceTemplate> {
const
decorationIcon
=
append
(
element
,
$
(
'
.decoration-icon
'
));
return
{
name
,
fileLabel
,
decorationIcon
,
actionBar
};
return
{
element
,
name
,
fileLabel
,
decorationIcon
,
actionBar
};
}
renderElement
(
resource
:
ISCMResource
,
index
:
number
,
template
:
ResourceTemplate
):
void
{
...
...
@@ -179,6 +180,7 @@ class ResourceRenderer implements IRenderer<ISCMResource, ResourceTemplate> {
template
.
actionBar
.
context
=
resource
;
template
.
actionBar
.
push
(
this
.
scmMenus
.
getResourceActions
(
resource
));
toggleClass
(
template
.
name
,
'
strike-through
'
,
resource
.
decorations
.
strikeThrough
);
toggleClass
(
template
.
element
,
'
faded
'
,
resource
.
decorations
.
faded
);
const
theme
=
this
.
themeService
.
getTheme
();
const
icon
=
theme
.
type
===
LIGHT
?
resource
.
decorations
.
icon
:
resource
.
decorations
.
iconDark
;
...
...
src/vs/workbench/services/scm/common/scm.ts
浏览文件 @
9b7a8813
...
...
@@ -23,6 +23,7 @@ export interface ISCMResourceDecorations {
icon
?:
URI
;
iconDark
?:
URI
;
strikeThrough
?:
boolean
;
faded
?:
boolean
;
}
export
interface
ISCMResource
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录