Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
32f721f8
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,发现更多精彩内容 >>
提交
32f721f8
编写于
8月 22, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
scm: deprecate scm.inputBox
上级
da84e2e4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
38 addition
and
44 deletion
+38
-44
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+4
-1
src/vs/workbench/api/electron-browser/mainThreadSCM.ts
src/vs/workbench/api/electron-browser/mainThreadSCM.ts
+5
-10
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+2
-2
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-3
src/vs/workbench/api/node/extHostSCM.ts
src/vs/workbench/api/node/extHostSCM.ts
+26
-28
未找到文件。
src/vs/vscode.d.ts
浏览文件 @
32f721f8
...
...
@@ -5447,7 +5447,10 @@ declare module 'vscode' {
export
namespace
scm
{
/**
* The [input box](#SourceControlInputBox) in the Source Control viewlet.
* The [input box](#SourceControlInputBox) for the last source control
* created by the extension.
*
* @deprecated Use [SourceControl.inputBox](#SourceControl.inputBox) instead
*/
export
const
inputBox
:
SourceControlInputBox
;
...
...
src/vs/workbench/api/electron-browser/mainThreadSCM.ts
浏览文件 @
32f721f8
...
...
@@ -9,7 +9,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
URI
from
'
vs/base/common/uri
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
dispose
,
combinedDisposable
}
from
'
vs/base/common/lifecycle
'
;
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
'
;
...
...
@@ -231,9 +231,6 @@ export class MainThreadSCM implements MainThreadSCMShape {
@
ICommandService
private
commandService
:
ICommandService
)
{
this
.
_proxy
=
extHostContext
.
get
(
ExtHostContext
.
ExtHostSCM
);
this
.
scmService
.
onDidChangeProvider
(
this
.
onDidChangeProvider
,
this
,
this
.
_disposables
);
this
.
scmService
.
input
.
onDidChange
(
this
.
_proxy
.
$onInputBoxValueChange
,
this
.
_proxy
,
this
.
_disposables
);
}
dispose
():
void
{
...
...
@@ -251,7 +248,10 @@ export class MainThreadSCM implements MainThreadSCMShape {
$registerSourceControl
(
handle
:
number
,
id
:
string
,
label
:
string
):
void
{
const
provider
=
new
MainThreadSCMProvider
(
this
.
_proxy
,
handle
,
id
,
label
,
this
.
scmService
,
this
.
commandService
);
this
.
_sourceControls
[
handle
]
=
provider
;
this
.
_sourceControlDisposables
[
handle
]
=
this
.
scmService
.
registerSCMProvider
(
provider
);
const
providerDisposable
=
this
.
scmService
.
registerSCMProvider
(
provider
);
const
inputDisposable
=
this
.
scmService
.
input
.
onDidChange
(
value
=>
this
.
_proxy
.
$onInputBoxValueChange
(
handle
,
value
));
this
.
_sourceControlDisposables
[
handle
]
=
combinedDisposable
([
providerDisposable
,
inputDisposable
]);
}
$updateSourceControl
(
handle
:
number
,
features
:
SCMProviderFeatures
):
void
{
...
...
@@ -331,9 +331,4 @@ export class MainThreadSCM implements MainThreadSCMShape {
$setInputBoxValue
(
value
:
string
):
void
{
this
.
scmService
.
input
.
value
=
value
;
}
private
onDidChangeProvider
(
provider
:
ISCMProvider
):
void
{
const
handle
=
Object
.
keys
(
this
.
_sourceControls
).
filter
(
handle
=>
this
.
_sourceControls
[
handle
]
===
provider
)[
0
];
this
.
_proxy
.
$onActiveSourceControlChange
(
handle
&&
parseInt
(
handle
));
}
}
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
32f721f8
...
...
@@ -472,7 +472,7 @@ export function createApiFactory(
// namespace: scm
const
scm
:
typeof
vscode
.
scm
=
{
get
inputBox
()
{
return
extHostSCM
.
inputBox
;
return
extHostSCM
.
getLastInputBox
(
extension
)
;
},
createSourceControl
(
id
:
string
,
label
:
string
)
{
telemetryService
.
publicLog
(
'
registerSCMProvider
'
,
{
...
...
@@ -481,7 +481,7 @@ export function createApiFactory(
providerLabel
:
label
});
return
extHostSCM
.
createSourceControl
(
id
,
label
);
return
extHostSCM
.
createSourceControl
(
extension
,
id
,
label
);
}
};
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
32f721f8
...
...
@@ -508,9 +508,7 @@ export interface ExtHostTerminalServiceShape {
export
interface
ExtHostSCMShape
{
$provideOriginalResource
(
sourceControlHandle
:
number
,
uri
:
URI
):
TPromise
<
URI
>
;
$onActiveSourceControlChange
(
sourceControlHandle
:
number
):
TPromise
<
void
>
;
$onInputBoxValueChange
(
value
:
string
):
TPromise
<
void
>
;
$onInputBoxAcceptChanges
():
TPromise
<
void
>
;
$onInputBoxValueChange
(
sourceControlHandle
:
number
,
value
:
string
):
TPromise
<
void
>
;
}
export
interface
ExtHostTaskShape
{
...
...
src/vs/workbench/api/node/extHostSCM.ts
浏览文件 @
32f721f8
...
...
@@ -8,6 +8,7 @@ import URI from 'vs/base/common/uri';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
ExtHostCommands
,
CommandsConverter
}
from
'
vs/workbench/api/node/extHostCommands
'
;
import
{
MainContext
,
MainThreadSCMShape
,
SCMRawResource
,
IMainContext
}
from
'
./extHost.protocol
'
;
import
*
as
vscode
from
'
vscode
'
;
...
...
@@ -42,12 +43,6 @@ export class ExtHostSCMInputBox {
return
this
.
_onDidChange
.
event
;
}
private
_onDidAccept
=
new
Emitter
<
string
>
();
get
onDidAccept
():
Event
<
string
>
{
return
this
.
_onDidAccept
.
event
;
}
constructor
(
private
_proxy
:
MainThreadSCMShape
)
{
// noop
}
...
...
@@ -56,10 +51,6 @@ export class ExtHostSCMInputBox {
this
.
updateValue
(
value
);
}
$onInputBoxAcceptChanges
():
void
{
this
.
_onDidAccept
.
fire
(
this
.
_value
);
}
private
updateValue
(
value
:
string
):
void
{
this
.
_value
=
value
;
this
.
_onDidChange
.
fire
(
value
);
...
...
@@ -171,6 +162,9 @@ class ExtHostSourceControl implements vscode.SourceControl {
return
this
.
_label
;
}
private
_inputBox
:
ExtHostSCMInputBox
;
get
inputBox
():
ExtHostSCMInputBox
{
return
this
.
_inputBox
;
}
private
_count
:
number
|
undefined
=
undefined
;
get
count
():
number
|
undefined
{
...
...
@@ -238,6 +232,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
private
_id
:
string
,
private
_label
:
string
,
)
{
this
.
_inputBox
=
new
ExtHostSCMInputBox
(
this
.
_proxy
);
this
.
_proxy
.
$registerSourceControl
(
this
.
_handle
,
_id
,
_label
);
}
...
...
@@ -266,22 +261,16 @@ export class ExtHostSCM {
private
_proxy
:
MainThreadSCMShape
;
private
_sourceControls
:
Map
<
ProviderHandle
,
ExtHostSourceControl
>
=
new
Map
<
ProviderHandle
,
ExtHostSourceControl
>
();
private
_sourceControlsByExtension
:
Map
<
string
,
ExtHostSourceControl
[]
>
=
new
Map
<
string
,
ExtHostSourceControl
[]
>
();
private
_onDidChangeActiveProvider
=
new
Emitter
<
vscode
.
SourceControl
>
();
get
onDidChangeActiveProvider
():
Event
<
vscode
.
SourceControl
>
{
return
this
.
_onDidChangeActiveProvider
.
event
;
}
private
_activeProvider
:
vscode
.
SourceControl
|
undefined
;
get
activeProvider
():
vscode
.
SourceControl
|
undefined
{
return
this
.
_activeProvider
;
}
private
_inputBox
:
ExtHostSCMInputBox
;
get
inputBox
():
ExtHostSCMInputBox
{
return
this
.
_inputBox
;
}
constructor
(
mainContext
:
IMainContext
,
private
_commands
:
ExtHostCommands
)
{
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadSCM
);
this
.
_inputBox
=
new
ExtHostSCMInputBox
(
this
.
_proxy
);
_commands
.
registerArgumentProcessor
({
processArgument
:
arg
=>
{
...
...
@@ -322,14 +311,27 @@ export class ExtHostSCM {
});
}
createSourceControl
(
id
:
string
,
label
:
string
):
vscode
.
SourceControl
{
createSourceControl
(
extension
:
IExtensionDescription
,
id
:
string
,
label
:
string
):
vscode
.
SourceControl
{
const
handle
=
ExtHostSCM
.
_handlePool
++
;
const
sourceControl
=
new
ExtHostSourceControl
(
this
.
_proxy
,
this
.
_commands
.
converter
,
id
,
label
);
this
.
_sourceControls
.
set
(
handle
,
sourceControl
);
const
sourceControls
=
this
.
_sourceControlsByExtension
.
get
(
extension
.
id
)
||
[];
sourceControls
.
push
(
sourceControl
);
this
.
_sourceControlsByExtension
.
set
(
extension
.
id
,
sourceControls
);
return
sourceControl
;
}
// Deprecated
getLastInputBox
(
extension
:
IExtensionDescription
):
ExtHostSCMInputBox
{
const
sourceControls
=
this
.
_sourceControlsByExtension
.
get
(
extension
.
id
);
const
sourceControl
=
sourceControls
&&
sourceControls
[
sourceControls
.
length
-
1
];
const
inputBox
=
sourceControl
&&
sourceControl
.
inputBox
;
return
inputBox
;
}
$provideOriginalResource
(
sourceControlHandle
:
number
,
uri
:
URI
):
TPromise
<
URI
>
{
const
sourceControl
=
this
.
_sourceControls
.
get
(
sourceControlHandle
);
...
...
@@ -343,18 +345,14 @@ export class ExtHostSCM {
});
}
$onActiveSourceControlChange
(
handle
:
number
):
TPromise
<
void
>
{
this
.
_activeProvider
=
this
.
_sourceControls
.
get
(
handle
);
return
TPromise
.
as
(
null
);
}
$onInputBoxValueChange
(
sourceControlHandle
:
number
,
value
:
string
):
TPromise
<
void
>
{
const
sourceControl
=
this
.
_sourceControls
.
get
(
sourceControlHandle
);
$onInputBoxValueChange
(
value
:
string
):
TPromise
<
void
>
{
this
.
_inputBox
.
$onInputBoxValueChange
(
value
);
return
TPromise
.
as
(
null
);
}
if
(
!
sourceControl
||
!
sourceControl
.
quickDiffProvider
)
{
return
TPromise
.
as
(
null
);
}
$onInputBoxAcceptChanges
():
TPromise
<
void
>
{
this
.
_inputBox
.
$onInputBoxAcceptChanges
();
sourceControl
.
inputBox
.
$onInputBoxValueChange
(
value
);
return
TPromise
.
as
(
null
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录