Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
50bd9c27
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,发现更多精彩内容 >>
提交
50bd9c27
编写于
9月 28, 2021
作者:
E
Eric Amodio
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes repo events not updating action button
上级
48017a0d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
21 deletion
+15
-21
src/vs/workbench/contrib/scm/browser/scmViewPane.ts
src/vs/workbench/contrib/scm/browser/scmViewPane.ts
+15
-21
未找到文件。
src/vs/workbench/contrib/scm/browser/scmViewPane.ts
浏览文件 @
50bd9c27
...
...
@@ -106,9 +106,6 @@ class ActionButtonRenderer implements ICompressibleTreeRenderer<ISCMActionButton
static
readonly
TEMPLATE_ID
=
'
actionButton
'
;
get
templateId
():
string
{
return
ActionButtonRenderer
.
TEMPLATE_ID
;
}
private
readonly
_onDidChange
=
new
Emitter
<
void
>
();
readonly
onDidChange
:
Event
<
void
>
=
this
.
_onDidChange
.
event
;
constructor
(
@
ICommandService
private
commandService
:
ICommandService
,
@
IThemeService
private
themeService
:
IThemeService
,
...
...
@@ -118,15 +115,14 @@ class ActionButtonRenderer implements ICompressibleTreeRenderer<ISCMActionButton
renderTemplate
(
container
:
HTMLElement
):
ActionButtonTemplate
{
const
buttonContainer
=
append
(
container
,
$
(
'
.button-container
'
));
const
actionButton
=
new
ScmActionButton
(
buttonContainer
,
this
.
commandService
,
this
.
themeService
,
this
.
notificationService
);
const
disposable
=
actionButton
.
onDidChange
(
this
.
_onDidChange
.
fire
,
this
);
return
{
actionButton
,
disposable
:
Disposable
.
None
,
templateDisposable
:
combinedDisposable
(
disposable
,
actionButton
)
};
return
{
actionButton
,
disposable
:
Disposable
.
None
,
templateDisposable
:
actionButton
};
}
renderElement
(
node
:
ITreeNode
<
ISCMActionButton
,
FuzzyScore
>
,
index
:
number
,
templateData
:
ActionButtonTemplate
,
height
:
number
|
undefined
):
void
{
templateData
.
disposable
.
dispose
();
templateData
.
actionButton
.
set
Command
(
node
.
element
.
repository
,
node
.
element
.
button
);
templateData
.
actionButton
.
set
Button
(
node
.
element
.
button
);
}
renderCompressedElements
():
void
{
...
...
@@ -1070,7 +1066,6 @@ class ViewModel {
constructor
(
private
tree
:
WorkbenchCompressibleObjectTree
<
TreeElement
,
FuzzyScore
>
,
private
inputRenderer
:
InputRenderer
,
actionButtonRenderer
:
ActionButtonRenderer
,
private
_mode
:
ViewModelMode
,
private
_treeViewState
:
ITreeViewState
|
undefined
,
@
IInstantiationService
protected
instantiationService
:
IInstantiationService
,
...
...
@@ -1097,7 +1092,6 @@ class ViewModel {
(
this
.
updateRepositoryCollapseAllContextKeys
,
this
,
this
.
disposables
);
this
.
disposables
.
add
(
this
.
tree
.
onDidChangeCollapseState
(()
=>
this
.
_treeViewStateIsStale
=
true
));
this
.
disposables
.
add
(
actionButtonRenderer
.
onDidChange
(()
=>
this
.
refresh
()));
}
private
onDidChangeConfiguration
(
e
?:
IConfigurationChangeEvent
):
void
{
...
...
@@ -1112,7 +1106,12 @@ class ViewModel {
for
(
const
repository
of
added
)
{
const
disposable
=
combinedDisposable
(
repository
.
provider
.
groups
.
onDidSplice
(
splice
=>
this
.
_onDidSpliceGroups
(
item
,
splice
)),
repository
.
input
.
onDidChangeVisibility
(()
=>
this
.
refresh
(
item
))
repository
.
input
.
onDidChangeVisibility
(()
=>
this
.
refresh
(
item
)),
repository
.
provider
.
onDidChange
(()
=>
{
if
(
this
.
showActionButtons
)
{
this
.
refresh
(
item
);
}
})
);
const
groupItems
=
repository
.
provider
.
groups
.
elements
.
map
(
group
=>
this
.
createGroupItem
(
group
));
const
item
:
IRepositoryItem
=
{
...
...
@@ -2048,11 +2047,10 @@ export class SCMViewPane extends ViewPane {
this
.
_register
(
actionRunner
);
this
.
_register
(
actionRunner
.
onBeforeRun
(()
=>
this
.
tree
.
domFocus
()));
const
actionButtonRenderer
=
this
.
instantiationService
.
createInstance
(
ActionButtonRenderer
);
const
renderers
:
ICompressibleTreeRenderer
<
any
,
any
,
any
>
[]
=
[
this
.
instantiationService
.
createInstance
(
RepositoryRenderer
,
getActionViewItemProvider
(
this
.
instantiationService
)),
this
.
inputRenderer
,
actionButtonRenderer
,
this
.
instantiationService
.
createInstance
(
ActionButtonRenderer
)
,
this
.
instantiationService
.
createInstance
(
ResourceGroupRenderer
,
getActionViewItemProvider
(
this
.
instantiationService
)),
this
.
instantiationService
.
createInstance
(
ResourceRenderer
,
()
=>
this
.
_viewModel
,
this
.
listLabels
,
getActionViewItemProvider
(
this
.
instantiationService
),
actionRunner
)
];
...
...
@@ -2108,7 +2106,7 @@ export class SCMViewPane extends ViewPane {
this
.
_register
(
this
.
instantiationService
.
createInstance
(
RepositoryVisibilityActionController
));
this
.
_viewModel
=
this
.
instantiationService
.
createInstance
(
ViewModel
,
this
.
tree
,
this
.
inputRenderer
,
actionButtonRenderer
,
viewMode
,
viewState
);
this
.
_viewModel
=
this
.
instantiationService
.
createInstance
(
ViewModel
,
this
.
tree
,
this
.
inputRenderer
,
viewMode
,
viewState
);
this
.
_register
(
this
.
_viewModel
);
this
.
listContainer
.
classList
.
add
(
'
file-icon-themable-tree
'
);
...
...
@@ -2400,9 +2398,6 @@ registerThemingParticipant((theme, collector) => {
});
export
class
ScmActionButton
implements
IDisposable
{
private
readonly
_onDidChange
=
new
Emitter
<
void
>
();
readonly
onDidChange
:
Event
<
void
>
=
this
.
_onDidChange
.
event
;
private
button
:
Button
|
undefined
;
private
readonly
disposables
=
new
MutableDisposable
<
DisposableStore
>
();
...
...
@@ -2419,18 +2414,18 @@ export class ScmActionButton implements IDisposable {
}
set
Command
(
repository
:
ISCMRepository
,
command
:
Command
|
undefined
):
void
{
set
Button
(
button
:
Command
|
undefined
):
void
{
// Clear old button
this
.
clear
();
if
(
!
command
)
{
if
(
!
button
)
{
return
;
}
this
.
button
=
new
Button
(
this
.
container
,
{
title
:
command
.
tooltip
,
supportIcons
:
true
});
this
.
button
.
label
=
command
.
title
;
this
.
button
=
new
Button
(
this
.
container
,
{
title
:
button
.
tooltip
,
supportIcons
:
true
});
this
.
button
.
label
=
button
.
title
;
this
.
button
.
onDidClick
(
async
()
=>
{
try
{
await
this
.
commandService
.
executeCommand
(
command
!
.
id
,
...(
command
!
.
arguments
||
[]));
await
this
.
commandService
.
executeCommand
(
button
!
.
id
,
...(
button
!
.
arguments
||
[]));
}
catch
(
ex
)
{
this
.
notificationService
.
error
(
ex
);
}
...
...
@@ -2438,7 +2433,6 @@ export class ScmActionButton implements IDisposable {
this
.
disposables
.
value
!
.
add
(
this
.
button
);
this
.
disposables
.
value
!
.
add
(
attachButtonStyler
(
this
.
button
,
this
.
themeService
));
this
.
disposables
.
value
!
.
add
(
repository
.
provider
.
onDidChange
(
this
.
_onDidChange
.
fire
,
this
));
}
private
clear
():
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录