Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
f5658f09
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,发现更多精彩内容 >>
提交
f5658f09
编写于
9月 14, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
scm.acceptInput command
fixes #42862
上级
18f72715
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
35 addition
and
21 deletion
+35
-21
src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts
.../workbench/parts/scm/electron-browser/scm.contribution.ts
+28
-0
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
+7
-21
未找到文件。
src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts
浏览文件 @
f5658f09
...
@@ -20,6 +20,11 @@ import { SCMViewlet } from 'vs/workbench/parts/scm/electron-browser/scmViewlet';
...
@@ -20,6 +20,11 @@ import { SCMViewlet } from 'vs/workbench/parts/scm/electron-browser/scmViewlet';
import
{
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
import
{
ContextKeyDefinedExpr
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ISCMRepository
}
from
'
vs/workbench/services/scm/common/scm
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
KeybindingsRegistry
,
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
class
OpenSCMViewletAction
extends
ToggleViewletAction
{
class
OpenSCMViewletAction
extends
ToggleViewletAction
{
...
@@ -99,3 +104,26 @@ MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
...
@@ -99,3 +104,26 @@ MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
},
},
order
:
3
order
:
3
});
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
scm.acceptInput
'
,
description
:
{
description
:
localize
(
'
scm accept
'
,
"
SCM: Accept Input
"
),
args
:
[]
},
weight
:
KeybindingWeight
.
WorkbenchContrib
,
when
:
new
ContextKeyDefinedExpr
(
'
scmRepository
'
),
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
Enter
,
handler
:
accessor
=>
{
const
contextKeyService
=
accessor
.
get
(
IContextKeyService
);
const
context
=
contextKeyService
.
getContext
(
document
.
activeElement
);
const
repository
=
context
.
getValue
<
ISCMRepository
>
(
'
scmRepository
'
);
if
(
!
repository
||
!
repository
.
provider
.
acceptInputCommand
)
{
return
TPromise
.
as
(
null
);
}
const
id
=
repository
.
provider
.
acceptInputCommand
.
id
;
const
args
=
repository
.
provider
.
acceptInputCommand
.
arguments
;
const
commandService
=
accessor
.
get
(
ICommandService
);
return
commandService
.
executeCommand
(
id
,
...
args
);
}
});
\ No newline at end of file
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
浏览文件 @
f5658f09
...
@@ -39,12 +39,9 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
...
@@ -39,12 +39,9 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
InputBox
,
MessageType
}
from
'
vs/base/browser/ui/inputbox/inputBox
'
;
import
{
InputBox
,
MessageType
}
from
'
vs/base/browser/ui/inputbox/inputBox
'
;
import
{
StandardKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
Command
}
from
'
vs/editor/common/modes
'
;
import
{
Command
}
from
'
vs/editor/common/modes
'
;
import
{
renderOcticons
}
from
'
vs/base/browser/ui/octiconLabel/octiconLabel
'
;
import
{
renderOcticons
}
from
'
vs/base/browser/ui/octiconLabel/octiconLabel
'
;
import
{
StandardMouseEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
StandardMouseEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
format
}
from
'
vs/base/common/strings
'
;
import
{
format
}
from
'
vs/base/common/strings
'
;
import
{
ISpliceable
,
ISequence
,
ISplice
}
from
'
vs/base/common/sequence
'
;
import
{
ISpliceable
,
ISequence
,
ISplice
}
from
'
vs/base/common/sequence
'
;
import
{
firstIndex
}
from
'
vs/base/common/arrays
'
;
import
{
firstIndex
}
from
'
vs/base/common/arrays
'
;
...
@@ -748,6 +745,7 @@ export class RepositoryPanel extends ViewletPanel {
...
@@ -748,6 +745,7 @@ export class RepositoryPanel extends ViewletPanel {
private
list
:
List
<
ISCMResourceGroup
|
ISCMResource
>
;
private
list
:
List
<
ISCMResourceGroup
|
ISCMResource
>
;
private
menus
:
SCMMenus
;
private
menus
:
SCMMenus
;
private
visibilityDisposables
:
IDisposable
[]
=
[];
private
visibilityDisposables
:
IDisposable
[]
=
[];
protected
contextKeyService
:
IContextKeyService
;
constructor
(
constructor
(
id
:
string
,
id
:
string
,
...
@@ -762,12 +760,15 @@ export class RepositoryPanel extends ViewletPanel {
...
@@ -762,12 +760,15 @@ export class RepositoryPanel extends ViewletPanel {
@
IEditorService
protected
editorService
:
IEditorService
,
@
IEditorService
protected
editorService
:
IEditorService
,
@
IInstantiationService
protected
instantiationService
:
IInstantiationService
,
@
IInstantiationService
protected
instantiationService
:
IInstantiationService
,
@
IConfigurationService
protected
configurationService
:
IConfigurationService
,
@
IConfigurationService
protected
configurationService
:
IConfigurationService
,
@
IContextKeyService
protected
contextKeyService
:
IContextKeyService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IMenuService
protected
menuService
:
IMenuService
@
IMenuService
protected
menuService
:
IMenuService
)
{
)
{
super
({
id
,
title
:
repository
.
provider
.
label
},
keybindingService
,
contextMenuService
,
configurationService
);
super
({
id
,
title
:
repository
.
provider
.
label
},
keybindingService
,
contextMenuService
,
configurationService
);
this
.
menus
=
instantiationService
.
createInstance
(
SCMMenus
,
repository
.
provider
);
this
.
menus
=
instantiationService
.
createInstance
(
SCMMenus
,
repository
.
provider
);
this
.
menus
.
onDidChangeTitle
(
this
.
_onDidChangeTitleArea
.
fire
,
this
.
_onDidChangeTitleArea
,
this
.
disposables
);
this
.
menus
.
onDidChangeTitle
(
this
.
_onDidChangeTitleArea
.
fire
,
this
.
_onDidChangeTitleArea
,
this
.
disposables
);
this
.
contextKeyService
=
contextKeyService
.
createScoped
(
this
.
element
);
this
.
contextKeyService
.
createKey
(
'
scmRepository
'
,
repository
);
}
}
render
():
void
{
render
():
void
{
...
@@ -819,7 +820,7 @@ export class RepositoryPanel extends ViewletPanel {
...
@@ -819,7 +820,7 @@ export class RepositoryPanel extends ViewletPanel {
this
.
inputBoxContainer
=
append
(
container
,
$
(
'
.scm-editor
'
));
this
.
inputBoxContainer
=
append
(
container
,
$
(
'
.scm-editor
'
));
const
updatePlaceholder
=
()
=>
{
const
updatePlaceholder
=
()
=>
{
const
placeholder
=
format
(
this
.
repository
.
input
.
placeholder
,
platform
.
isMacintosh
?
'
Cmd+Enter
'
:
'
Ctrl+Enter
'
);
const
placeholder
=
format
(
this
.
repository
.
input
.
placeholder
,
this
.
keybindingService
.
lookupKeybinding
(
'
scm.acceptInput
'
).
getLabel
()
);
this
.
inputBox
.
setPlaceHolder
(
placeholder
);
this
.
inputBox
.
setPlaceHolder
(
placeholder
);
};
};
...
@@ -854,14 +855,10 @@ export class RepositoryPanel extends ViewletPanel {
...
@@ -854,14 +855,10 @@ export class RepositoryPanel extends ViewletPanel {
updatePlaceholder
();
updatePlaceholder
();
this
.
repository
.
input
.
onDidChangePlaceholder
(
updatePlaceholder
,
null
,
this
.
disposables
);
this
.
repository
.
input
.
onDidChangePlaceholder
(
updatePlaceholder
,
null
,
this
.
disposables
);
this
.
keybindingService
.
onDidUpdateKeybindings
(
updatePlaceholder
,
null
,
this
.
disposables
);
this
.
disposables
.
push
(
this
.
inputBox
.
onDidHeightChange
(()
=>
this
.
layoutBody
()));
this
.
disposables
.
push
(
this
.
inputBox
.
onDidHeightChange
(()
=>
this
.
layoutBody
()));
chain
(
domEvent
(
this
.
inputBox
.
inputElement
,
'
keydown
'
))
.
map
(
e
=>
new
StandardKeyboardEvent
(
e
))
.
filter
(
e
=>
e
.
equals
(
KeyMod
.
CtrlCmd
|
KeyCode
.
Enter
)
||
e
.
equals
(
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_S
))
.
on
(
this
.
onDidAcceptInput
,
this
,
this
.
disposables
);
if
(
this
.
repository
.
provider
.
onDidChangeCommitTemplate
)
{
if
(
this
.
repository
.
provider
.
onDidChangeCommitTemplate
)
{
this
.
repository
.
provider
.
onDidChangeCommitTemplate
(
this
.
updateInputBox
,
this
,
this
.
disposables
);
this
.
repository
.
provider
.
onDidChangeCommitTemplate
(
this
.
updateInputBox
,
this
,
this
.
disposables
);
}
}
...
@@ -996,17 +993,6 @@ export class RepositoryPanel extends ViewletPanel {
...
@@ -996,17 +993,6 @@ export class RepositoryPanel extends ViewletPanel {
this
.
inputBox
.
value
=
this
.
repository
.
provider
.
commitTemplate
;
this
.
inputBox
.
value
=
this
.
repository
.
provider
.
commitTemplate
;
}
}
private
onDidAcceptInput
():
void
{
if
(
!
this
.
repository
.
provider
.
acceptInputCommand
)
{
return
;
}
const
id
=
this
.
repository
.
provider
.
acceptInputCommand
.
id
;
const
args
=
this
.
repository
.
provider
.
acceptInputCommand
.
arguments
;
this
.
commandService
.
executeCommand
(
id
,
...
args
);
}
dispose
():
void
{
dispose
():
void
{
this
.
visibilityDisposables
=
dispose
(
this
.
visibilityDisposables
);
this
.
visibilityDisposables
=
dispose
(
this
.
visibilityDisposables
);
super
.
dispose
();
super
.
dispose
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录