Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
79aa19e9
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,发现更多精彩内容 >>
提交
79aa19e9
编写于
3月 27, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💥
scm input onDidAccept
上级
ee9982da
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
36 addition
and
39 deletion
+36
-39
extensions/git/src/main.ts
extensions/git/src/main.ts
+1
-0
extensions/git/src/scmProvider.ts
extensions/git/src/scmProvider.ts
+0
-4
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+5
-3
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-2
src/vs/workbench/api/node/extHostSCM.ts
src/vs/workbench/api/node/extHostSCM.ts
+15
-11
src/vs/workbench/api/node/mainThreadSCM.ts
src/vs/workbench/api/node/mainThreadSCM.ts
+4
-13
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
+1
-5
src/vs/workbench/services/scm/common/scm.ts
src/vs/workbench/services/scm/common/scm.ts
+2
-1
src/vs/workbench/services/scm/common/scmService.ts
src/vs/workbench/services/scm/common/scmService.ts
+7
-0
未找到文件。
extensions/git/src/main.ts
浏览文件 @
79aa19e9
...
...
@@ -76,6 +76,7 @@ async function init(context: ExtensionContext, disposables: Disposable[]): Promi
}
}
scm
.
inputBox
.
onDidAccept
(
commandCenter
.
commitWithInput
,
commandCenter
,
disposables
);
scm
.
inputBox
.
value
=
await
model
.
getCommitTemplate
();
}
...
...
extensions/git/src/scmProvider.ts
浏览文件 @
79aa19e9
...
...
@@ -50,10 +50,6 @@ export class GitSCMProvider implements SCMProvider {
return
this
.
commandCenter
.
open
(
resource
);
}
acceptChanges
():
ProviderResult
<
void
>
{
return
this
.
commandCenter
.
commitWithInput
();
}
getOriginalResource
(
uri
:
Uri
):
Uri
|
undefined
{
if
(
uri
.
scheme
!==
'
file
'
)
{
return
;
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
79aa19e9
...
...
@@ -733,9 +733,6 @@ declare module 'vscode' {
* @return A thenable which resolves when the resource is open.
*/
open
?(
resource
:
SCMResource
,
token
:
CancellationToken
):
ProviderResult
<
void
>
;
// TODO@joao: move to SCMInput?
acceptChanges
?(
token
:
CancellationToken
):
ProviderResult
<
void
>
;
}
/**
...
...
@@ -752,6 +749,11 @@ declare module 'vscode' {
* An [event](#Event) which fires when the input box value has changed.
*/
readonly
onDidChange
:
Event
<
string
>
;
/**
* An [event](#Event) which fires when the user has accepted the changes.
*/
readonly
onDidAccept
:
Event
<
string
>
;
}
export
namespace
scm
{
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
79aa19e9
...
...
@@ -253,7 +253,6 @@ export abstract class MainProcessExtensionServiceShape {
export
interface
SCMProviderFeatures
{
label
:
string
;
supportsOpen
:
boolean
;
supportsAcceptChanges
:
boolean
;
supportsOriginalResource
:
boolean
;
}
...
...
@@ -419,9 +418,9 @@ export abstract class ExtHostTerminalServiceShape {
export
abstract
class
ExtHostSCMShape
{
$open
(
id
:
string
,
uri
:
string
):
TPromise
<
void
>
{
throw
ni
();
}
$acceptChanges
(
id
:
string
):
TPromise
<
void
>
{
throw
ni
();
}
$getOriginalResource
(
id
:
string
,
uri
:
URI
):
TPromise
<
URI
>
{
throw
ni
();
}
$onInputBoxValueChange
(
value
:
string
):
TPromise
<
void
>
{
throw
ni
();
}
$onInputBoxAcceptChanges
():
TPromise
<
void
>
{
throw
ni
();
}
}
export
abstract
class
ExtHostTaskShape
{
...
...
src/vs/workbench/api/node/extHostSCM.ts
浏览文件 @
79aa19e9
...
...
@@ -49,6 +49,12 @@ class ExtHostSCMInputBox {
return
this
.
_onDidChange
.
event
;
}
private
_onDidAccept
=
new
Emitter
<
string
>
();
get
onDidAccept
():
Event
<
string
>
{
return
this
.
_onDidAccept
.
event
;
}
constructor
(
private
_proxy
:
MainThreadSCMShape
)
{
// noop
}
...
...
@@ -57,6 +63,10 @@ class ExtHostSCMInputBox {
this
.
updateValue
(
value
);
}
$onInputBoxAcceptChanges
():
void
{
this
.
_onDidAccept
.
fire
(
this
.
_value
);
}
private
updateValue
(
value
:
string
):
void
{
this
.
_value
=
value
;
this
.
_onDidChange
.
fire
(
value
);
...
...
@@ -97,7 +107,6 @@ export class ExtHostSCM {
this
.
_proxy
.
$register
(
providerId
,
{
label
:
provider
.
label
,
supportsOpen
:
!!
provider
.
open
,
supportsAcceptChanges
:
!!
provider
.
acceptChanges
,
supportsOriginalResource
:
!!
provider
.
getOriginalResource
});
...
...
@@ -158,16 +167,6 @@ export class ExtHostSCM {
return
asWinJsPromise
(
token
=>
provider
.
open
(
resource
,
token
));
}
$acceptChanges
(
providerId
:
string
):
TPromise
<
void
>
{
const
provider
=
this
.
_providers
[
providerId
];
if
(
!
provider
)
{
return
TPromise
.
as
(
null
);
}
return
asWinJsPromise
(
token
=>
provider
.
acceptChanges
(
token
));
}
$getOriginalResource
(
id
:
string
,
uri
:
URI
):
TPromise
<
URI
>
{
const
provider
=
this
.
_providers
[
id
];
...
...
@@ -182,4 +181,9 @@ export class ExtHostSCM {
this
.
_inputBox
.
$onInputBoxValueChange
(
value
);
return
TPromise
.
as
(
null
);
}
$onInputBoxAcceptChanges
():
TPromise
<
void
>
{
this
.
_inputBox
.
$onInputBoxAcceptChanges
();
return
TPromise
.
as
(
null
);
}
}
src/vs/workbench/api/node/mainThreadSCM.ts
浏览文件 @
79aa19e9
...
...
@@ -52,14 +52,6 @@ class MainThreadSCMProvider implements ISCMProvider {
return
this
.
proxy
.
$open
(
this
.
id
,
resource
.
uri
.
toString
());
}
acceptChanges
():
TPromise
<
void
>
{
if
(
!
this
.
features
.
supportsAcceptChanges
)
{
return
TPromise
.
as
(
null
);
}
return
this
.
proxy
.
$acceptChanges
(
this
.
id
);
}
getOriginalResource
(
uri
:
URI
):
TPromise
<
URI
>
{
if
(
!
this
.
features
.
supportsOriginalResource
)
{
return
TPromise
.
as
(
null
);
...
...
@@ -116,7 +108,7 @@ export class MainThreadSCM extends MainThreadSCMShape {
private
proxy
:
ExtHostSCMShape
;
private
providers
:
{
[
id
:
string
]:
MainThreadSCMProvider
;
}
=
Object
.
create
(
null
);
private
inputBoxListener
:
IDisposable
;
private
inputBoxListener
s
:
IDisposable
[]
=
[]
;
constructor
(
@
IThreadService
threadService
:
IThreadService
,
...
...
@@ -126,9 +118,8 @@ export class MainThreadSCM extends MainThreadSCMShape {
super
();
this
.
proxy
=
threadService
.
get
(
ExtHostContext
.
ExtHostSCM
);
this
.
inputBoxListener
=
this
.
scmService
.
input
.
onDidChange
(
value
=>
{
this
.
proxy
.
$onInputBoxValueChange
(
value
);
});
this
.
scmService
.
input
.
onDidChange
(
this
.
proxy
.
$onInputBoxValueChange
,
this
.
proxy
,
this
.
inputBoxListeners
);
this
.
scmService
.
input
.
onDidAccept
(
this
.
proxy
.
$onInputBoxAcceptChanges
,
this
.
proxy
,
this
.
inputBoxListeners
);
}
$register
(
id
:
string
,
features
:
SCMProviderFeatures
):
void
{
...
...
@@ -165,6 +156,6 @@ export class MainThreadSCM extends MainThreadSCMShape {
.
forEach
(
id
=>
this
.
providers
[
id
].
dispose
());
this
.
providers
=
Object
.
create
(
null
);
this
.
inputBoxListener
=
dispose
(
this
.
inputBoxListener
);
this
.
inputBoxListener
s
=
dispose
(
this
.
inputBoxListeners
);
}
}
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
浏览文件 @
79aa19e9
...
...
@@ -257,7 +257,7 @@ export class SCMViewlet extends Viewlet {
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
.
acceptChanges
,
this
,
this
.
disposables
);
.
on
(
this
.
scmService
.
input
.
acceptChanges
,
this
.
scmService
.
input
,
this
.
disposables
);
this
.
listContainer
=
append
(
root
,
$
(
'
.scm-status.show-file-icons
'
));
const
delegate
=
new
Delegate
();
...
...
@@ -334,10 +334,6 @@ export class SCMViewlet extends Viewlet {
this
.
scmService
.
activeProvider
.
open
(
e
);
}
private
acceptChanges
():
void
{
this
.
scmService
.
activeProvider
.
acceptChanges
();
}
getActions
():
IAction
[]
{
return
this
.
menus
.
getTitleActions
();
}
...
...
src/vs/workbench/services/scm/common/scm.ts
浏览文件 @
79aa19e9
...
...
@@ -46,13 +46,14 @@ export interface ISCMProvider extends IDisposable {
readonly
state
?:
string
;
open
(
uri
:
ISCMResource
):
TPromise
<
void
>
;
acceptChanges
():
TPromise
<
void
>
;
getOriginalResource
(
uri
:
URI
):
TPromise
<
URI
>
;
}
export
interface
ISCMInput
{
value
:
string
;
readonly
onDidChange
:
Event
<
string
>
;
readonly
onDidAccept
:
Event
<
string
>
;
acceptChanges
():
void
;
}
export
interface
ISCMService
{
...
...
src/vs/workbench/services/scm/common/scmService.ts
浏览文件 @
79aa19e9
...
...
@@ -26,6 +26,13 @@ class SCMInput implements ISCMInput {
private
_onDidChange
=
new
Emitter
<
string
>
();
get
onDidChange
():
Event
<
string
>
{
return
this
.
_onDidChange
.
event
;
}
private
_onDidAccept
=
new
Emitter
<
string
>
();
get
onDidAccept
():
Event
<
string
>
{
return
this
.
_onDidAccept
.
event
;
}
acceptChanges
():
void
{
this
.
_onDidAccept
.
fire
(
this
.
_value
);
}
}
export
class
SCMService
implements
ISCMService
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录