Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7d3b4faa
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,发现更多精彩内容 >>
提交
7d3b4faa
编写于
8月 22, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
git, scm cleanup
上级
0215be15
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
63 deletion
+49
-63
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+9
-1
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
+40
-62
未找到文件。
extensions/git/src/commands.ts
浏览文件 @
7d3b4faa
...
...
@@ -1220,7 +1220,15 @@ export class CommandCenter {
}
else
{
// try to guess the repository based on the first argument
const
repository
=
this
.
model
.
getRepository
(
args
[
0
]);
const
repositoryPromise
=
repository
?
Promise
.
resolve
(
repository
)
:
this
.
model
.
pickRepository
();
let
repositoryPromise
:
Promise
<
Repository
|
undefined
>
;
if
(
repository
)
{
repositoryPromise
=
Promise
.
resolve
(
repository
);
}
else
if
(
this
.
model
.
repositories
.
length
===
1
)
{
repositoryPromise
=
Promise
.
resolve
(
this
.
model
.
repositories
[
0
]);
}
else
{
repositoryPromise
=
this
.
model
.
pickRepository
();
}
result
=
repositoryPromise
.
then
(
repository
=>
{
if
(
!
repository
)
{
...
...
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
浏览文件 @
7d3b4faa
...
...
@@ -139,6 +139,7 @@ interface ResourceTemplate {
fileLabel
:
FileLabel
;
decorationIcon
:
HTMLElement
;
actionBar
:
ActionBar
;
dispose
:
()
=>
void
;
}
class
MultipleSelectionActionRunner
extends
ActionRunner
{
...
...
@@ -188,7 +189,12 @@ class ResourceRenderer implements IRenderer<ISCMResource, ResourceTemplate> {
const
decorationIcon
=
append
(
element
,
$
(
'
.decoration-icon
'
));
return
{
element
,
name
,
fileLabel
,
decorationIcon
,
actionBar
};
return
{
element
,
name
,
fileLabel
,
decorationIcon
,
actionBar
,
dispose
:
()
=>
{
actionBar
.
dispose
();
fileLabel
.
dispose
();
}
};
}
renderElement
(
resource
:
ISCMResource
,
index
:
number
,
template
:
ResourceTemplate
):
void
{
...
...
@@ -211,7 +217,7 @@ class ResourceRenderer implements IRenderer<ISCMResource, ResourceTemplate> {
}
disposeTemplate
(
template
:
ResourceTemplate
):
void
{
// noop
template
.
dispose
();
}
}
...
...
@@ -236,13 +242,12 @@ class SourceControlViewDescriptor implements IViewDescriptor {
get
ctor
():
any
{
return
null
;
}
get
location
():
ViewLocation
{
return
ViewLocation
.
SCM
;
}
constructor
(
private
_repository
:
ISCMRepository
)
{
}
constructor
(
private
_repository
:
ISCMRepository
)
{
}
}
class
SourceControlView
extends
CollapsibleView
{
private
cachedHeight
:
number
|
undefined
;
private
inputBoxContainer
:
HTMLElement
;
private
inputBox
:
InputBox
;
private
listContainer
:
HTMLElement
;
...
...
@@ -295,7 +300,7 @@ class SourceControlView extends CollapsibleView {
this
.
inputBox
.
value
=
this
.
repository
.
input
.
value
;
this
.
inputBox
.
onDidChange
(
value
=>
this
.
repository
.
input
.
value
=
value
,
null
,
this
.
disposables
);
this
.
repository
.
input
.
onDidChange
(
value
=>
this
.
inputBox
.
value
=
value
,
null
,
this
.
disposables
);
// this.disposables.push(this.inputBox.onDidHeightChange(() => this.layout
()));
this
.
disposables
.
push
(
this
.
inputBox
.
onDidHeightChange
(()
=>
this
.
layoutBody
()));
chain
(
domEvent
(
this
.
inputBox
.
inputElement
,
'
keydown
'
))
.
map
(
e
=>
new
StandardKeyboardEvent
(
e
))
...
...
@@ -345,8 +350,25 @@ class SourceControlView extends CollapsibleView {
this
.
updateList
();
}
layoutBody
(
size
:
number
):
void
{
this
.
list
.
layout
(
size
);
layoutBody
(
height
:
number
=
this
.
cachedHeight
):
void
{
if
(
!
height
===
undefined
)
{
return
;
}
this
.
list
.
layout
(
height
);
this
.
cachedHeight
=
height
;
this
.
inputBox
.
layout
();
const
editorHeight
=
this
.
inputBox
.
height
;
const
listHeight
=
height
-
(
editorHeight
+
12
/* margin */
);
this
.
listContainer
.
style
.
height
=
`
${
listHeight
}
px`
;
this
.
list
.
layout
(
listHeight
);
toggleClass
(
this
.
inputBoxContainer
,
'
scroll
'
,
editorHeight
>=
134
);
}
focusBody
():
void
{
this
.
inputBox
.
focus
();
}
getActions
():
IAction
[]
{
...
...
@@ -457,10 +479,6 @@ class InstallAdditionalSCMProvidersAction extends Action {
export
class
SCMViewlet
extends
ComposedViewsViewlet
{
// private activeProvider: ISCMProvider | undefined;
// private cachedDimension: Dimension;
// private providers = new Map<string, ISCMProvider>();
private
disposables
:
IDisposable
[]
=
[];
constructor
(
...
...
@@ -481,42 +499,21 @@ export class SCMViewlet extends ComposedViewsViewlet {
@
IStorageService
storageService
:
IStorageService
,
@
IExtensionService
extensionService
:
IExtensionService
)
{
super
(
VIEWLET_ID
,
ViewLocation
.
SCM
,
`
${
VIEWLET_ID
}
.state`
,
fals
e
,
super
(
VIEWLET_ID
,
ViewLocation
.
SCM
,
`
${
VIEWLET_ID
}
.state`
,
tru
e
,
telemetryService
,
storageService
,
instantiationService
,
themeService
,
contextService
,
contextKeyService
,
contextMenuService
,
extensionService
);
}
private
onDidAddRepository
(
repository
:
ISCMRepository
):
void
{
const
view
=
new
SourceControlViewDescriptor
(
repository
);
ViewsRegistry
.
registerViews
([
view
]);
this
.
updateTitleArea
();
}
private
onDidRemoveRepository
(
repository
:
ISCMRepository
):
void
{
ViewsRegistry
.
deregisterViews
([
repository
.
provider
.
id
],
ViewLocation
.
SCM
);
this
.
updateTitleArea
();
}
// private onDidProvidersChange(): void {
// this.activeProvider = activeProvider;
// if (activeProvider) {
// const disposables = [];
// const id = activeProvider.id;
// ViewsRegistry.registerViews([new SourceControlViewDescriptor(activeProvider)]);
// disposables.push({
// dispose: () => {
// ViewsRegistry.deregisterViews([id], ViewLocation.SCM);
// }
// });
// this.providerChangeDisposable = combinedDisposable(disposables);
// } else {
// this.providerChangeDisposable = EmptyDisposable;
// }
// this.updateTitleArea();
// }
async
create
(
parent
:
Builder
):
TPromise
<
void
>
{
await
super
.
create
(
parent
);
...
...
@@ -525,9 +522,6 @@ export class SCMViewlet extends ComposedViewsViewlet {
this
.
scmService
.
onDidAddRepository
(
this
.
onDidAddRepository
,
this
,
this
.
disposables
);
this
.
scmService
.
onDidRemoveRepository
(
this
.
onDidRemoveRepository
,
this
,
this
.
disposables
);
this
.
scmService
.
repositories
.
forEach
(
p
=>
this
.
onDidAddRepository
(
p
));
// this.themeService.onThemeChange(this.update, this, this.disposables);
// return TPromise.as(null);
}
protected
createView
(
viewDescriptor
:
IViewDescriptor
,
options
:
IViewletViewOptions
):
IView
{
...
...
@@ -538,40 +532,24 @@ export class SCMViewlet extends ComposedViewsViewlet {
return
this
.
instantiationService
.
createInstance
(
viewDescriptor
.
ctor
,
options
);
}
// layout(dimension: Dimension = this.cachedDimension): void {
// if (!dimension) {
// return;
// }
// this.cachedDimension = dimension;
// this.inputBox.layout();
// const editorHeight = this.inputBox.height;
// const listHeight = dimension.height - (editorHeight + 12 /* margin */);
// this.listContainer.style.height = `${listHeight}px`;
// this.list.layout(listHeight);
// toggleClass(this.inputBoxContainer, 'scroll', editorHeight >= 134);
// }
getOptimalWidth
():
number
{
return
400
;
}
focus
():
void
{
super
.
focus
();
// this.inputBox.focus();
}
getTitle
():
string
{
const
title
=
localize
(
'
source control
'
,
"
Source Control
"
);
// const providerLabel = this.scmService.activeProvider && this.scmService.activeProvider.label
;
const
views
=
ViewsRegistry
.
getViews
(
ViewLocation
.
SCM
)
;
// if (providerLabel) {
// return localize('viewletTitle', "{0}: {1}", title, providerLabel);
// } else {
return
title
;
// }
if
(
views
.
length
===
1
)
{
const
view
=
views
[
0
];
return
localize
(
'
viewletTitle
'
,
"
{0}: {1}
"
,
title
,
view
.
name
);
}
else
{
return
title
;
}
}
@
memoize
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录