Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
c361c4a3
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,发现更多精彩内容 >>
提交
c361c4a3
编写于
6月 18, 2018
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Back button constant (#49340)
上级
2afaa0d6
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
82 addition
and
11 deletion
+82
-11
src/vs/platform/quickinput/common/quickInput.ts
src/vs/platform/quickinput/common/quickInput.ts
+4
-0
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+4
-2
src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts
src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts
+12
-6
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+5
-0
src/vs/workbench/api/node/extHostQuickOpen.ts
src/vs/workbench/api/node/extHostQuickOpen.ts
+7
-2
src/vs/workbench/browser/parts/quickinput/media/dark/back.svg
...vs/workbench/browser/parts/quickinput/media/dark/back.svg
+1
-0
src/vs/workbench/browser/parts/quickinput/media/light/back.svg
...s/workbench/browser/parts/quickinput/media/light/back.svg
+1
-0
src/vs/workbench/browser/parts/quickinput/quickInput.contribution.ts
...bench/browser/parts/quickinput/quickInput.contribution.ts
+9
-1
src/vs/workbench/browser/parts/quickinput/quickInput.ts
src/vs/workbench/browser/parts/quickinput/quickInput.ts
+39
-0
未找到文件。
src/vs/platform/quickinput/common/quickInput.ts
浏览文件 @
c361c4a3
...
...
@@ -184,6 +184,8 @@ export interface IQuickInputService {
*/
input
(
options
?:
IInputOptions
,
token
?:
CancellationToken
):
TPromise
<
string
>
;
backButton
:
IQuickInputButton
;
createQuickPick
():
IQuickPick
;
createInputBox
():
IInputBox
;
...
...
@@ -195,5 +197,7 @@ export interface IQuickInputService {
accept
():
TPromise
<
void
>
;
back
():
TPromise
<
void
>
;
cancel
():
TPromise
<
void
>
;
}
src/vs/vscode.proposed.d.ts
浏览文件 @
c361c4a3
...
...
@@ -523,6 +523,8 @@ declare module 'vscode' {
export
namespace
window
{
export
const
quickInputBackButton
:
QuickInputButton
;
/**
* Implementation incomplete. See #49340.
*/
...
...
@@ -610,8 +612,8 @@ declare module 'vscode' {
}
export
interface
QuickInputButton
{
iconPath
:
string
|
Uri
|
{
light
:
string
|
Uri
;
dark
:
string
|
Uri
}
|
ThemeIcon
;
tooltip
?:
string
|
undefined
;
readonly
iconPath
:
string
|
Uri
|
{
light
:
string
|
Uri
;
dark
:
string
|
Uri
}
|
ThemeIcon
;
readonly
tooltip
?:
string
|
undefined
;
}
//#endregion
...
...
src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts
浏览文件 @
c361c4a3
...
...
@@ -170,14 +170,20 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape {
session
.
hide
();
}
}
else
if
(
param
===
'
buttons
'
)
{
params
.
buttons
.
forEach
(
button
=>
{
const
iconPath
=
button
.
iconPath
;
iconPath
.
dark
=
URI
.
revive
(
iconPath
.
dark
);
if
(
iconPath
.
light
)
{
iconPath
.
light
=
URI
.
revive
(
iconPath
.
light
);
session
[
param
]
=
params
.
buttons
.
map
(
button
=>
{
if
(
button
.
handle
===
-
1
)
{
return
this
.
_quickInputService
.
backButton
;
}
const
{
iconPath
,
tooltip
,
handle
}
=
button
;
return
{
iconPath
:
{
dark
:
URI
.
revive
(
iconPath
.
dark
),
light
:
iconPath
.
light
&&
URI
.
revive
(
iconPath
.
light
)
},
tooltip
,
handle
};
});
session
[
param
]
=
params
[
param
];
}
else
{
session
[
param
]
=
params
[
param
];
}
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
c361c4a3
...
...
@@ -455,6 +455,11 @@ export function createApiFactory(
registerProtocolHandler
:
proposedApiFunction
(
extension
,
(
handler
:
vscode
.
ProtocolHandler
)
=>
{
return
extHostUrls
.
registerProtocolHandler
(
extension
.
id
,
handler
);
}),
get
quickInputBackButton
()
{
return
proposedApiFunction
(
extension
,
():
vscode
.
QuickInputButton
=>
{
return
extHostQuickOpen
.
backButton
;
})();
},
createQuickPick
:
proposedApiFunction
(
extension
,
():
vscode
.
QuickPick
=>
{
return
extHostQuickOpen
.
createQuickPick
(
extension
.
id
);
}),
...
...
src/vs/workbench/api/node/extHostQuickOpen.ts
浏览文件 @
c361c4a3
...
...
@@ -16,6 +16,8 @@ import { ExtHostQuickOpenShape, IMainContext, MainContext, MainThreadQuickOpenSh
import
URI
from
'
vs/base/common/uri
'
;
import
{
ThemeIcon
}
from
'
vs/workbench/api/node/extHostTypes
'
;
const
backButton
:
QuickInputButton
=
{
iconPath
:
'
back.svg
'
};
export
type
Item
=
string
|
QuickPickItem
;
export
class
ExtHostQuickOpen
implements
ExtHostQuickOpenShape
{
...
...
@@ -151,6 +153,8 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
// ---- QuickInput
backButton
=
backButton
;
createQuickPick
(
extensionId
:
string
):
QuickPick
{
const
session
=
new
ExtHostQuickPick
(
this
.
_proxy
,
extensionId
,
()
=>
this
.
_sessions
.
delete
(
session
.
_id
));
this
.
_sessions
.
set
(
session
.
_id
,
session
);
...
...
@@ -324,13 +328,14 @@ class ExtHostQuickInput implements QuickInput {
this
.
_buttons
=
buttons
;
this
.
_handlesToButtons
.
clear
();
buttons
.
forEach
((
button
,
i
)
=>
{
this
.
_handlesToButtons
.
set
(
i
,
button
);
const
handle
=
button
===
backButton
?
-
1
:
i
;
this
.
_handlesToButtons
.
set
(
handle
,
button
);
});
this
.
update
({
buttons
:
buttons
.
map
<
TransferQuickInputButton
>
((
button
,
i
)
=>
({
iconPath
:
getIconUris
(
button
.
iconPath
),
tooltip
:
button
.
tooltip
,
handle
:
i
,
handle
:
button
===
backButton
?
-
1
:
i
,
}))
});
}
...
...
src/vs/workbench/browser/parts/quickinput/media/dark/back.svg
0 → 100755
浏览文件 @
c361c4a3
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 16 16"
><defs><style>
.icon-canvas-transparent,.icon-vs-out{fill:#2d2d30;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#c5c5c5;}
</style></defs><title>
CollapseChevronLeft_md_16x
</title><path
class=
"icon-canvas-transparent"
d=
"M16,0V16H0V0Z"
/><path
class=
"icon-vs-out"
d=
"M7.725,8l4.97,4.97L10.22,15.444,2.775,8,10.22.556,12.694,3.03Z"
style=
"display: none;"
/><path
class=
"icon-vs-bg"
d=
"M6.311,8l4.97,4.97L10.22,14.03,4.189,8l6.03-6.03L11.28,3.03Z"
/></svg>
\ No newline at end of file
src/vs/workbench/browser/parts/quickinput/media/light/back.svg
0 → 100755
浏览文件 @
c361c4a3
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 16 16"
><defs><style>
.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#424242;}
</style></defs><title>
CollapseChevronLeft_md_16x
</title><path
class=
"icon-canvas-transparent"
d=
"M16,0V16H0V0Z"
/><path
class=
"icon-vs-out"
d=
"M7.725,8l4.97,4.97L10.22,15.444,2.775,8,10.22.556,12.694,3.03Z"
style=
"display: none;"
/><path
class=
"icon-vs-bg"
d=
"M6.311,8l4.97,4.97L10.22,14.03,4.189,8l6.03-6.03L11.28,3.03Z"
/></svg>
\ No newline at end of file
src/vs/workbench/browser/parts/quickinput/quickInput.contribution.ts
浏览文件 @
c361c4a3
...
...
@@ -4,7 +4,15 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
QuickPickManyToggle
}
from
'
vs/workbench/browser/parts/quickinput/quickInput
'
;
import
{
QuickPickManyToggle
,
BackAction
}
from
'
vs/workbench/browser/parts/quickinput/quickInput
'
;
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
as
ActionExtensions
}
from
'
vs/workbench/common/actions
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
inQuickOpenContext
}
from
'
vs/workbench/browser/parts/quickopen/quickopen
'
;
KeybindingsRegistry
.
registerCommandAndKeybindingRule
(
QuickPickManyToggle
);
const
registry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
ActionExtensions
.
WorkbenchActions
);
registry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
BackAction
,
BackAction
.
ID
,
BackAction
.
LABEL
,
{
primary
:
null
,
win
:
{
primary
:
KeyMod
.
Alt
|
KeyCode
.
LeftArrow
},
mac
:
{
primary
:
KeyMod
.
WinCtrl
|
KeyCode
.
US_MINUS
},
linux
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyMod
.
Alt
|
KeyCode
.
US_MINUS
}
},
inQuickOpenContext
,
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(
50
)),
'
Back
'
);
src/vs/workbench/browser/parts/quickinput/quickInput.ts
浏览文件 @
c361c4a3
...
...
@@ -54,6 +54,7 @@ interface QuickInputUI {
progressBar
:
ProgressBar
;
list
:
QuickInputList
;
onDidAccept
:
Event
<
void
>
;
onDidTriggerButton
:
Event
<
IQuickInputButton
>
;
ignoreFocusOut
:
boolean
;
show
(
controller
:
QuickInput
):
void
;
setVisibilities
(
visibilities
:
Visibilities
):
void
;
...
...
@@ -166,6 +167,13 @@ class QuickInput implements IQuickInput {
if
(
this
.
visible
)
{
return
;
}
this
.
disposables
.
push
(
this
.
ui
.
onDidTriggerButton
(
button
=>
{
if
(
this
.
buttons
.
indexOf
(
button
)
!==
-
1
)
{
this
.
onDidTriggerButtonEmitter
.
fire
(
button
);
}
}),
);
this
.
ui
.
show
(
this
);
this
.
visible
=
true
;
this
.
update
();
...
...
@@ -642,6 +650,7 @@ export class QuickInputService extends Component implements IQuickInputService {
private
inQuickOpenWidgets
:
Record
<
string
,
boolean
>
=
{};
private
inQuickOpenContext
:
IContextKey
<
boolean
>
;
private
onDidAcceptEmitter
=
new
Emitter
<
void
>
();
private
onDidTriggerButtonEmitter
=
new
Emitter
<
IQuickInputButton
>
();
private
controller
:
QuickInput
;
...
...
@@ -806,6 +815,7 @@ export class QuickInputService extends Component implements IQuickInputService {
progressBar
,
list
,
onDidAccept
:
this
.
onDidAcceptEmitter
.
event
,
onDidTriggerButton
:
this
.
onDidTriggerButtonEmitter
.
event
,
ignoreFocusOut
:
false
,
show
:
controller
=>
this
.
show
(
controller
),
hide
:
()
=>
this
.
hide
(),
...
...
@@ -928,6 +938,15 @@ export class QuickInputService extends Component implements IQuickInputService {
});
}
backButton
=
{
iconPath
:
{
dark
:
URI
.
parse
(
require
.
toUrl
(
'
vs/workbench/browser/parts/quickinput/media/dark/back.svg
'
)),
light
:
URI
.
parse
(
require
.
toUrl
(
'
vs/workbench/browser/parts/quickinput/media/light/back.svg
'
))
},
tooltip
:
localize
(
'
quickInput.back
'
,
"
Back
"
),
handle
:
-
1
// TODO
};
createQuickPick
():
IQuickPick
{
this
.
create
();
return
new
QuickPick
(
this
.
ui
);
...
...
@@ -1034,6 +1053,11 @@ export class QuickInputService extends Component implements IQuickInputService {
return
TPromise
.
as
(
undefined
);
}
back
()
{
this
.
onDidTriggerButtonEmitter
.
fire
(
this
.
backButton
);
return
TPromise
.
as
(
undefined
);
}
cancel
()
{
this
.
hide
();
return
TPromise
.
as
(
undefined
);
...
...
@@ -1111,3 +1135,18 @@ export const QuickPickManyToggle: ICommandAndKeybindingRule = {
quickInputService
.
toggle
();
}
};
export
class
BackAction
extends
Action
{
public
static
readonly
ID
=
'
workbench.action.quickInputBack
'
;
public
static
readonly
LABEL
=
localize
(
'
back
'
,
"
Back
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IQuickInputService
private
quickInputService
:
IQuickInputService
)
{
super
(
id
,
label
);
}
public
run
():
TPromise
<
any
>
{
this
.
quickInputService
.
back
();
return
TPromise
.
as
(
null
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录