Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9c900345
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,发现更多精彩内容 >>
提交
9c900345
编写于
11月 26, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes #63693
上级
3b55a214
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
48 addition
and
34 deletion
+48
-34
src/vs/workbench/parts/scm/electron-browser/scmMenus.ts
src/vs/workbench/parts/scm/electron-browser/scmMenus.ts
+17
-4
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
+31
-30
未找到文件。
src/vs/workbench/parts/scm/electron-browser/scmMenus.ts
浏览文件 @
9c900345
...
...
@@ -13,6 +13,11 @@ import { fillInContextMenuActions, fillInActionBarActions } from 'vs/platform/ac
import
{
ISCMProvider
,
ISCMResource
,
ISCMResourceGroup
}
from
'
vs/workbench/services/scm/common/scm
'
;
import
{
getSCMResourceContextKey
}
from
'
./scmUtil
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
equals
}
from
'
vs/base/common/arrays
'
;
function
actionEquals
(
a
:
IAction
,
b
:
IAction
):
boolean
{
return
a
.
id
===
b
.
id
;
}
export
class
SCMMenus
implements
IDisposable
{
...
...
@@ -49,10 +54,18 @@ export class SCMMenus implements IDisposable {
}
private
updateTitleActions
():
void
{
this
.
titleActions
=
[];
this
.
titleSecondaryActions
=
[];
// TODO@joao: second arg used to be null
fillInActionBarActions
(
this
.
titleMenu
,
{
shouldForwardArgs
:
true
},
{
primary
:
this
.
titleActions
,
secondary
:
this
.
titleSecondaryActions
});
const
primary
:
IAction
[]
=
[];
const
secondary
:
IAction
[]
=
[];
fillInActionBarActions
(
this
.
titleMenu
,
{
shouldForwardArgs
:
true
},
{
primary
,
secondary
});
if
(
equals
(
primary
,
this
.
titleActions
,
actionEquals
)
&&
equals
(
secondary
,
this
.
titleSecondaryActions
,
actionEquals
))
{
return
;
}
this
.
titleActions
=
primary
;
this
.
titleSecondaryActions
=
secondary
;
this
.
_onDidChangeTitle
.
fire
();
}
...
...
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
浏览文件 @
9c900345
...
...
@@ -24,7 +24,7 @@ import { IContextViewService, IContextMenuService } from 'vs/platform/contextvie
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
MenuItemAction
,
IMenuService
,
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
import
{
MenuItemAction
,
IMenuService
,
MenuId
,
IMenu
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IAction
,
Action
,
IActionItem
,
ActionRunner
}
from
'
vs/base/common/actions
'
;
import
{
fillInContextMenuActions
,
ContextAwareMenuItemActionItem
,
fillInActionBarActions
}
from
'
vs/platform/actions/browser/menuItemActionItem
'
;
import
{
SCMMenus
}
from
'
./scmMenus
'
;
...
...
@@ -39,7 +39,7 @@ import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import
{
StandardMouseEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
format
}
from
'
vs/base/common/strings
'
;
import
{
ISpliceable
,
ISequence
,
ISplice
}
from
'
vs/base/common/sequence
'
;
import
{
firstIndex
}
from
'
vs/base/common/arrays
'
;
import
{
firstIndex
,
equals
}
from
'
vs/base/common/arrays
'
;
import
{
WorkbenchList
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ThrottledDelayer
}
from
'
vs/base/common/async
'
;
...
...
@@ -106,6 +106,29 @@ class StatusBarActionItem extends ActionItem {
}
}
function
connectPrimaryMenuToInlineActionBar
(
menu
:
IMenu
,
actionBar
:
ActionBar
):
IDisposable
{
let
cachedPrimary
:
IAction
[]
=
[];
const
updateActions
=
()
=>
{
const
primary
:
IAction
[]
=
[];
const
secondary
:
IAction
[]
=
[];
const
result
=
{
primary
,
secondary
};
fillInActionBarActions
(
menu
,
{
shouldForwardArgs
:
true
},
result
,
g
=>
/^inline/
.
test
(
g
));
if
(
equals
(
cachedPrimary
,
primary
,
(
a
,
b
)
=>
a
.
id
===
b
.
id
))
{
return
;
}
cachedPrimary
=
primary
;
actionBar
.
clear
();
actionBar
.
push
(
primary
,
{
icon
:
true
,
label
:
false
});
};
updateActions
();
return
menu
.
onDidChange
(
updateActions
);
}
interface
RepositoryTemplateData
{
title
:
HTMLElement
;
type
:
HTMLElement
;
...
...
@@ -413,18 +436,7 @@ class ResourceGroupRenderer implements IListRenderer<ISCMResourceGroup, Resource
const
menu
=
this
.
menuService
.
createMenu
(
MenuId
.
SCMResourceGroupContext
,
contextKeyService
);
disposables
.
push
(
menu
);
const
updateActions
=
()
=>
{
const
primary
:
IAction
[]
=
[];
const
secondary
:
IAction
[]
=
[];
const
result
=
{
primary
,
secondary
};
fillInActionBarActions
(
menu
,
{
shouldForwardArgs
:
true
},
result
,
g
=>
/^inline/
.
test
(
g
));
template
.
actionBar
.
clear
();
template
.
actionBar
.
push
(
primary
,
{
icon
:
true
,
label
:
false
});
};
menu
.
onDidChange
(
updateActions
,
null
,
disposables
);
updateActions
();
disposables
.
push
(
connectPrimaryMenuToInlineActionBar
(
menu
,
template
.
actionBar
));
const
updateCount
=
()
=>
template
.
count
.
setCount
(
group
.
elements
.
length
);
group
.
onDidSplice
(
updateCount
,
null
,
disposables
);
...
...
@@ -433,8 +445,8 @@ class ResourceGroupRenderer implements IListRenderer<ISCMResourceGroup, Resource
template
.
elementDisposable
=
combinedDisposable
(
disposables
);
}
disposeElement
():
void
{
// noop
disposeElement
(
group
:
ISCMResourceGroup
,
index
:
number
,
template
:
ResourceGroupTemplate
):
void
{
template
.
elementDisposable
.
dispose
();
}
disposeTemplate
(
template
:
ResourceGroupTemplate
):
void
{
...
...
@@ -528,18 +540,7 @@ class ResourceRenderer implements IListRenderer<ISCMResource, ResourceTemplate>
const
menu
=
this
.
menuService
.
createMenu
(
MenuId
.
SCMResourceContext
,
contextKeyService
);
disposables
.
push
(
menu
);
const
updateActions
=
()
=>
{
const
primary
:
IAction
[]
=
[];
const
secondary
:
IAction
[]
=
[];
const
result
=
{
primary
,
secondary
};
fillInActionBarActions
(
menu
,
{
shouldForwardArgs
:
true
},
result
,
g
=>
/^inline/
.
test
(
g
));
template
.
actionBar
.
clear
();
template
.
actionBar
.
push
(
primary
,
{
icon
:
true
,
label
:
false
});
};
menu
.
onDidChange
(
updateActions
,
null
,
disposables
);
updateActions
();
disposables
.
push
(
connectPrimaryMenuToInlineActionBar
(
menu
,
template
.
actionBar
));
toggleClass
(
template
.
name
,
'
strike-through
'
,
resource
.
decorations
.
strikeThrough
);
toggleClass
(
template
.
element
,
'
faded
'
,
resource
.
decorations
.
faded
);
...
...
@@ -557,8 +558,8 @@ class ResourceRenderer implements IListRenderer<ISCMResource, ResourceTemplate>
template
.
elementDisposable
=
combinedDisposable
(
disposables
);
}
disposeElement
():
void
{
// noop
disposeElement
(
resource
:
ISCMResource
,
index
:
number
,
template
:
ResourceTemplate
):
void
{
template
.
elementDisposable
.
dispose
();
}
disposeTemplate
(
template
:
ResourceTemplate
):
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录