Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
3faded62
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,发现更多精彩内容 >>
提交
3faded62
编写于
12月 02, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
commit, open, drag optional methods
上级
08e73a51
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
101 addition
and
29 deletion
+101
-29
extensions/git/package.json
extensions/git/package.json
+1
-1
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+3
-3
extensions/git/src/scmProvider.ts
extensions/git/src/scmProvider.ts
+12
-0
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+4
-4
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+6
-3
src/vs/workbench/api/node/extHostSCM.ts
src/vs/workbench/api/node/extHostSCM.ts
+66
-3
src/vs/workbench/api/node/mainThreadSCM.ts
src/vs/workbench/api/node/mainThreadSCM.ts
+8
-14
src/vs/workbench/services/scm/common/scm.ts
src/vs/workbench/services/scm/common/scm.ts
+1
-1
未找到文件。
extensions/git/package.json
浏览文件 @
3faded62
...
...
@@ -31,7 +31,7 @@
}
},
{
"command"
:
"git.open
-change
"
,
"command"
:
"git.open"
,
"title"
:
"Open Change"
,
"category"
:
"Git"
},
...
...
extensions/git/src/commands.ts
浏览文件 @
3faded62
...
...
@@ -16,8 +16,8 @@ function refresh(model: Model): () => void {
};
}
function
open
Change
(...
args
:
any
[]):
void
{
console
.
log
(
'
open
Change
'
,
args
);
function
open
(...
args
:
any
[]):
void
{
console
.
log
(
'
open
'
,
args
);
}
function
stage
(
resource
:
SCMResource
):
void
{
...
...
@@ -43,7 +43,7 @@ export function registerCommands(model: Model): Disposable {
commands
.
registerCommand
(
'
git.stage-all
'
,
stageAll
),
commands
.
registerCommand
(
'
git.unstage
'
,
unstage
),
commands
.
registerCommand
(
'
git.unstage-all
'
,
unstageAll
),
commands
.
registerCommand
(
'
git.open
-change
'
,
openChange
)
commands
.
registerCommand
(
'
git.open
'
,
open
)
];
return
Disposable
.
from
(...
disposables
);
...
...
extensions/git/src/scmProvider.ts
浏览文件 @
3faded62
...
...
@@ -155,6 +155,18 @@ export class GitSCMProvider implements SCMProvider {
model
.
update
(
true
);
}
commit
(
message
:
string
):
void
{
console
.
log
(
'
commit
'
,
message
);
}
open
(
resource
:
SCMResource
):
void
{
console
.
log
(
'
open
'
,
resource
);
}
drag
(
resource
:
SCMResource
,
resourceGroup
:
SCMResourceGroup
):
void
{
console
.
log
(
'
drag
'
,
resource
,
resourceGroup
);
}
getOriginalResource
(
uri
:
Uri
):
Uri
|
undefined
{
if
(
uri
.
scheme
!==
'
file
'
)
{
return
void
0
;
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
3faded62
...
...
@@ -109,13 +109,13 @@ declare module 'vscode' {
export
interface
SCMProvider
{
readonly
label
:
string
;
readonly
commitCommand
?:
string
;
readonly
clickCommand
?:
string
;
readonly
dragCommand
?:
string
;
readonly
resources
:
SCMResourceGroup
[];
readonly
onDidChange
:
Event
<
SCMResourceGroup
[]
>
;
getOriginalResource
?(
uri
:
Uri
,
token
:
CancellationToken
):
ProviderResult
<
Uri
>
;
commit
?(
message
:
string
,
token
:
CancellationToken
):
ProviderResult
<
void
>
;
open
?(
resource
:
SCMResource
,
token
:
CancellationToken
):
ProviderResult
<
void
>
;
drag
?(
resource
:
SCMResource
,
resourceGroup
:
SCMResourceGroup
,
token
:
CancellationToken
):
ProviderResult
<
void
>
;
}
export
namespace
scm
{
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
3faded62
...
...
@@ -230,9 +230,9 @@ export abstract class MainProcessExtensionServiceShape {
export
interface
SCMProviderFeatures
{
label
:
string
;
commitCommand
?:
string
;
clickCommand
?:
string
;
dragCommand
?:
string
;
supportsCommit
:
boolean
;
supportsOpen
:
boolean
;
supportsDrag
:
boolean
;
supportsOriginalResource
:
boolean
;
}
...
...
@@ -377,6 +377,9 @@ export abstract class ExtHostTerminalServiceShape {
}
export
abstract
class
ExtHostSCMShape
{
$commit
(
id
:
string
,
message
:
string
):
TPromise
<
void
>
{
throw
ni
();
}
$open
(
id
:
string
,
resourceGroupId
:
string
,
uri
:
string
):
TPromise
<
void
>
{
throw
ni
();
}
$drag
(
id
:
string
,
fromResourceGroupId
:
string
,
fromUri
:
string
,
toResourceGroupId
:
string
):
TPromise
<
void
>
{
throw
ni
();
}
$getOriginalResource
(
id
:
string
,
uri
:
URI
):
TPromise
<
URI
>
{
throw
ni
();
}
}
...
...
src/vs/workbench/api/node/extHostSCM.ts
浏览文件 @
3faded62
...
...
@@ -23,6 +23,13 @@ function getIconPath(decorations: vscode.SCMResourceThemableDecorations) {
}
}
export
interface
Cache
{
[
groupId
:
string
]:
{
resourceGroup
:
vscode
.
SCMResourceGroup
,
resources
:
{
[
uri
:
string
]:
vscode
.
SCMResource
}
};
}
export
class
ExtHostSCM
{
private
_proxy
:
MainThreadSCMShape
;
...
...
@@ -34,6 +41,8 @@ export class ExtHostSCM {
private
_activeProvider
:
vscode
.
SCMProvider
;
get
activeProvider
():
vscode
.
SCMProvider
|
undefined
{
return
this
.
_activeProvider
;
}
private
cache
:
Cache
=
Object
.
create
(
null
);
constructor
(
threadService
:
IThreadService
)
{
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadSCM
);
}
...
...
@@ -48,15 +57,19 @@ export class ExtHostSCM {
this
.
_proxy
.
$register
(
id
,
{
label
:
provider
.
label
,
commitCommand
:
provider
.
commitCommand
,
clickCommand
:
provider
.
clickCommand
,
dragCommand
:
provider
.
dragCommand
,
supportsCommit
:
!!
provider
.
commit
,
supportsOpen
:
!!
provider
.
open
,
supportsDrag
:
!!
provider
.
drag
,
supportsOriginalResource
:
!!
provider
.
getOriginalResource
});
const
onDidChange
=
debounceEvent
(
provider
.
onDidChange
,
(
l
,
e
)
=>
e
,
200
);
const
onDidChangeListener
=
onDidChange
(
resourceGroups
=>
{
this
.
cache
=
Object
.
create
(
null
);
const
rawResourceGroups
=
resourceGroups
.
map
(
g
=>
{
const
resources
:
{
[
id
:
string
]:
vscode
.
SCMResource
;
}
=
Object
.
create
(
null
);
const
rawResources
=
g
.
resources
.
map
(
r
=>
{
const
uri
=
r
.
uri
.
toString
();
const
iconPath
=
getIconPath
(
r
.
decorations
);
...
...
@@ -73,9 +86,13 @@ export class ExtHostSCM {
}
const
strikeThrough
=
r
.
decorations
&&
!!
r
.
decorations
.
strikeThrough
;
resources
[
uri
]
=
r
;
return
[
uri
,
icons
,
strikeThrough
]
as
SCMRawResource
;
});
this
.
cache
[
g
.
id
]
=
{
resourceGroup
:
g
,
resources
};
return
[
g
.
id
,
g
.
label
,
rawResources
]
as
SCMRawResourceGroup
;
});
...
...
@@ -89,6 +106,52 @@ export class ExtHostSCM {
});
}
$commit
(
id
:
string
,
message
:
string
):
TPromise
<
void
>
{
const
provider
=
this
.
_providers
[
id
];
if
(
!
provider
)
{
return
TPromise
.
as
(
null
);
}
return
asWinJsPromise
(
token
=>
provider
.
commit
(
message
,
token
));
}
$open
(
id
:
string
,
resourceGroupId
:
string
,
uri
:
string
):
TPromise
<
void
>
{
const
provider
=
this
.
_providers
[
id
];
if
(
!
provider
)
{
return
TPromise
.
as
(
null
);
}
const
resourceGroup
=
this
.
cache
[
resourceGroupId
];
const
resource
=
resourceGroup
&&
resourceGroup
.
resources
[
uri
];
if
(
!
resource
)
{
return
TPromise
.
as
(
null
);
}
return
asWinJsPromise
(
token
=>
provider
.
open
(
resource
,
token
));
}
$drag
(
id
:
string
,
fromResourceGroupId
:
string
,
fromUri
:
string
,
toResourceGroupId
:
string
):
TPromise
<
void
>
{
const
provider
=
this
.
_providers
[
id
];
if
(
!
provider
)
{
return
TPromise
.
as
(
null
);
}
const
fromResourceGroup
=
this
.
cache
[
fromResourceGroupId
];
const
resource
=
fromResourceGroup
&&
fromResourceGroup
.
resources
[
fromUri
];
const
toResourceGroup
=
this
.
cache
[
toResourceGroupId
];
const
resourceGroup
=
toResourceGroup
&&
toResourceGroup
.
resourceGroup
;
if
(
!
resource
||
!
resourceGroup
)
{
return
TPromise
.
as
(
null
);
}
return
asWinJsPromise
(
token
=>
provider
.
drag
(
resource
,
resourceGroup
,
token
));
}
$getOriginalResource
(
id
:
string
,
uri
:
URI
):
TPromise
<
URI
>
{
const
provider
=
this
.
_providers
[
id
];
...
...
src/vs/workbench/api/node/mainThreadSCM.ts
浏览文件 @
3faded62
...
...
@@ -39,33 +39,27 @@ class MainThreadSCMProvider implements ISCMProvider {
}
commit
(
message
:
string
):
TPromise
<
void
>
{
const
id
=
this
.
features
.
commitCommand
;
if
(
!
id
)
{
if
(
!
this
.
features
.
supportsCommit
)
{
return
TPromise
.
as
(
null
);
}
return
this
.
commandService
.
executeCommand
<
void
>
(
id
,
message
);
return
this
.
proxy
.
$commit
(
this
.
id
,
message
);
}
open
(
uri
:
ISCMResource
):
TPromise
<
void
>
{
const
id
=
this
.
features
.
clickCommand
;
if
(
!
id
)
{
open
(
resource
:
ISCMResource
):
TPromise
<
void
>
{
if
(
!
this
.
features
.
supportsOpen
)
{
return
TPromise
.
as
(
null
);
}
return
this
.
commandService
.
executeCommand
<
void
>
(
id
,
uri
);
return
this
.
proxy
.
$open
(
this
.
id
,
resource
.
resourceGroupId
,
resource
.
uri
.
toString
()
);
}
drag
(
from
:
ISCMResource
,
to
:
ISCMResource
):
TPromise
<
void
>
{
const
id
=
this
.
features
.
dragCommand
;
if
(
!
id
)
{
drag
(
from
:
ISCMResource
,
to
:
ISCMResourceGroup
):
TPromise
<
void
>
{
if
(
!
this
.
features
.
supportsDrag
)
{
return
TPromise
.
as
(
null
);
}
return
this
.
commandService
.
executeCommand
<
void
>
(
id
,
from
,
to
);
return
this
.
proxy
.
$drag
(
this
.
id
,
from
.
resourceGroupId
,
from
.
uri
.
toString
(),
to
.
id
);
}
getOriginalResource
(
uri
:
URI
):
TPromise
<
URI
>
{
...
...
src/vs/workbench/services/scm/common/scm.ts
浏览文件 @
3faded62
...
...
@@ -43,7 +43,7 @@ export interface ISCMProvider extends IDisposable {
commit
(
message
:
string
):
TPromise
<
void
>
;
open
(
uri
:
ISCMResource
):
TPromise
<
void
>
;
drag
(
from
:
ISCMResource
,
to
:
ISCMResource
):
TPromise
<
void
>
;
drag
(
from
:
ISCMResource
,
to
:
ISCMResource
Group
):
TPromise
<
void
>
;
getOriginalResource
(
uri
:
URI
):
TPromise
<
URI
>
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录