Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a13fdcbf
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,发现更多精彩内容 >>
提交
a13fdcbf
编写于
9月 28, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Repository.close
fixes #35041
上级
38551e71
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
90 addition
and
28 deletion
+90
-28
extensions/git/package.json
extensions/git/package.json
+12
-0
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+5
-0
extensions/git/src/model.ts
extensions/git/src/model.ts
+10
-0
src/vs/platform/actions/common/actions.ts
src/vs/platform/actions/common/actions.ts
+22
-25
src/vs/platform/actions/electron-browser/menusExtensionPoint.ts
.../platform/actions/electron-browser/menusExtensionPoint.ts
+6
-0
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
+35
-3
未找到文件。
extensions/git/package.json
浏览文件 @
a13fdcbf
...
...
@@ -36,6 +36,11 @@
"dark"
:
"resources/icons/dark/git.svg"
}
},
{
"command"
:
"git.close"
,
"title"
:
"%command.close%"
,
"category"
:
"Git"
},
{
"command"
:
"git.refresh"
,
"title"
:
"%command.refresh%"
,
...
...
@@ -565,6 +570,13 @@
"when"
:
"config.git.enabled && scmProvider == git"
}
],
"scm/sourceControl"
:
[
{
"command"
:
"git.close"
,
"group"
:
"navigation"
,
"when"
:
"config.git.enabled && scmProvider == git"
}
],
"scm/resourceGroup/context"
:
[
{
"command"
:
"git.stageAll"
,
...
...
extensions/git/src/commands.ts
浏览文件 @
a13fdcbf
...
...
@@ -358,6 +358,11 @@ export class CommandCenter {
await
this
.
model
.
tryOpenRepository
(
path
);
}
@
command
(
'
git.close
'
,
{
repository
:
true
})
async
close
(
repository
:
Repository
):
Promise
<
void
>
{
this
.
model
.
close
(
repository
);
}
@
command
(
'
git.openFile
'
)
async
openFile
(
arg
?:
Resource
|
Uri
,
...
resourceStates
:
SourceControlResourceState
[]):
Promise
<
void
>
{
const
preserveFocus
=
arg
instanceof
Resource
;
...
...
extensions/git/src/model.ts
浏览文件 @
a13fdcbf
...
...
@@ -230,6 +230,16 @@ export class Model {
this
.
_onDidOpenRepository
.
fire
(
repository
);
}
close
(
repository
:
Repository
):
void
{
const
openRepository
=
this
.
getOpenRepository
(
repository
);
if
(
!
openRepository
)
{
return
;
}
openRepository
.
dispose
();
}
async
pickRepository
():
Promise
<
Repository
|
undefined
>
{
if
(
this
.
openRepositories
.
length
===
0
)
{
throw
new
Error
(
localize
(
'
no repositories
'
,
"
There are no available repositories
"
));
...
...
src/vs/platform/actions/common/actions.ts
浏览文件 @
a13fdcbf
...
...
@@ -37,31 +37,28 @@ export interface IMenuItem {
export
class
MenuId
{
static
readonly
EditorTitle
=
new
MenuId
(
'
1
'
);
static
readonly
EditorTitleContext
=
new
MenuId
(
'
2
'
);
static
readonly
EditorContext
=
new
MenuId
(
'
3
'
);
static
readonly
ExplorerContext
=
new
MenuId
(
'
4
'
);
static
readonly
ProblemsPanelContext
=
new
MenuId
(
'
5
'
);
static
readonly
DebugVariablesContext
=
new
MenuId
(
'
6
'
);
static
readonly
DebugWatchContext
=
new
MenuId
(
'
7
'
);
static
readonly
DebugCallStackContext
=
new
MenuId
(
'
8
'
);
static
readonly
DebugBreakpointsContext
=
new
MenuId
(
'
9
'
);
static
readonly
DebugConsoleContext
=
new
MenuId
(
'
10
'
);
static
readonly
SCMTitle
=
new
MenuId
(
'
11
'
);
static
readonly
SCMResourceGroupContext
=
new
MenuId
(
'
12
'
);
static
readonly
SCMResourceContext
=
new
MenuId
(
'
13
'
);
static
readonly
CommandPalette
=
new
MenuId
(
'
14
'
);
static
readonly
ViewTitle
=
new
MenuId
(
'
15
'
);
static
readonly
ViewItemContext
=
new
MenuId
(
'
16
'
);
static
readonly
TouchBarContext
=
new
MenuId
(
'
17
'
);
constructor
(
private
_id
:
string
)
{
}
get
id
():
string
{
return
this
.
_id
;
}
private
static
ID
=
1
;
static
readonly
EditorTitle
=
new
MenuId
();
static
readonly
EditorTitleContext
=
new
MenuId
();
static
readonly
EditorContext
=
new
MenuId
();
static
readonly
ExplorerContext
=
new
MenuId
();
static
readonly
ProblemsPanelContext
=
new
MenuId
();
static
readonly
DebugVariablesContext
=
new
MenuId
();
static
readonly
DebugWatchContext
=
new
MenuId
();
static
readonly
DebugCallStackContext
=
new
MenuId
();
static
readonly
DebugBreakpointsContext
=
new
MenuId
();
static
readonly
DebugConsoleContext
=
new
MenuId
();
static
readonly
SCMTitle
=
new
MenuId
();
static
readonly
SCMSourceControl
=
new
MenuId
();
static
readonly
SCMResourceGroupContext
=
new
MenuId
();
static
readonly
SCMResourceContext
=
new
MenuId
();
static
readonly
CommandPalette
=
new
MenuId
();
static
readonly
ViewTitle
=
new
MenuId
();
static
readonly
ViewItemContext
=
new
MenuId
();
static
readonly
TouchBarContext
=
new
MenuId
();
readonly
id
:
string
=
String
(
MenuId
.
ID
++
);
}
export
interface
IMenuActionOptions
{
...
...
src/vs/platform/actions/electron-browser/menusExtensionPoint.ts
浏览文件 @
a13fdcbf
...
...
@@ -37,6 +37,7 @@ namespace schema {
case
'
editor/title/context
'
:
return
MenuId
.
EditorTitleContext
;
case
'
debug/callstack/context
'
:
return
MenuId
.
DebugCallStackContext
;
case
'
scm/title
'
:
return
MenuId
.
SCMTitle
;
case
'
scm/sourceControl
'
:
return
MenuId
.
SCMSourceControl
;
case
'
scm/resourceGroup/context
'
:
return
MenuId
.
SCMResourceGroupContext
;
case
'
scm/resourceState/context
'
:
return
MenuId
.
SCMResourceContext
;
case
'
view/title
'
:
return
MenuId
.
ViewTitle
;
...
...
@@ -140,6 +141,11 @@ namespace schema {
type
:
'
array
'
,
items
:
menuItem
},
'
scm/sourceControl
'
:
{
description
:
localize
(
'
menus.scmSourceControl
'
,
"
The Source Control menu
"
),
type
:
'
array
'
,
items
:
menuItem
},
'
scm/resourceGroup/context
'
:
{
description
:
localize
(
'
menus.resourceGroupContext
'
,
"
The Source Control resource group context menu
"
),
type
:
'
array
'
,
...
...
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
浏览文件 @
a13fdcbf
...
...
@@ -32,9 +32,9 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
IListService
}
from
'
vs/platform/list/browser/listService
'
;
import
{
MenuItemAction
}
from
'
vs/platform/actions/common/actions
'
;
import
{
MenuItemAction
,
IMenuService
,
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IAction
,
Action
,
IActionItem
,
ActionRunner
}
from
'
vs/base/common/actions
'
;
import
{
MenuItemActionItem
}
from
'
vs/platform/actions/browser/menuItemActionItem
'
;
import
{
MenuItemActionItem
,
fillInActions
}
from
'
vs/platform/actions/browser/menuItemActionItem
'
;
import
{
SCMMenus
}
from
'
./scmMenus
'
;
import
{
ActionBar
,
IActionItemProvider
,
Separator
,
ActionItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
IThemeService
,
LIGHT
}
from
'
vs/platform/theme/common/themeService
'
;
...
...
@@ -219,7 +219,9 @@ class MainPanel extends ViewletPanel {
@
IContextMenuService
protected
contextMenuService
:
IContextMenuService
,
@
ISCMService
protected
scmService
:
ISCMService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IThemeService
private
themeService
:
IThemeService
@
IThemeService
private
themeService
:
IThemeService
,
@
IContextKeyService
private
contextKeyService
:
IContextKeyService
,
@
IMenuService
private
menuService
:
IMenuService
)
{
super
(
localize
(
'
scm providers
'
,
"
Source Control Providers
"
),
{},
keybindingService
,
contextMenuService
);
this
.
updateBodySize
();
...
...
@@ -265,6 +267,8 @@ class MainPanel extends ViewletPanel {
this
.
disposables
.
push
(
this
.
list
);
this
.
disposables
.
push
(
attachListStyler
(
this
.
list
,
this
.
themeService
));
this
.
list
.
onSelectionChange
(
this
.
onListSelectionChange
,
this
,
this
.
disposables
);
this
.
list
.
onContextMenu
(
this
.
onListContextMenu
,
this
,
this
.
disposables
);
this
.
viewModel
.
onDidSplice
(({
index
,
deleteCount
,
elements
})
=>
this
.
splice
(
index
,
deleteCount
,
elements
),
null
,
this
.
disposables
);
this
.
splice
(
0
,
0
,
this
.
viewModel
.
repositories
);
}
...
...
@@ -286,6 +290,34 @@ class MainPanel extends ViewletPanel {
}
}
private
onListContextMenu
(
e
:
IListContextMenuEvent
<
ISCMRepository
>
):
void
{
const
repository
=
e
.
element
;
const
contextKeyService
=
this
.
contextKeyService
.
createScoped
();
const
scmProviderKey
=
contextKeyService
.
createKey
<
string
|
undefined
>
(
'
scmProvider
'
,
void
0
);
scmProviderKey
.
set
(
repository
.
provider
.
contextValue
);
const
menu
=
this
.
menuService
.
createMenu
(
MenuId
.
SCMSourceControl
,
contextKeyService
);
const
primary
:
IAction
[]
=
[];
const
secondary
:
IAction
[]
=
[];
const
result
=
{
primary
,
secondary
};
fillInActions
(
menu
,
{
shouldForwardArgs
:
true
},
result
,
g
=>
g
===
'
inline
'
);
menu
.
dispose
();
contextKeyService
.
dispose
();
if
(
secondary
.
length
===
0
)
{
return
;
}
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
e
.
anchor
,
getActions
:
()
=>
TPromise
.
as
(
secondary
),
getActionsContext
:
()
=>
repository
.
provider
});
}
private
onListSelectionChange
(
e
:
IListEvent
<
ISCMRepository
>
):
void
{
// select one repository if the selected one is gone
if
(
e
.
elements
.
length
===
0
&&
this
.
list
.
length
>
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录