Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ceafebde
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,发现更多精彩内容 >>
提交
ceafebde
编写于
12月 01, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
scm viewlet inline actions
上级
7f8d9c9b
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
157 addition
and
32 deletion
+157
-32
extensions/git/package.json
extensions/git/package.json
+44
-4
extensions/git/resources/icons/dark/stage.svg
extensions/git/resources/icons/dark/stage.svg
+1
-0
extensions/git/resources/icons/dark/unstage.svg
extensions/git/resources/icons/dark/unstage.svg
+1
-0
extensions/git/resources/icons/light/stage.svg
extensions/git/resources/icons/light/stage.svg
+1
-0
extensions/git/resources/icons/light/unstage.svg
extensions/git/resources/icons/light/unstage.svg
+1
-0
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+21
-1
src/vs/workbench/parts/scm/browser/media/scmViewlet.css
src/vs/workbench/parts/scm/browser/media/scmViewlet.css
+34
-5
src/vs/workbench/parts/scm/browser/scmMenus.ts
src/vs/workbench/parts/scm/browser/scmMenus.ts
+24
-8
src/vs/workbench/parts/scm/browser/scmViewlet.ts
src/vs/workbench/parts/scm/browser/scmViewlet.ts
+30
-14
未找到文件。
extensions/git/package.json
浏览文件 @
ceafebde
...
...
@@ -38,22 +38,38 @@
{
"command"
:
"git.stage"
,
"title"
:
"Stage"
,
"category"
:
"Git"
"category"
:
"Git"
,
"icon"
:
{
"light"
:
"resources/icons/light/stage.svg"
,
"dark"
:
"resources/icons/dark/stage.svg"
}
},
{
"command"
:
"git.stage-all"
,
"title"
:
"Stage All"
,
"category"
:
"Git"
"category"
:
"Git"
,
"icon"
:
{
"light"
:
"resources/icons/light/stage.svg"
,
"dark"
:
"resources/icons/dark/stage.svg"
}
},
{
"command"
:
"git.unstage"
,
"title"
:
"Unstage"
,
"category"
:
"Git"
"category"
:
"Git"
,
"icon"
:
{
"light"
:
"resources/icons/light/unstage.svg"
,
"dark"
:
"resources/icons/dark/unstage.svg"
}
},
{
"command"
:
"git.unstage-all"
,
"title"
:
"Unstage All"
,
"category"
:
"Git"
"category"
:
"Git"
,
"icon"
:
{
"light"
:
"resources/icons/light/unstage.svg"
,
"dark"
:
"resources/icons/dark/unstage.svg"
}
}
],
"menus"
:
{
...
...
@@ -63,24 +79,48 @@
"group"
:
"navigation"
}
],
"scm/git/index/group"
:
[
{
"command"
:
"git.unstage-all"
,
"group"
:
"navigation"
}
],
"scm/git/index/group/context"
:
[
{
"command"
:
"git.unstage-all"
,
"group"
:
"navigation"
}
],
"scm/git/index/resource"
:
[
{
"command"
:
"git.unstage"
,
"group"
:
"navigation"
}
],
"scm/git/index/resource/context"
:
[
{
"command"
:
"git.unstage"
,
"group"
:
"navigation"
}
],
"scm/git/workingTree/group"
:
[
{
"command"
:
"git.stage-all"
,
"group"
:
"navigation"
}
],
"scm/git/workingTree/group/context"
:
[
{
"command"
:
"git.stage-all"
,
"group"
:
"navigation"
}
],
"scm/git/workingTree/resource"
:
[
{
"command"
:
"git.stage"
,
"group"
:
"navigation"
}
],
"scm/git/workingTree/resource/context"
:
[
{
"command"
:
"git.stage"
,
...
...
extensions/git/resources/icons/dark/stage.svg
0 → 100644
浏览文件 @
ceafebde
<svg
width=
"16"
height=
"16"
xmlns=
"http://www.w3.org/2000/svg"
><title>
Layer 1
</title><rect
height=
"11"
width=
"3"
y=
"3"
x=
"7"
fill=
"#C5C5C5"
/><rect
height=
"3"
width=
"11"
y=
"7"
x=
"3"
fill=
"#C5C5C5"
/></svg>
\ No newline at end of file
extensions/git/resources/icons/dark/unstage.svg
0 → 100644
浏览文件 @
ceafebde
<svg
width=
"16"
height=
"16"
xmlns=
"http://www.w3.org/2000/svg"
><title>
Layer 1
</title><rect
height=
"3"
width=
"11"
y=
"7"
x=
"3"
fill=
"#C5C5C5"
/></svg>
\ No newline at end of file
extensions/git/resources/icons/light/stage.svg
0 → 100644
浏览文件 @
ceafebde
<svg
width=
"16"
height=
"16"
xmlns=
"http://www.w3.org/2000/svg"
><title>
Layer 1
</title><rect
height=
"11"
width=
"3"
y=
"3"
x=
"7"
fill=
"#424242"
/><rect
height=
"3"
width=
"11"
y=
"7"
x=
"3"
fill=
"#424242"
/></svg>
\ No newline at end of file
extensions/git/resources/icons/light/unstage.svg
0 → 100644
浏览文件 @
ceafebde
<svg
width=
"16"
height=
"16"
xmlns=
"http://www.w3.org/2000/svg"
><title>
Layer 1
</title><rect
height=
"3"
width=
"11"
y=
"7"
x=
"3"
fill=
"#424242"
/></svg>
\ No newline at end of file
extensions/git/src/commands.ts
浏览文件 @
ceafebde
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
commands
,
Disposable
}
from
'
vscode
'
;
import
{
commands
,
Disposable
,
SCMResourceGroup
,
SCMResource
}
from
'
vscode
'
;
import
{
Model
}
from
'
./model
'
;
import
{
log
}
from
'
./util
'
;
...
...
@@ -20,9 +20,29 @@ function openChange(...args: any[]): void {
console
.
log
(
'
openChange
'
,
args
);
}
function
stage
(
resource
:
SCMResource
):
void
{
log
(
'
stage
'
,
resource
);
}
function
stageAll
(
resourceGroup
:
SCMResourceGroup
):
void
{
log
(
'
stage-all
'
,
resourceGroup
);
}
function
unstage
(
resource
:
SCMResource
):
void
{
log
(
'
unstage
'
,
resource
);
}
function
unstageAll
(
resourceGroup
:
SCMResourceGroup
):
void
{
log
(
'
unstage-all
'
,
resourceGroup
);
}
export
function
registerCommands
(
model
:
Model
):
Disposable
{
const
disposables
=
[
commands
.
registerCommand
(
'
git.refresh
'
,
refresh
(
model
)),
commands
.
registerCommand
(
'
git.stage
'
,
stage
),
commands
.
registerCommand
(
'
git.stage-all
'
,
stageAll
),
commands
.
registerCommand
(
'
git.unstage
'
,
unstage
),
commands
.
registerCommand
(
'
git.unstage-all
'
,
unstageAll
),
commands
.
registerCommand
(
'
git.open-change
'
,
openChange
)
];
...
...
src/vs/workbench/parts/scm/browser/media/scmViewlet.css
浏览文件 @
ceafebde
...
...
@@ -29,12 +29,41 @@
font-size
:
11px
;
font-weight
:
bold
;
text-transform
:
uppercase
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
.scm-viewlet
.monaco-list-row
>
.resource-group
>
.count-badge
{
.scm-viewlet
.monaco-list-row
>
.resource-group
:hover
>
.count
{
display
:
none
;
}
.scm-viewlet
.monaco-list-row
>
.resource-group
:not
(
:hover
)
>
.actions
{
display
:
none
;
}
.scm-viewlet
.monaco-list-row
>
.resource
{
display
:
flex
;
}
.scm-viewlet
.monaco-list-row
>
.resource
>
.name
{
flex
:
1
;
font-size
:
11px
;
font-weight
:
bold
;
text-transform
:
uppercase
;
cursor
:
default
;
overflow
:
hidden
;
}
.scm-viewlet
.monaco-list-row
>
.resource
>
.name
>
.monaco-icon-label
{
width
:
100%
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
.scm-viewlet
.monaco-list-row
>
.resource
>
.actions
.action-label
,
.scm-viewlet
.monaco-list-row
>
.resource-group
>
.actions
.action-label
{
width
:
16px
;
height
:
100%
;
background-position
:
50%
50%
;
background-repeat
:
no-repeat
;
}
.scm-viewlet
.monaco-list-row
>
.resource
:not
(
:hover
)
>
.actions
{
display
:
none
;
}
\ No newline at end of file
src/vs/workbench/parts/scm/browser/scmMenus.ts
浏览文件 @
ceafebde
...
...
@@ -63,23 +63,39 @@ export class SCMMenus implements IDisposable {
return
this
.
titleSecondaryActions
;
}
getResourceGroupActions
(
providerId
:
string
,
resourceGroupId
:
string
):
IAction
[]
{
const
menuId
=
new
SCMMenuId
(
providerId
,
resourceGroupId
,
SCMMenuType
.
ResourceGroup
,
false
);
getResourceGroupActions
(
resourceGroupId
:
string
):
IAction
[]
{
if
(
!
this
.
scmService
.
activeProvider
)
{
return
[];
}
const
menuId
=
new
SCMMenuId
(
this
.
scmService
.
activeProvider
.
id
,
resourceGroupId
,
SCMMenuType
.
ResourceGroup
,
false
);
return
this
.
getActions
(
menuId
);
}
getResourceGroupContextActions
(
providerId
:
string
,
resourceGroupId
:
string
):
IAction
[]
{
const
menuId
=
new
SCMMenuId
(
providerId
,
resourceGroupId
,
SCMMenuType
.
ResourceGroup
,
true
);
getResourceGroupContextActions
(
resourceGroupId
:
string
):
IAction
[]
{
if
(
!
this
.
scmService
.
activeProvider
)
{
return
[];
}
const
menuId
=
new
SCMMenuId
(
this
.
scmService
.
activeProvider
.
id
,
resourceGroupId
,
SCMMenuType
.
ResourceGroup
,
true
);
return
this
.
getActions
(
menuId
);
}
getResourceActions
(
providerId
:
string
,
resourceGroupId
:
string
):
IAction
[]
{
const
menuId
=
new
SCMMenuId
(
providerId
,
resourceGroupId
,
SCMMenuType
.
Resource
,
false
);
getResourceActions
(
resourceGroupId
:
string
):
IAction
[]
{
if
(
!
this
.
scmService
.
activeProvider
)
{
return
[];
}
const
menuId
=
new
SCMMenuId
(
this
.
scmService
.
activeProvider
.
id
,
resourceGroupId
,
SCMMenuType
.
Resource
,
false
);
return
this
.
getActions
(
menuId
);
}
getResourceContextActions
(
providerId
:
string
,
resourceGroupId
:
string
):
IAction
[]
{
const
menuId
=
new
SCMMenuId
(
providerId
,
resourceGroupId
,
SCMMenuType
.
Resource
,
true
);
getResourceContextActions
(
resourceGroupId
:
string
):
IAction
[]
{
if
(
!
this
.
scmService
.
activeProvider
)
{
return
[];
}
const
menuId
=
new
SCMMenuId
(
this
.
scmService
.
activeProvider
.
id
,
resourceGroupId
,
SCMMenuType
.
Resource
,
true
);
return
this
.
getActions
(
menuId
);
}
...
...
src/vs/workbench/parts/scm/browser/scmViewlet.ts
浏览文件 @
ceafebde
...
...
@@ -34,6 +34,7 @@ import { IMenuService } from 'vs/platform/actions/common/actions';
import
{
IAction
,
IActionItem
}
from
'
vs/base/common/actions
'
;
import
{
createActionItem
}
from
'
vs/platform/actions/browser/menuItemActionItem
'
;
import
{
SCMMenus
}
from
'
./scmMenus
'
;
import
{
ActionBar
,
IActionItemProvider
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
interface
SearchInputEvent
extends
Event
{
target
:
HTMLInputElement
;
...
...
@@ -43,6 +44,7 @@ interface SearchInputEvent extends Event {
interface
ResourceGroupTemplate
{
name
:
HTMLElement
;
count
:
CountBadge
;
actionBar
:
ActionBar
;
}
class
ResourceGroupRenderer
implements
IRenderer
<
ISCMResourceGroup
,
ResourceGroupTemplate
>
{
...
...
@@ -50,18 +52,27 @@ class ResourceGroupRenderer implements IRenderer<ISCMResourceGroup, ResourceGrou
static
TEMPLATE_ID
=
'
resource group
'
;
get
templateId
():
string
{
return
ResourceGroupRenderer
.
TEMPLATE_ID
;
}
constructor
(
private
scmMenus
:
SCMMenus
,
private
actionItemProvider
:
IActionItemProvider
)
{
}
renderTemplate
(
container
:
HTMLElement
):
ResourceGroupTemplate
{
const
element
=
append
(
container
,
$
(
'
.resource-group
'
));
const
name
=
append
(
element
,
$
(
'
.name
'
));
const
countContainer
=
append
(
element
,
$
(
'
div
'
));
const
countContainer
=
append
(
element
,
$
(
'
.count
'
));
const
count
=
new
CountBadge
(
countContainer
);
const
actionsContainer
=
append
(
element
,
$
(
'
.actions
'
));
const
actionBar
=
new
ActionBar
(
actionsContainer
,
{
actionItemProvider
:
this
.
actionItemProvider
});
return
{
name
,
count
};
return
{
name
,
count
,
actionBar
};
}
renderElement
(
group
:
ISCMResourceGroup
,
index
:
number
,
template
:
ResourceGroupTemplate
):
void
{
template
.
name
.
textContent
=
group
.
label
;
template
.
count
.
setCount
(
group
.
resources
.
length
);
template
.
actionBar
.
clear
();
template
.
actionBar
.
push
(
this
.
scmMenus
.
getResourceGroupActions
(
group
.
id
));
}
disposeTemplate
(
template
:
ResourceGroupTemplate
):
void
{
...
...
@@ -71,6 +82,7 @@ class ResourceGroupRenderer implements IRenderer<ISCMResourceGroup, ResourceGrou
interface
ResourceTemplate
{
fileLabel
:
FileLabel
;
actionBar
:
ActionBar
;
}
class
ResourceRenderer
implements
IRenderer
<
ISCMResource
,
ResourceTemplate
>
{
...
...
@@ -79,19 +91,27 @@ class ResourceRenderer implements IRenderer<ISCMResource, ResourceTemplate> {
get
templateId
():
string
{
return
ResourceRenderer
.
TEMPLATE_ID
;
}
constructor
(
private
scmMenus
:
SCMMenus
,
private
actionItemProvider
:
IActionItemProvider
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
)
{
}
renderTemplate
(
container
:
HTMLElement
):
ResourceTemplate
{
const
fileLabel
=
this
.
instantiationService
.
createInstance
(
FileLabel
,
container
,
void
0
);
const
element
=
append
(
container
,
$
(
'
.resource
'
));
const
name
=
append
(
element
,
$
(
'
.name
'
));
const
fileLabel
=
this
.
instantiationService
.
createInstance
(
FileLabel
,
name
,
void
0
);
const
actionsContainer
=
append
(
element
,
$
(
'
.actions
'
));
const
actionBar
=
new
ActionBar
(
actionsContainer
,
{
actionItemProvider
:
this
.
actionItemProvider
});
return
{
fileLabel
};
return
{
fileLabel
,
actionBar
};
}
renderElement
(
resource
:
ISCMResource
,
index
:
number
,
template
:
ResourceTemplate
):
void
{
template
.
fileLabel
.
setFile
(
resource
.
uri
);
template
.
actionBar
.
clear
();
template
.
actionBar
.
push
(
this
.
scmMenus
.
getResourceActions
(
resource
.
resourceGroupId
));
}
disposeTemplate
(
template
:
ResourceTemplate
):
void
{
...
...
@@ -176,9 +196,11 @@ export class SCMViewlet extends Viewlet {
this
.
listContainer
=
append
(
root
,
$
(
'
.scm-status.show-file-icons
'
));
const
delegate
=
new
Delegate
();
const
actionItemProvider
=
action
=>
this
.
getActionItem
(
action
);
this
.
list
=
new
List
(
this
.
listContainer
,
delegate
,
[
new
ResourceGroupRenderer
(),
this
.
instantiationService
.
createInstance
(
ResourceRenderer
)
new
ResourceGroupRenderer
(
this
.
menus
,
actionItemProvider
),
this
.
instantiationService
.
createInstance
(
ResourceRenderer
,
this
.
menus
,
actionItemProvider
)
]);
chain
(
this
.
list
.
onSelectionChange
)
...
...
@@ -254,21 +276,15 @@ export class SCMViewlet extends Viewlet {
}
private
onListContextMenu
(
e
:
IListMouseEvent
<
ISCMResourceGroup
|
ISCMResource
>
):
void
{
const
provider
=
this
.
scmService
.
activeProvider
;
if
(
!
provider
)
{
return
;
}
const
element
=
e
.
element
;
let
actions
:
IAction
[];
if
((
element
as
ISCMResource
).
uri
)
{
const
resource
=
element
as
ISCMResource
;
actions
=
this
.
menus
.
getResourceContextActions
(
provider
.
id
,
resource
.
resourceGroupId
);
actions
=
this
.
menus
.
getResourceContextActions
(
resource
.
resourceGroupId
);
}
else
{
const
resourceGroup
=
element
as
ISCMResourceGroup
;
actions
=
this
.
menus
.
getResourceGroupContextActions
(
provider
.
id
,
resourceGroup
.
id
);
actions
=
this
.
menus
.
getResourceGroupContextActions
(
resourceGroup
.
id
);
}
this
.
contextMenuService
.
showContextMenu
({
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录