Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f1f5385a
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,发现更多精彩内容 >>
提交
f1f5385a
编写于
10月 23, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
SourceControlInputBox.visible API
上级
4925df27
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
135 addition
and
81 deletion
+135
-81
extensions/git/src/repository.ts
extensions/git/src/repository.ts
+1
-0
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+12
-2
src/vs/workbench/api/electron-browser/mainThreadSCM.ts
src/vs/workbench/api/electron-browser/mainThreadSCM.ts
+10
-1
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-1
src/vs/workbench/api/node/extHostSCM.ts
src/vs/workbench/api/node/extHostSCM.ts
+12
-11
src/vs/workbench/parts/scm/electron-browser/media/scmViewlet.css
...workbench/parts/scm/electron-browser/media/scmViewlet.css
+3
-3
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
+79
-61
src/vs/workbench/services/scm/common/scm.ts
src/vs/workbench/services/scm/common/scm.ts
+3
-2
src/vs/workbench/services/scm/common/scmService.ts
src/vs/workbench/services/scm/common/scmService.ts
+14
-0
未找到文件。
extensions/git/src/repository.ts
浏览文件 @
f1f5385a
...
...
@@ -570,6 +570,7 @@ export class Repository implements Disposable {
const
root
=
Uri
.
file
(
repository
.
root
);
this
.
_sourceControl
=
scm
.
createSourceControl
(
'
git
'
,
'
Git
'
,
root
);
this
.
_sourceControl
.
inputBox
.
placeholder
=
localize
(
'
commitMessage
'
,
"
Message (press {0} to commit)
"
);
this
.
_sourceControl
.
inputBox
.
visible
=
false
;
this
.
_sourceControl
.
acceptInputCommand
=
{
command
:
'
git.commitWithInput
'
,
title
:
localize
(
'
commit
'
,
"
Commit
"
),
arguments
:
[
this
.
_sourceControl
]
};
this
.
_sourceControl
.
quickDiffProvider
=
this
;
this
.
_sourceControl
.
inputBox
.
validateInput
=
this
.
validateInput
.
bind
(
this
);
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
f1f5385a
...
...
@@ -720,11 +720,21 @@ declare module 'vscode' {
* An event signaling when the selection state changes.
*/
readonly
onDidChangeSelection
:
Event
<
boolean
>
;
}
//#endregion
//#region Joao: SCM Input Box
/**
* Represents the input box in the Source Control viewlet.
*/
export
interface
SourceControlInputBox
{
/**
* Whether the input box is
hidden
.
* Whether the input box is
visible
.
*/
hideInputBox
:
boolean
;
visible
:
boolean
;
}
//#endregion
...
...
src/vs/workbench/api/electron-browser/mainThreadSCM.ts
浏览文件 @
f1f5385a
...
...
@@ -119,7 +119,6 @@ class MainThreadSCMProvider implements ISCMProvider {
get
acceptInputCommand
():
Command
|
undefined
{
return
this
.
features
.
acceptInputCommand
;
}
get
statusBarCommands
():
Command
[]
|
undefined
{
return
this
.
features
.
statusBarCommands
;
}
get
count
():
number
|
undefined
{
return
this
.
features
.
count
;
}
get
hideInputBox
():
boolean
|
undefined
{
return
this
.
features
.
hideInputBox
;
}
private
_onDidChangeCommitTemplate
=
new
Emitter
<
string
>
();
get
onDidChangeCommitTemplate
():
Event
<
string
>
{
return
this
.
_onDidChangeCommitTemplate
.
event
;
}
...
...
@@ -396,6 +395,16 @@ export class MainThreadSCM implements MainThreadSCMShape {
repository
.
input
.
placeholder
=
placeholder
;
}
$setInputBoxVisibility
(
sourceControlHandle
:
number
,
visible
:
boolean
):
void
{
const
repository
=
this
.
_repositories
[
sourceControlHandle
];
if
(
!
repository
)
{
return
;
}
repository
.
input
.
visible
=
visible
;
}
$setValidationProviderIsEnabled
(
sourceControlHandle
:
number
,
enabled
:
boolean
):
void
{
const
repository
=
this
.
_repositories
[
sourceControlHandle
];
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
f1f5385a
...
...
@@ -535,7 +535,6 @@ export interface SCMProviderFeatures {
commitTemplate
?:
string
;
acceptInputCommand
?:
modes
.
Command
;
statusBarCommands
?:
modes
.
Command
[];
hideInputBox
?:
boolean
;
}
export
interface
SCMGroupFeatures
{
...
...
@@ -580,6 +579,7 @@ export interface MainThreadSCMShape extends IDisposable {
$setInputBoxValue
(
sourceControlHandle
:
number
,
value
:
string
):
void
;
$setInputBoxPlaceholder
(
sourceControlHandle
:
number
,
placeholder
:
string
):
void
;
$setInputBoxVisibility
(
sourceControlHandle
:
number
,
visible
:
boolean
):
void
;
$setValidationProviderIsEnabled
(
sourceControlHandle
:
number
,
enabled
:
boolean
):
void
;
}
...
...
src/vs/workbench/api/node/extHostSCM.ts
浏览文件 @
f1f5385a
...
...
@@ -198,6 +198,18 @@ export class ExtHostSCMInputBox implements vscode.SourceControlInputBox {
this
.
_proxy
.
$setValidationProviderIsEnabled
(
this
.
_sourceControlHandle
,
!!
fn
);
}
private
_visible
:
boolean
=
true
;
get
visible
():
boolean
{
return
this
.
_visible
;
}
set
visible
(
visible
:
boolean
|
undefined
)
{
visible
=
!!
visible
;
this
.
_visible
=
visible
;
this
.
_proxy
.
$setInputBoxVisibility
(
this
.
_sourceControlHandle
,
visible
);
}
constructor
(
private
_extension
:
IExtensionDescription
,
private
_proxy
:
MainThreadSCMShape
,
private
_sourceControlHandle
:
number
)
{
// noop
}
...
...
@@ -439,17 +451,6 @@ class ExtHostSourceControl implements vscode.SourceControl {
return
this
.
_selected
;
}
private
_hideInputBox
:
boolean
=
false
;
get
hideInputBox
():
boolean
{
return
this
.
_hideInputBox
;
}
set
hideInputBox
(
hideInputBox
:
boolean
|
undefined
)
{
this
.
_hideInputBox
=
hideInputBox
;
this
.
_proxy
.
$updateSourceControl
(
this
.
handle
,
{
hideInputBox
:
!!
hideInputBox
});
}
private
_onDidChangeSelection
=
new
Emitter
<
boolean
>
();
readonly
onDidChangeSelection
=
this
.
_onDidChangeSelection
.
event
;
...
...
src/vs/workbench/parts/scm/electron-browser/media/scmViewlet.css
浏览文件 @
f1f5385a
...
...
@@ -137,12 +137,12 @@
}
.scm-viewlet
.scm-editor
{
box-sizing
:
border-box
;
padding
:
5px
9px
5px
16px
;
}
.scm-viewlet
.scm-editor
{
box-sizing
:
border-box
;
padding
:
5px
9px
5px
16px
;
.scm-viewlet
.scm-editor.hidden
{
display
:
none
;
}
.scm-viewlet
.scm-editor
>
.monaco-inputbox
{
...
...
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
浏览文件 @
f1f5385a
...
...
@@ -11,7 +11,7 @@ import { domEvent, stop } from 'vs/base/browser/event';
import
{
basename
}
from
'
vs/base/common/paths
'
;
import
{
IDisposable
,
dispose
,
combinedDisposable
,
Disposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
PanelViewlet
,
ViewletPanel
,
IViewletPanelOptions
}
from
'
vs/workbench/browser/parts/views/panelViewlet
'
;
import
{
append
,
$
,
addClass
,
toggleClass
,
trackFocus
,
Dimension
,
addDisposableListener
}
from
'
vs/base/browser/dom
'
;
import
{
append
,
$
,
addClass
,
toggleClass
,
trackFocus
,
Dimension
,
addDisposableListener
,
removeClass
}
from
'
vs/base/browser/dom
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
List
}
from
'
vs/base/browser/ui/list/listWidget
'
;
import
{
IListVirtualDelegate
,
IListRenderer
,
IListContextMenuEvent
,
IListEvent
}
from
'
vs/base/browser/ui/list/list
'
;
...
...
@@ -814,59 +814,61 @@ export class RepositoryPanel extends ViewletPanel {
this
.
disposables
.
push
(
focusTracker
);
// Input
if
(
!
this
.
repository
.
provider
.
hideInputBox
)
{
this
.
inputBoxContainer
=
append
(
container
,
$
(
'
.scm-editor
'
));
const
updatePlaceholder
=
()
=>
{
const
binding
=
this
.
keybindingService
.
lookupKeybinding
(
'
scm.acceptInput
'
);
const
label
=
binding
?
binding
.
getLabel
()
:
(
platform
.
isMacintosh
?
'
Cmd+Enter
'
:
'
Ctrl+Enter
'
);
const
placeholder
=
format
(
this
.
repository
.
input
.
placeholder
,
label
);
this
.
inputBox
.
setPlaceHolder
(
placeholder
);
};
const
validationDelayer
=
new
ThrottledDelayer
<
any
>
(
200
);
const
validate
=
()
=>
{
return
this
.
repository
.
input
.
validateInput
(
this
.
inputBox
.
value
,
this
.
inputBox
.
inputElement
.
selectionStart
).
then
(
result
=>
{
if
(
!
result
)
{
this
.
inputBox
.
inputElement
.
removeAttribute
(
'
aria-invalid
'
);
this
.
inputBox
.
hideMessage
();
}
else
{
this
.
inputBox
.
inputElement
.
setAttribute
(
'
aria-invalid
'
,
'
true
'
);
this
.
inputBox
.
showMessage
({
content
:
result
.
message
,
type
:
convertValidationType
(
result
.
type
)
});
}
});
};
const
triggerValidation
=
()
=>
validationDelayer
.
trigger
(
validate
);
this
.
inputBox
=
new
InputBox
(
this
.
inputBoxContainer
,
this
.
contextViewService
,
{
flexibleHeight
:
true
});
this
.
disposables
.
push
(
attachInputBoxStyler
(
this
.
inputBox
,
this
.
themeService
));
this
.
disposables
.
push
(
this
.
inputBox
);
this
.
inputBox
.
onDidChange
(
triggerValidation
,
null
,
this
.
disposables
);
const
onKeyUp
=
domEvent
(
this
.
inputBox
.
inputElement
,
'
keyup
'
);
const
onMouseUp
=
domEvent
(
this
.
inputBox
.
inputElement
,
'
mouseup
'
);
anyEvent
<
any
>
(
onKeyUp
,
onMouseUp
)(
triggerValidation
,
null
,
this
.
disposables
);
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
);
updatePlaceholder
();
this
.
repository
.
input
.
onDidChangePlaceholder
(
updatePlaceholder
,
null
,
this
.
disposables
);
this
.
keybindingService
.
onDidUpdateKeybindings
(
updatePlaceholder
,
null
,
this
.
disposables
);
this
.
disposables
.
push
(
this
.
inputBox
.
onDidHeightChange
(()
=>
this
.
layoutBody
()));
if
(
this
.
repository
.
provider
.
onDidChangeCommitTemplate
)
{
this
.
repository
.
provider
.
onDidChangeCommitTemplate
(
this
.
updateInputBox
,
this
,
this
.
disposables
);
}
this
.
inputBoxContainer
=
append
(
container
,
$
(
'
.scm-editor
'
));
const
updatePlaceholder
=
()
=>
{
const
binding
=
this
.
keybindingService
.
lookupKeybinding
(
'
scm.acceptInput
'
);
const
label
=
binding
?
binding
.
getLabel
()
:
(
platform
.
isMacintosh
?
'
Cmd+Enter
'
:
'
Ctrl+Enter
'
);
const
placeholder
=
format
(
this
.
repository
.
input
.
placeholder
,
label
);
this
.
inputBox
.
setPlaceHolder
(
placeholder
);
};
const
validationDelayer
=
new
ThrottledDelayer
<
any
>
(
200
);
const
validate
=
()
=>
{
return
this
.
repository
.
input
.
validateInput
(
this
.
inputBox
.
value
,
this
.
inputBox
.
inputElement
.
selectionStart
).
then
(
result
=>
{
if
(
!
result
)
{
this
.
inputBox
.
inputElement
.
removeAttribute
(
'
aria-invalid
'
);
this
.
inputBox
.
hideMessage
();
}
else
{
this
.
inputBox
.
inputElement
.
setAttribute
(
'
aria-invalid
'
,
'
true
'
);
this
.
inputBox
.
showMessage
({
content
:
result
.
message
,
type
:
convertValidationType
(
result
.
type
)
});
}
});
};
const
triggerValidation
=
()
=>
validationDelayer
.
trigger
(
validate
);
this
.
inputBox
=
new
InputBox
(
this
.
inputBoxContainer
,
this
.
contextViewService
,
{
flexibleHeight
:
true
});
this
.
disposables
.
push
(
attachInputBoxStyler
(
this
.
inputBox
,
this
.
themeService
));
this
.
disposables
.
push
(
this
.
inputBox
);
this
.
inputBox
.
onDidChange
(
triggerValidation
,
null
,
this
.
disposables
);
const
onKeyUp
=
domEvent
(
this
.
inputBox
.
inputElement
,
'
keyup
'
);
const
onMouseUp
=
domEvent
(
this
.
inputBox
.
inputElement
,
'
mouseup
'
);
anyEvent
<
any
>
(
onKeyUp
,
onMouseUp
)(
triggerValidation
,
null
,
this
.
disposables
);
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
.
updateInputBox
();
updatePlaceholder
();
this
.
repository
.
input
.
onDidChangePlaceholder
(
updatePlaceholder
,
null
,
this
.
disposables
);
this
.
keybindingService
.
onDidUpdateKeybindings
(
updatePlaceholder
,
null
,
this
.
disposables
);
this
.
disposables
.
push
(
this
.
inputBox
.
onDidHeightChange
(()
=>
this
.
layoutBody
()));
if
(
this
.
repository
.
provider
.
onDidChangeCommitTemplate
)
{
this
.
repository
.
provider
.
onDidChangeCommitTemplate
(
this
.
updateInputBox
,
this
,
this
.
disposables
);
}
this
.
updateInputBox
();
// Input box visibility
this
.
repository
.
input
.
onDidChangeVisibility
(
this
.
updateInputBoxVisibility
,
this
,
this
.
disposables
);
this
.
updateInputBoxVisibility
();
// List
this
.
listContainer
=
append
(
container
,
$
(
'
.scm-status.show-file-icons
'
));
...
...
@@ -920,25 +922,35 @@ export class RepositoryPanel extends ViewletPanel {
}
this
.
cachedHeight
=
height
;
if
(
this
.
inputBox
)
{
if
(
this
.
repository
.
input
.
visible
)
{
removeClass
(
this
.
inputBoxContainer
,
'
hidden
'
);
this
.
inputBox
.
layout
();
}
const
editorHeight
=
this
.
inputBox
?
this
.
inputBox
.
height
:
0
;
const
listHeight
=
height
-
(
editorHeight
+
(
editorHeight
?
12
:
0
)
/* margin */
);
this
.
listContainer
.
style
.
height
=
`
${
listHeight
}
px`
;
this
.
list
.
layout
(
listHeight
);
const
editorHeight
=
this
.
inputBox
.
height
;
const
listHeight
=
height
-
(
editorHeight
+
12
/* margin */
);
this
.
listContainer
.
style
.
height
=
`
${
listHeight
}
px`
;
this
.
list
.
layout
(
listHeight
);
if
(
this
.
inputBoxContainer
)
{
toggleClass
(
this
.
inputBoxContainer
,
'
scroll
'
,
editorHeight
>=
134
);
}
else
{
addClass
(
this
.
inputBoxContainer
,
'
hidden
'
);
removeClass
(
this
.
inputBoxContainer
,
'
scroll
'
);
this
.
listContainer
.
style
.
height
=
`
${
height
}
px`
;
this
.
list
.
layout
(
height
);
}
}
focus
():
void
{
super
.
focus
();
if
(
this
.
isExpanded
()
&&
this
.
inputBox
)
{
this
.
inputBox
.
focus
();
if
(
this
.
isExpanded
())
{
if
(
this
.
repository
.
input
.
visible
)
{
this
.
inputBox
.
focus
();
}
else
{
this
.
list
.
domFocus
();
}
}
}
...
...
@@ -997,13 +1009,19 @@ export class RepositoryPanel extends ViewletPanel {
}
private
updateInputBox
():
void
{
if
(
typeof
this
.
repository
.
provider
.
commitTemplate
===
'
undefined
'
||
!
this
.
inputBox
||
this
.
inputBox
.
value
)
{
if
(
typeof
this
.
repository
.
provider
.
commitTemplate
===
'
undefined
'
||
!
this
.
repository
.
input
.
visible
||
this
.
inputBox
.
value
)
{
return
;
}
this
.
inputBox
.
value
=
this
.
repository
.
provider
.
commitTemplate
;
}
private
updateInputBoxVisibility
():
void
{
if
(
this
.
cachedHeight
)
{
this
.
layoutBody
(
this
.
cachedHeight
);
}
}
dispose
():
void
{
this
.
visibilityDisposables
=
dispose
(
this
.
visibilityDisposables
);
super
.
dispose
();
...
...
src/vs/workbench/services/scm/common/scm.ts
浏览文件 @
f1f5385a
...
...
@@ -63,8 +63,6 @@ export interface ISCMProvider extends IDisposable {
readonly
statusBarCommands
?:
Command
[];
readonly
onDidChange
:
Event
<
void
>
;
readonly
hideInputBox
?:
boolean
|
undefined
;
getOriginalResource
(
uri
:
URI
):
TPromise
<
URI
>
;
}
...
...
@@ -92,6 +90,9 @@ export interface ISCMInput {
validateInput
:
IInputValidator
;
readonly
onDidChangeValidateInput
:
Event
<
void
>
;
visible
:
boolean
;
readonly
onDidChangeVisibility
:
Event
<
boolean
>
;
}
export
interface
ISCMRepository
extends
IDisposable
{
...
...
src/vs/workbench/services/scm/common/scmService.ts
浏览文件 @
f1f5385a
...
...
@@ -40,6 +40,20 @@ class SCMInput implements ISCMInput {
private
_onDidChangePlaceholder
=
new
Emitter
<
string
>
();
get
onDidChangePlaceholder
():
Event
<
string
>
{
return
this
.
_onDidChangePlaceholder
.
event
;
}
private
_visible
=
true
;
get
visible
():
boolean
{
return
this
.
_visible
;
}
set
visible
(
visible
:
boolean
)
{
this
.
_visible
=
visible
;
this
.
_onDidChangeVisibility
.
fire
(
visible
);
}
private
_onDidChangeVisibility
=
new
Emitter
<
boolean
>
();
get
onDidChangeVisibility
():
Event
<
boolean
>
{
return
this
.
_onDidChangeVisibility
.
event
;
}
private
_validateInput
:
IInputValidator
=
()
=>
TPromise
.
as
(
undefined
);
get
validateInput
():
IInputValidator
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录