Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
51c42516
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,发现更多精彩内容 >>
提交
51c42516
编写于
9月 06, 2017
作者:
J
Joao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
scm: don't send resource states commands back and forward
上级
41ec9836
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
58 addition
and
25 deletion
+58
-25
src/vs/workbench/api/electron-browser/mainThreadSCM.ts
src/vs/workbench/api/electron-browser/mainThreadSCM.ts
+7
-3
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-1
src/vs/workbench/api/node/extHostSCM.ts
src/vs/workbench/api/node/extHostSCM.ts
+48
-14
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
+1
-6
src/vs/workbench/services/scm/common/scm.ts
src/vs/workbench/services/scm/common/scm.ts
+1
-1
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadSCM.ts
浏览文件 @
51c42516
...
...
@@ -56,15 +56,19 @@ class MainThreadSCMResourceGroup implements ISCMResourceGroup {
class
MainThreadSCMResource
implements
ISCMResource
{
constructor
(
private
proxy
:
ExtHostSCMShape
,
private
sourceControlHandle
:
number
,
private
groupHandle
:
number
,
private
handle
:
number
,
public
sourceUri
:
URI
,
public
command
:
Command
|
undefined
,
public
resourceGroup
:
ISCMResourceGroup
,
public
decorations
:
ISCMResourceDecorations
)
{
}
open
():
TPromise
<
void
>
{
return
this
.
proxy
.
$executeResourceCommand
(
this
.
sourceControlHandle
,
this
.
groupHandle
,
this
.
handle
);
}
toJSON
():
any
{
return
{
$mid
:
3
,
...
...
@@ -182,7 +186,7 @@ class MainThreadSCMProvider implements ISCMProvider {
for
(
const
[
start
,
deleteCount
,
rawResources
]
of
groupSlices
)
{
const
resources
=
rawResources
.
map
(
rawResource
=>
{
const
[
handle
,
sourceUri
,
command
,
icons
,
tooltip
,
strikeThrough
,
faded
]
=
rawResource
;
const
[
handle
,
sourceUri
,
icons
,
tooltip
,
strikeThrough
,
faded
]
=
rawResource
;
const
icon
=
icons
[
0
];
const
iconDark
=
icons
[
1
]
||
icon
;
const
decorations
=
{
...
...
@@ -194,11 +198,11 @@ class MainThreadSCMProvider implements ISCMProvider {
};
return
new
MainThreadSCMResource
(
this
.
proxy
,
this
.
handle
,
groupHandle
,
handle
,
URI
.
parse
(
sourceUri
),
command
,
group
,
decorations
);
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
51c42516
...
...
@@ -330,7 +330,6 @@ export interface SCMGroupFeatures {
export
type
SCMRawResource
=
[
number
/*handle*/
,
string
/*resourceUri*/
,
modes
.
Command
/*command*/
,
string
[]
/*icons: light, dark*/
,
string
/*tooltip*/
,
boolean
/*strike through*/
,
...
...
@@ -540,6 +539,7 @@ export interface ExtHostTerminalServiceShape {
export
interface
ExtHostSCMShape
{
$provideOriginalResource
(
sourceControlHandle
:
number
,
uri
:
URI
):
TPromise
<
URI
>
;
$onInputBoxValueChange
(
sourceControlHandle
:
number
,
value
:
string
):
TPromise
<
void
>
;
$executeResourceCommand
(
sourceControlHandle
:
number
,
groupHandle
:
number
,
handle
:
number
):
TPromise
<
void
>
;
}
export
interface
ExtHostTaskShape
{
...
...
src/vs/workbench/api/node/extHostSCM.ts
浏览文件 @
51c42516
...
...
@@ -11,12 +11,16 @@ import { debounce } from 'vs/base/common/decorators';
import
{
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
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
{
ExtHostCommands
}
from
'
vs/workbench/api/node/extHostCommands
'
;
import
{
MainContext
,
MainThreadSCMShape
,
SCMRawResource
,
SCMRawResourceSplice
,
SCMRawResourceSplices
,
IMainContext
}
from
'
./extHost.protocol
'
;
import
{
LcsDiff
,
ISequence
}
from
'
vs/base/common/diff/diff
'
;
import
{
comparePaths
}
from
'
vs/base/common/comparers
'
;
import
*
as
vscode
from
'
vscode
'
;
type
ProviderHandle
=
number
;
type
GroupHandle
=
number
;
type
ResourceStateHandle
=
number
;
function
getIconPath
(
decorations
:
vscode
.
SourceControlResourceThemableDecorations
)
{
if
(
!
decorations
)
{
return
undefined
;
...
...
@@ -161,6 +165,7 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
private
_resourceStatesRollingDisposables
:
{
():
void
}[]
=
[];
private
_resourceStatesMap
:
Map
<
ResourceStateHandle
,
vscode
.
SourceControlResourceState
>
=
new
Map
<
ResourceStateHandle
,
vscode
.
SourceControlResourceState
>
();
private
_resourceStatesCommandsMap
:
Map
<
ResourceStateHandle
,
vscode
.
Command
>
=
new
Map
<
ResourceStateHandle
,
vscode
.
Command
>
();
private
_onDidUpdateResourceStates
=
new
Emitter
<
void
>
();
readonly
onDidUpdateResourceStates
=
this
.
_onDidUpdateResourceStates
.
event
;
...
...
@@ -212,12 +217,15 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
handles
.
push
(
handle
);
const
sourceUri
=
r
.
resourceUri
.
toString
();
const
command
=
this
.
_commands
.
toInternal
(
r
.
command
);
const
iconPath
=
getIconPath
(
r
.
decorations
);
const
lightIconPath
=
r
.
decorations
&&
getIconPath
(
r
.
decorations
.
light
)
||
iconPath
;
const
darkIconPath
=
r
.
decorations
&&
getIconPath
(
r
.
decorations
.
dark
)
||
iconPath
;
const
icons
:
string
[]
=
[];
if
(
r
.
command
)
{
this
.
_resourceStatesCommandsMap
.
set
(
handle
,
r
.
command
);
}
if
(
lightIconPath
||
darkIconPath
)
{
icons
.
push
(
lightIconPath
);
}
...
...
@@ -230,7 +238,7 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
const
strikeThrough
=
r
.
decorations
&&
!!
r
.
decorations
.
strikeThrough
;
const
faded
=
r
.
decorations
&&
!!
r
.
decorations
.
faded
;
return
[
handle
,
sourceUri
,
command
,
icons
,
tooltip
,
strikeThrough
,
faded
]
as
SCMRawResource
;
return
[
handle
,
sourceUri
,
icons
,
tooltip
,
strikeThrough
,
faded
]
as
SCMRawResource
;
});
handlesToDelete
.
push
(...
this
.
_handlesSnapshot
.
splice
(
start
,
deleteCount
,
...
handles
));
...
...
@@ -238,7 +246,11 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
return
[
start
,
deleteCount
,
rawResources
]
as
SCMRawResourceSplice
;
});
const
disposable
=
()
=>
handlesToDelete
.
forEach
(
handle
=>
this
.
_resourceStatesMap
.
delete
(
handle
));
const
disposable
=
()
=>
handlesToDelete
.
forEach
(
handle
=>
{
this
.
_resourceStatesMap
.
delete
(
handle
);
this
.
_resourceStatesCommandsMap
.
delete
(
handle
);
});
this
.
_resourceStatesRollingDisposables
.
push
(
disposable
);
while
(
this
.
_resourceStatesRollingDisposables
.
length
>=
10
)
{
...
...
@@ -254,7 +266,7 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
constructor
(
private
_proxy
:
MainThreadSCMShape
,
private
_commands
:
CommandsConverter
,
private
_commands
:
ExtHostCommands
,
private
_sourceControlHandle
:
number
,
private
_id
:
string
,
private
_label
:
string
,
...
...
@@ -266,6 +278,16 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
return
this
.
_resourceStatesMap
.
get
(
handle
);
}
async
$executeResourceCommand
(
handle
:
number
):
TPromise
<
void
>
{
const
command
=
this
.
_resourceStatesCommandsMap
.
get
(
handle
);
if
(
!
command
)
{
return
;
}
this
.
_commands
.
executeCommand
(
command
.
command
,
...
command
.
arguments
);
}
dispose
():
void
{
this
.
_proxy
.
$unregisterGroup
(
this
.
_sourceControlHandle
,
this
.
handle
);
this
.
_disposables
=
dispose
(
this
.
_disposables
);
...
...
@@ -331,7 +353,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
set
acceptInputCommand
(
acceptInputCommand
:
vscode
.
Command
|
undefined
)
{
this
.
_acceptInputCommand
=
acceptInputCommand
;
const
internal
=
this
.
_commands
.
toInternal
(
acceptInputCommand
);
const
internal
=
this
.
_commands
.
converter
.
toInternal
(
acceptInputCommand
);
this
.
_proxy
.
$updateSourceControl
(
this
.
handle
,
{
acceptInputCommand
:
internal
});
}
...
...
@@ -344,7 +366,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
set
statusBarCommands
(
statusBarCommands
:
vscode
.
Command
[]
|
undefined
)
{
this
.
_statusBarCommands
=
statusBarCommands
;
const
internal
=
(
statusBarCommands
||
[]).
map
(
c
=>
this
.
_commands
.
toInternal
(
c
));
const
internal
=
(
statusBarCommands
||
[]).
map
(
c
=>
this
.
_commands
.
converter
.
toInternal
(
c
));
this
.
_proxy
.
$updateSourceControl
(
this
.
handle
,
{
statusBarCommands
:
internal
});
}
...
...
@@ -352,7 +374,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
constructor
(
private
_proxy
:
MainThreadSCMShape
,
private
_commands
:
CommandsConverter
,
private
_commands
:
ExtHostCommands
,
private
_id
:
string
,
private
_label
:
string
,
)
{
...
...
@@ -411,10 +433,6 @@ class ExtHostSourceControl implements vscode.SourceControl {
}
}
type
ProviderHandle
=
number
;
type
GroupHandle
=
number
;
type
ResourceStateHandle
=
number
;
export
class
ExtHostSCM
{
private
static
_handlePool
:
number
=
0
;
...
...
@@ -473,7 +491,7 @@ export class ExtHostSCM {
createSourceControl
(
extension
:
IExtensionDescription
,
id
:
string
,
label
:
string
):
vscode
.
SourceControl
{
const
handle
=
ExtHostSCM
.
_handlePool
++
;
const
sourceControl
=
new
ExtHostSourceControl
(
this
.
_proxy
,
this
.
_commands
.
converter
,
id
,
label
);
const
sourceControl
=
new
ExtHostSourceControl
(
this
.
_proxy
,
this
.
_commands
,
id
,
label
);
this
.
_sourceControls
.
set
(
handle
,
sourceControl
);
const
sourceControls
=
this
.
_sourceControlsByExtension
.
get
(
extension
.
id
)
||
[];
...
...
@@ -508,11 +526,27 @@ export class ExtHostSCM {
$onInputBoxValueChange
(
sourceControlHandle
:
number
,
value
:
string
):
TPromise
<
void
>
{
const
sourceControl
=
this
.
_sourceControls
.
get
(
sourceControlHandle
);
if
(
!
sourceControl
||
!
sourceControl
.
quickDiffProvider
)
{
if
(
!
sourceControl
)
{
return
TPromise
.
as
(
null
);
}
sourceControl
.
inputBox
.
$onInputBoxValueChange
(
value
);
return
TPromise
.
as
(
null
);
}
async
$executeResourceCommand
(
sourceControlHandle
:
number
,
groupHandle
:
number
,
handle
:
number
):
TPromise
<
void
>
{
const
sourceControl
=
this
.
_sourceControls
.
get
(
sourceControlHandle
);
if
(
!
sourceControl
)
{
return
;
}
const
group
=
sourceControl
.
getResourceGroup
(
groupHandle
);
if
(
!
group
)
{
return
;
}
group
.
$executeResourceCommand
(
handle
);
}
}
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
浏览文件 @
51c42516
...
...
@@ -418,12 +418,7 @@ class SourceControlView extends CollapsibleView {
}
private
open
(
e
:
ISCMResource
):
void
{
if
(
!
e
.
command
)
{
return
;
}
this
.
commandService
.
executeCommand
(
e
.
command
.
id
,
...
e
.
command
.
arguments
)
.
done
(
undefined
,
onUnexpectedError
);
e
.
open
().
done
(
undefined
,
onUnexpectedError
);
}
private
pin
():
void
{
...
...
src/vs/workbench/services/scm/common/scm.ts
浏览文件 @
51c42516
...
...
@@ -40,8 +40,8 @@ export interface ISCMResourceCollection {
export
interface
ISCMResource
{
readonly
resourceGroup
:
ISCMResourceGroup
;
readonly
sourceUri
:
URI
;
readonly
command
?:
Command
;
readonly
decorations
:
ISCMResourceDecorations
;
open
():
TPromise
<
void
>
;
}
export
interface
ISCMResourceGroup
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录