Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6c7ff2bb
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,发现更多精彩内容 >>
未验证
提交
6c7ff2bb
编写于
8月 05, 2020
作者:
J
João Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
scm: throttle resource group creation
上级
1b62230a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
70 addition
and
33 deletion
+70
-33
src/vs/workbench/api/browser/mainThreadSCM.ts
src/vs/workbench/api/browser/mainThreadSCM.ts
+19
-14
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-1
src/vs/workbench/api/common/extHostSCM.ts
src/vs/workbench/api/common/extHostSCM.ts
+50
-18
未找到文件。
src/vs/workbench/api/browser/mainThreadSCM.ts
浏览文件 @
6c7ff2bb
...
...
@@ -150,18 +150,22 @@ class MainThreadSCMProvider implements ISCMProvider {
}
}
$registerGroup
(
handle
:
number
,
id
:
string
,
label
:
string
):
void
{
const
group
=
new
MainThreadSCMResourceGroup
(
this
.
handle
,
handle
,
this
,
{},
label
,
id
);
this
.
_groupsByHandle
[
handle
]
=
group
;
this
.
groups
.
splice
(
this
.
groups
.
elements
.
length
,
0
,
[
group
]);
$registerGroups
(
_groups
:
[
number
/*handle*/
,
string
/*id*/
,
string
/*label*/
,
SCMGroupFeatures
][]):
void
{
const
groups
=
_groups
.
map
(([
handle
,
id
,
label
,
features
])
=>
{
const
group
=
new
MainThreadSCMResourceGroup
(
this
.
handle
,
handle
,
this
,
features
,
label
,
id
);
this
.
_groupsByHandle
[
handle
]
=
group
;
return
group
;
});
this
.
groups
.
splice
(
this
.
groups
.
elements
.
length
,
0
,
groups
);
}
$updateGroup
(
handle
:
number
,
features
:
SCMGroupFeatures
):
void
{
...
...
@@ -326,7 +330,7 @@ export class MainThreadSCM implements MainThreadSCMShape {
this
.
_repositories
.
delete
(
handle
);
}
$registerGroup
(
sourceControlHandle
:
number
,
groupHandle
:
number
,
id
:
string
,
label
:
string
):
void
{
$registerGroup
s
(
sourceControlHandle
:
number
,
groups
:
[
number
/*handle*/
,
string
/*id*/
,
string
/*label*/
,
SCMGroupFeatures
][],
splices
:
SCMRawResourceSplices
[]
):
void
{
const
repository
=
this
.
_repositories
.
get
(
sourceControlHandle
);
if
(
!
repository
)
{
...
...
@@ -334,7 +338,8 @@ export class MainThreadSCM implements MainThreadSCMShape {
}
const
provider
=
repository
.
provider
as
MainThreadSCMProvider
;
provider
.
$registerGroup
(
groupHandle
,
id
,
label
);
provider
.
$registerGroups
(
groups
);
provider
.
$spliceGroupResourceStates
(
splices
);
}
$updateGroup
(
sourceControlHandle
:
number
,
groupHandle
:
number
,
features
:
SCMGroupFeatures
):
void
{
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
6c7ff2bb
...
...
@@ -837,7 +837,7 @@ export interface MainThreadSCMShape extends IDisposable {
$updateSourceControl
(
handle
:
number
,
features
:
SCMProviderFeatures
):
void
;
$unregisterSourceControl
(
handle
:
number
):
void
;
$registerGroup
(
sourceControlHandle
:
number
,
handle
:
number
,
id
:
string
,
label
:
string
):
void
;
$registerGroup
s
(
sourceControlHandle
:
number
,
groups
:
[
number
/*handle*/
,
string
/*id*/
,
string
/*label*/
,
SCMGroupFeatures
][],
splices
:
SCMRawResourceSplices
[]
):
void
;
$updateGroup
(
sourceControlHandle
:
number
,
handle
:
number
,
features
:
SCMGroupFeatures
):
void
;
$updateGroupLabel
(
sourceControlHandle
:
number
,
handle
:
number
,
label
:
string
):
void
;
$unregisterGroup
(
sourceControlHandle
:
number
,
handle
:
number
):
void
;
...
...
src/vs/workbench/api/common/extHostSCM.ts
浏览文件 @
6c7ff2bb
...
...
@@ -6,10 +6,10 @@
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
debounce
}
from
'
vs/base/common/decorators
'
;
import
{
DisposableStore
,
MutableDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
DisposableStore
,
IDisposable
,
MutableDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
asPromise
}
from
'
vs/base/common/async
'
;
import
{
ExtHostCommands
}
from
'
vs/workbench/api/common/extHostCommands
'
;
import
{
MainContext
,
MainThreadSCMShape
,
SCMRawResource
,
SCMRawResourceSplice
,
SCMRawResourceSplices
,
IMainContext
,
ExtHostSCMShape
,
ICommandDto
,
MainThreadTelemetryShape
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
MainThreadSCMShape
,
SCMRawResource
,
SCMRawResourceSplice
,
SCMRawResourceSplices
,
IMainContext
,
ExtHostSCMShape
,
ICommandDto
,
MainThreadTelemetryShape
,
SCMGroupFeatures
}
from
'
./extHost.protocol
'
;
import
{
sortedDiff
,
equals
}
from
'
vs/base/common/arrays
'
;
import
{
comparePaths
}
from
'
vs/base/common/comparers
'
;
import
type
*
as
vscode
from
'
vscode
'
;
...
...
@@ -228,6 +228,9 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
private
readonly
_onDidUpdateResourceStates
=
new
Emitter
<
void
>
();
readonly
onDidUpdateResourceStates
=
this
.
_onDidUpdateResourceStates
.
event
;
private
_disposed
=
false
;
get
disposed
():
boolean
{
return
this
.
_disposed
;
}
private
readonly
_onDidDispose
=
new
Emitter
<
void
>
();
readonly
onDidDispose
=
this
.
_onDidDispose
.
event
;
...
...
@@ -246,7 +249,13 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
get
hideWhenEmpty
():
boolean
|
undefined
{
return
this
.
_hideWhenEmpty
;
}
set
hideWhenEmpty
(
hideWhenEmpty
:
boolean
|
undefined
)
{
this
.
_hideWhenEmpty
=
hideWhenEmpty
;
this
.
_proxy
.
$updateGroup
(
this
.
_sourceControlHandle
,
this
.
handle
,
{
hideWhenEmpty
});
this
.
_proxy
.
$updateGroup
(
this
.
_sourceControlHandle
,
this
.
handle
,
this
.
features
);
}
get
features
():
SCMGroupFeatures
{
return
{
hideWhenEmpty
:
this
.
hideWhenEmpty
};
}
get
resourceStates
():
vscode
.
SourceControlResourceState
[]
{
return
[...
this
.
_resourceStates
];
}
...
...
@@ -263,9 +272,7 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
private
_sourceControlHandle
:
number
,
private
_id
:
string
,
private
_label
:
string
,
)
{
this
.
_proxy
.
$registerGroup
(
_sourceControlHandle
,
this
.
handle
,
_id
,
_label
);
}
)
{
}
getResourceState
(
handle
:
number
):
vscode
.
SourceControlResourceState
|
undefined
{
return
this
.
_resourceStatesMap
.
get
(
handle
);
...
...
@@ -340,7 +347,7 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
}
dispose
():
void
{
this
.
_
proxy
.
$unregisterGroup
(
this
.
_sourceControlHandle
,
this
.
handle
)
;
this
.
_
disposed
=
true
;
this
.
_onDidDispose
.
fire
();
}
}
...
...
@@ -465,24 +472,49 @@ class ExtHostSourceControl implements vscode.SourceControl {
this
.
_proxy
.
$registerSourceControl
(
this
.
handle
,
_id
,
_label
,
_rootUri
);
}
private
createdResourceGroups
=
new
Map
<
ExtHostSourceControlResourceGroup
,
IDisposable
>
();
private
updatedResourceGroups
=
new
Set
<
ExtHostSourceControlResourceGroup
>
();
createResourceGroup
(
id
:
string
,
label
:
string
):
ExtHostSourceControlResourceGroup
{
const
group
=
new
ExtHostSourceControlResourceGroup
(
this
.
_proxy
,
this
.
_commands
,
this
.
handle
,
id
,
label
);
const
disposable
=
Event
.
once
(
group
.
onDidDispose
)(()
=>
this
.
createdResourceGroups
.
delete
(
group
));
this
.
createdResourceGroups
.
set
(
group
,
disposable
);
this
.
eventuallyAddResourceGroups
();
return
group
;
}
const
updateListener
=
group
.
onDidUpdateResourceStates
(()
=>
{
this
.
updatedResourceGroups
.
add
(
group
);
this
.
eventuallyUpdateResourceStates
()
;
})
;
@
debounce
(
100
)
eventuallyAddResourceGroups
():
void
{
const
groups
:
[
number
/*handle*/
,
string
/*id*/
,
string
/*label*/
,
SCMGroupFeatures
][]
=
[]
;
const
splices
:
SCMRawResourceSplices
[]
=
[]
;
Event
.
once
(
group
.
onDidDispose
)(()
=>
{
this
.
updatedResourceGroups
.
delete
(
group
);
updateListener
.
dispose
();
this
.
_groups
.
delete
(
group
.
handle
);
});
for
(
const
[
group
,
disposable
]
of
this
.
createdResourceGroups
)
{
disposable
.
dispose
();
this
.
_groups
.
set
(
group
.
handle
,
group
);
return
group
;
const
updateListener
=
group
.
onDidUpdateResourceStates
(()
=>
{
this
.
updatedResourceGroups
.
add
(
group
);
this
.
eventuallyUpdateResourceStates
();
});
Event
.
once
(
group
.
onDidDispose
)(()
=>
{
this
.
updatedResourceGroups
.
delete
(
group
);
updateListener
.
dispose
();
this
.
_groups
.
delete
(
group
.
handle
);
this
.
_proxy
.
$unregisterGroup
(
this
.
handle
,
group
.
handle
);
});
groups
.
push
([
group
.
handle
,
group
.
id
,
group
.
label
,
group
.
features
]);
const
snapshot
=
group
.
_takeResourceStateSnapshot
();
if
(
snapshot
.
length
>
0
)
{
splices
.
push
([
group
.
handle
,
snapshot
]);
}
this
.
_groups
.
set
(
group
.
handle
,
group
);
}
this
.
_proxy
.
$registerGroups
(
this
.
handle
,
groups
,
splices
);
}
@
debounce
(
100
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录