Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
da84e2e4
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,发现更多精彩内容 >>
提交
da84e2e4
编写于
8月 21, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
scm: input boxes
上级
b6c3338d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
66 addition
and
62 deletion
+66
-62
src/vs/workbench/parts/scm/electron-browser/media/scmViewlet.css
...workbench/parts/scm/electron-browser/media/scmViewlet.css
+6
-6
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
+60
-56
未找到文件。
src/vs/workbench/parts/scm/electron-browser/media/scmViewlet.css
浏览文件 @
da84e2e4
...
@@ -92,27 +92,27 @@
...
@@ -92,27 +92,27 @@
background-repeat
:
no-repeat
;
background-repeat
:
no-repeat
;
}
}
.scm-viewlet
>
.scm-editor
{
.scm-viewlet
.scm-editor
{
padding
:
5px
9px
5px
16px
;
padding
:
5px
9px
5px
16px
;
}
}
.scm-viewlet
>
.scm-editor
{
.scm-viewlet
.scm-editor
{
box-sizing
:
border-box
;
box-sizing
:
border-box
;
padding
:
5px
9px
5px
16px
;
padding
:
5px
9px
5px
16px
;
}
}
.scm-viewlet
>
.scm-editor
>
.monaco-inputbox
{
.scm-viewlet
.scm-editor
>
.monaco-inputbox
{
width
:
100%
;
width
:
100%
;
}
}
.scm-viewlet
>
.scm-editor
>
.monaco-inputbox
>
.wrapper
>
.mirror
{
.scm-viewlet
.scm-editor
>
.monaco-inputbox
>
.wrapper
>
.mirror
{
max-height
:
134px
;
max-height
:
134px
;
}
}
.scm-viewlet
>
.scm-editor
>
.monaco-inputbox
>
.wrapper
>
textarea
.input
{
.scm-viewlet
.scm-editor
>
.monaco-inputbox
>
.wrapper
>
textarea
.input
{
min-height
:
26px
;
min-height
:
26px
;
}
}
.scm-viewlet
>
.scm-editor.scroll
>
.monaco-inputbox
>
.wrapper
>
textarea
.input
{
.scm-viewlet
.scm-editor.scroll
>
.monaco-inputbox
>
.wrapper
>
textarea
.input
{
overflow-y
:
scroll
;
overflow-y
:
scroll
;
}
}
\ No newline at end of file
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
浏览文件 @
da84e2e4
...
@@ -39,7 +39,7 @@ import { ActionBar, IActionItemProvider } from 'vs/base/browser/ui/actionbar/act
...
@@ -39,7 +39,7 @@ import { ActionBar, IActionItemProvider } from 'vs/base/browser/ui/actionbar/act
import
{
IThemeService
,
LIGHT
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IThemeService
,
LIGHT
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
comparePaths
}
from
'
vs/base/common/comparers
'
;
import
{
comparePaths
}
from
'
vs/base/common/comparers
'
;
import
{
isSCMResource
}
from
'
./scmUtil
'
;
import
{
isSCMResource
}
from
'
./scmUtil
'
;
import
{
attachListStyler
,
attachBadgeStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
attachListStyler
,
attachBadgeStyler
,
attachInputBoxStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
IExtensionService
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IExtensionService
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
...
@@ -48,6 +48,11 @@ import { ViewLocation, ViewsRegistry, IViewDescriptor } from 'vs/workbench/parts
...
@@ -48,6 +48,11 @@ import { ViewLocation, ViewsRegistry, IViewDescriptor } from 'vs/workbench/parts
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
ViewSizing
}
from
'
vs/base/browser/ui/splitview/splitview
'
;
import
{
ViewSizing
}
from
'
vs/base/browser/ui/splitview/splitview
'
;
import
{
IExtensionsViewlet
,
VIEWLET_ID
as
EXTENSIONS_VIEWLET_ID
}
from
'
vs/workbench/parts/extensions/common/extensions
'
;
import
{
IExtensionsViewlet
,
VIEWLET_ID
as
EXTENSIONS_VIEWLET_ID
}
from
'
vs/workbench/parts/extensions/common/extensions
'
;
import
{
InputBox
}
from
'
vs/base/browser/ui/inputbox/inputBox
'
;
import
*
as
platform
from
"
vs/base/common/platform
"
;
import
{
domEvent
}
from
"
vs/base/browser/event
"
;
import
{
StandardKeyboardEvent
}
from
"
vs/base/browser/keyboardEvent
"
;
import
{
KeyMod
,
KeyCode
}
from
"
vs/base/common/keyCodes
"
;
// TODO@Joao
// TODO@Joao
// Need to subclass MenuItemActionItem in order to respect
// Need to subclass MenuItemActionItem in order to respect
...
@@ -238,6 +243,8 @@ class SourceControlViewDescriptor implements IViewDescriptor {
...
@@ -238,6 +243,8 @@ class SourceControlViewDescriptor implements IViewDescriptor {
class
SourceControlView
extends
CollapsibleView
{
class
SourceControlView
extends
CollapsibleView
{
private
inputBoxContainer
:
HTMLElement
;
private
inputBox
:
InputBox
;
private
listContainer
:
HTMLElement
;
private
listContainer
:
HTMLElement
;
private
list
:
List
<
ISCMResourceGroup
|
ISCMResource
>
;
private
list
:
List
<
ISCMResourceGroup
|
ISCMResource
>
;
private
menus
:
SCMMenus
;
private
menus
:
SCMMenus
;
...
@@ -249,6 +256,8 @@ class SourceControlView extends CollapsibleView {
...
@@ -249,6 +256,8 @@ class SourceControlView extends CollapsibleView {
@
IKeybindingService
protected
keybindingService
:
IKeybindingService
,
@
IKeybindingService
protected
keybindingService
:
IKeybindingService
,
@
IThemeService
protected
themeService
:
IThemeService
,
@
IThemeService
protected
themeService
:
IThemeService
,
@
IContextMenuService
protected
contextMenuService
:
IContextMenuService
,
@
IContextMenuService
protected
contextMenuService
:
IContextMenuService
,
@
IContextViewService
protected
contextViewService
:
IContextViewService
,
@
ISCMService
protected
scmService
:
ISCMService
,
@
IListService
protected
listService
:
IListService
,
@
IListService
protected
listService
:
IListService
,
@
ICommandService
protected
commandService
:
ICommandService
,
@
ICommandService
protected
commandService
:
ICommandService
,
@
IMessageService
protected
messageService
:
IMessageService
,
@
IMessageService
protected
messageService
:
IMessageService
,
...
@@ -270,6 +279,36 @@ class SourceControlView extends CollapsibleView {
...
@@ -270,6 +279,36 @@ class SourceControlView extends CollapsibleView {
}
}
renderBody
(
container
:
HTMLElement
):
void
{
renderBody
(
container
:
HTMLElement
):
void
{
// Input
this
.
inputBoxContainer
=
append
(
container
,
$
(
'
.scm-editor
'
));
this
.
inputBox
=
new
InputBox
(
this
.
inputBoxContainer
,
this
.
contextViewService
,
{
placeholder
:
localize
(
'
commitMessage
'
,
"
Message (press {0} to commit)
"
,
platform
.
isMacintosh
?
'
Cmd+Enter
'
:
'
Ctrl+Enter
'
),
flexibleHeight
:
true
});
this
.
disposables
.
push
(
attachInputBoxStyler
(
this
.
inputBox
,
this
.
themeService
));
this
.
disposables
.
push
(
this
.
inputBox
);
this
.
inputBox
.
value
=
this
.
scmService
.
input
.
value
;
this
.
inputBox
.
onDidChange
(
value
=>
this
.
scmService
.
input
.
value
=
value
,
null
,
this
.
disposables
);
this
.
scmService
.
input
.
onDidChange
(
value
=>
this
.
inputBox
.
value
=
value
,
null
,
this
.
disposables
);
// this.disposables.push(this.inputBox.onDidHeightChange(() => this.layout()));
chain
(
domEvent
(
this
.
inputBox
.
inputElement
,
'
keydown
'
))
.
map
(
e
=>
new
StandardKeyboardEvent
(
e
))
.
filter
(
e
=>
e
.
equals
(
KeyMod
.
CtrlCmd
|
KeyCode
.
Enter
)
||
e
.
equals
(
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_S
))
.
on
(
this
.
onDidAcceptInput
,
this
,
this
.
disposables
);
if
(
this
.
provider
.
onDidChangeCommitTemplate
)
{
this
.
provider
.
onDidChangeCommitTemplate
(
this
.
updateInputBox
,
this
,
this
.
disposables
);
}
this
.
updateInputBox
();
// List
this
.
listContainer
=
append
(
container
,
$
(
'
.scm-status.show-file-icons
'
));
this
.
listContainer
=
append
(
container
,
$
(
'
.scm-status.show-file-icons
'
));
const
delegate
=
new
Delegate
();
const
delegate
=
new
Delegate
();
...
@@ -374,6 +413,26 @@ class SourceControlView extends CollapsibleView {
...
@@ -374,6 +413,26 @@ class SourceControlView extends CollapsibleView {
.
filter
(
r
=>
isSCMResource
(
r
))
as
ISCMResource
[];
.
filter
(
r
=>
isSCMResource
(
r
))
as
ISCMResource
[];
}
}
private
updateInputBox
():
void
{
if
(
typeof
this
.
provider
.
commitTemplate
===
'
undefined
'
)
{
return
;
}
this
.
inputBox
.
value
=
this
.
provider
.
commitTemplate
;
}
private
onDidAcceptInput
():
void
{
if
(
!
this
.
provider
.
acceptInputCommand
)
{
return
;
}
const
id
=
this
.
provider
.
acceptInputCommand
.
id
;
const
args
=
this
.
provider
.
acceptInputCommand
.
arguments
;
this
.
commandService
.
executeCommand
(
id
,
...
args
)
.
done
(
undefined
,
onUnexpectedError
);
}
dispose
():
void
{
dispose
():
void
{
this
.
disposables
=
dispose
(
this
.
disposables
);
this
.
disposables
=
dispose
(
this
.
disposables
);
super
.
dispose
();
super
.
dispose
();
...
@@ -399,8 +458,6 @@ export class SCMViewlet extends ComposedViewsViewlet {
...
@@ -399,8 +458,6 @@ export class SCMViewlet extends ComposedViewsViewlet {
// private activeProvider: ISCMProvider | undefined;
// private activeProvider: ISCMProvider | undefined;
// private cachedDimension: Dimension;
// private cachedDimension: Dimension;
// private inputBoxContainer: HTMLElement;
// private inputBox: InputBox;
// private providers = new Map<string, ISCMProvider>();
// private providers = new Map<string, ISCMProvider>();
private
disposables
:
IDisposable
[]
=
[];
private
disposables
:
IDisposable
[]
=
[];
...
@@ -442,10 +499,6 @@ export class SCMViewlet extends ComposedViewsViewlet {
...
@@ -442,10 +499,6 @@ export class SCMViewlet extends ComposedViewsViewlet {
// if (activeProvider) {
// if (activeProvider) {
// const disposables = [];
// const disposables = [];
// // if (activeProvider.onDidChangeCommitTemplate) {
// // disposables.push(activeProvider.onDidChangeCommitTemplate(this.updateInputBox, this));
// // }
// const id = activeProvider.id;
// const id = activeProvider.id;
// ViewsRegistry.registerViews([new SourceControlViewDescriptor(activeProvider)]);
// ViewsRegistry.registerViews([new SourceControlViewDescriptor(activeProvider)]);
...
@@ -460,7 +513,6 @@ export class SCMViewlet extends ComposedViewsViewlet {
...
@@ -460,7 +513,6 @@ export class SCMViewlet extends ComposedViewsViewlet {
// this.providerChangeDisposable = EmptyDisposable;
// this.providerChangeDisposable = EmptyDisposable;
// }
// }
// this.updateInputBox();
// this.updateTitleArea();
// this.updateTitleArea();
// }
// }
...
@@ -469,26 +521,6 @@ export class SCMViewlet extends ComposedViewsViewlet {
...
@@ -469,26 +521,6 @@ export class SCMViewlet extends ComposedViewsViewlet {
parent
.
addClass
(
'
scm-viewlet
'
);
parent
.
addClass
(
'
scm-viewlet
'
);
// const root = parent.getHTMLElement();
// this.inputBoxContainer = append(root, $('.scm-editor'));
// this.inputBox = new InputBox(this.inputBoxContainer, this.contextViewService, {
// placeholder: localize('commitMessage', "Message (press {0} to commit)", platform.isMacintosh ? 'Cmd+Enter' : 'Ctrl+Enter'),
// flexibleHeight: true
// });
// this.disposables.push(attachInputBoxStyler(this.inputBox, this.themeService));
// this.disposables.push(this.inputBox);
// this.inputBox.value = this.scmService.input.value;
// this.inputBox.onDidChange(value => this.scmService.input.value = value, null, this.disposables);
// this.scmService.input.onDidChange(value => this.inputBox.value = value, null, this.disposables);
// this.disposables.push(this.inputBox.onDidHeightChange(() => this.layout()));
// chain(domEvent(this.inputBox.inputElement, 'keydown'))
// .map(e => new StandardKeyboardEvent(e))
// .filter(e => e.equals(KeyMod.CtrlCmd | KeyCode.Enter) || e.equals(KeyMod.CtrlCmd | KeyCode.KEY_S))
// .on(this.onDidAcceptInput, this, this.disposables);
this
.
scmService
.
onDidAddProvider
(
this
.
onDidAddProvider
,
this
,
this
.
disposables
);
this
.
scmService
.
onDidAddProvider
(
this
.
onDidAddProvider
,
this
,
this
.
disposables
);
this
.
scmService
.
onDidRemoveProvider
(
this
.
onDidRemoveProvider
,
this
,
this
.
disposables
);
this
.
scmService
.
onDidRemoveProvider
(
this
.
onDidRemoveProvider
,
this
,
this
.
disposables
);
this
.
scmService
.
providers
.
forEach
(
p
=>
this
.
onDidAddProvider
(
p
));
this
.
scmService
.
providers
.
forEach
(
p
=>
this
.
onDidAddProvider
(
p
));
...
@@ -505,34 +537,6 @@ export class SCMViewlet extends ComposedViewsViewlet {
...
@@ -505,34 +537,6 @@ export class SCMViewlet extends ComposedViewsViewlet {
return
this
.
instantiationService
.
createInstance
(
viewDescriptor
.
ctor
,
options
);
return
this
.
instantiationService
.
createInstance
(
viewDescriptor
.
ctor
,
options
);
}
}
// private onDidAcceptInput(): void {
// if (!this.activeProvider) {
// return;
// }
// if (!this.activeProvider.acceptInputCommand) {
// return;
// }
// const id = this.activeProvider.acceptInputCommand.id;
// const args = this.activeProvider.acceptInputCommand.arguments;
// this.commandService.executeCommand(id, ...args)
// .done(undefined, onUnexpectedError);
// }
// private updateInputBox(): void {
// if (!this.activeProvider) {
// return;
// }
// if (typeof this.activeProvider.commitTemplate === 'undefined') {
// return;
// }
// this.inputBox.value = this.activeProvider.commitTemplate;
// }
// layout(dimension: Dimension = this.cachedDimension): void {
// layout(dimension: Dimension = this.cachedDimension): void {
// if (!dimension) {
// if (!dimension) {
// return;
// return;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录