Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
60ef4f5d
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,发现更多精彩内容 >>
提交
60ef4f5d
编写于
8月 08, 2018
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use QuickInput (#29096)
上级
0389fb20
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
43 addition
and
54 deletion
+43
-54
src/vs/workbench/electron-browser/actions.ts
src/vs/workbench/electron-browser/actions.ts
+43
-54
未找到文件。
src/vs/workbench/electron-browser/actions.ts
浏览文件 @
60ef4f5d
...
...
@@ -52,6 +52,10 @@ import { IWorkbenchIssueService } from 'vs/workbench/services/issue/common/issue
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IUriDisplayService
}
from
'
vs/platform/uriDisplay/common/uriDisplay
'
;
import
{
dirname
}
from
'
vs/base/common/resources
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IQuickInputService
,
IQuickPickItem
,
IQuickInputButton
}
from
'
vs/platform/quickinput/common/quickInput
'
;
import
{
getIconClasses
}
from
'
vs/workbench/browser/labels
'
;
// --- actions
...
...
@@ -577,20 +581,24 @@ export class ReloadWindowWithExtensionsDisabledAction extends Action {
}
export
abstract
class
BaseSwitchWindow
extends
Action
{
private
closeWindowAction
:
CloseWindowAction
;
private
closeWindowAction
:
IQuickInputButton
=
{
iconClass
:
'
action-remove-from-recently-opened
'
,
tooltip
:
nls
.
localize
(
'
close
'
,
"
Close Window
"
)
};
constructor
(
id
:
string
,
label
:
string
,
private
windowsService
:
IWindowsService
,
private
windowService
:
IWindowService
,
private
quick
OpenService
:
IQuickOpen
Service
,
private
quick
InputService
:
IQuickInput
Service
,
private
keybindingService
:
IKeybindingService
,
private
instantiationService
:
IInstantiationService
private
modelService
:
IModelService
,
private
modeService
:
IModeService
,
)
{
super
(
id
,
label
);
this
.
closeWindowAction
=
this
.
instantiationService
.
createInstance
(
CloseWindowAction
);
}
protected
abstract
isQuickNavigate
():
boolean
;
...
...
@@ -600,58 +608,35 @@ export abstract class BaseSwitchWindow extends Action {
return
this
.
windowsService
.
getWindows
().
then
(
windows
=>
{
const
placeHolder
=
nls
.
localize
(
'
switchWindowPlaceHolder
'
,
"
Select a window to switch to
"
);
const
picks
=
windows
.
map
(
win
=>
({
const
picks
=
windows
.
map
(
win
=>
{
const
resource
=
win
.
filename
?
URI
.
file
(
win
.
filename
)
:
win
.
folderUri
?
win
.
folderUri
:
win
.
workspace
?
URI
.
file
(
win
.
workspace
.
configPath
)
:
void
0
;
const
fileKind
=
win
.
filename
?
FileKind
.
FILE
:
win
.
workspace
?
FileKind
.
ROOT_FOLDER
:
win
.
folderUri
?
FileKind
.
FOLDER
:
FileKind
.
FILE
;
return
{
payload
:
win
.
id
,
resource
:
win
.
filename
?
URI
.
file
(
win
.
filename
)
:
win
.
folderUri
?
win
.
folderUri
:
win
.
workspace
?
URI
.
file
(
win
.
workspace
.
configPath
)
:
void
0
,
fileKind
:
win
.
filename
?
FileKind
.
FILE
:
win
.
workspace
?
FileKind
.
ROOT_FOLDER
:
win
.
folderUri
?
FileKind
.
FOLDER
:
FileKind
.
FILE
,
label
:
win
.
title
,
iconClasses
:
getIconClasses
(
this
.
modelService
,
this
.
modeService
,
resource
,
fileKind
),
description
:
(
currentWindowId
===
win
.
id
)
?
nls
.
localize
(
'
current
'
,
"
Current Window
"
)
:
void
0
,
run
:
()
=>
{
setTimeout
(()
=>
{
// Bug: somehow when not running this code in a timeout, it is not possible to use this picker
// with quick navigate keys (not able to trigger quick navigate once running it once).
this
.
windowsService
.
showWindow
(
win
.
id
).
done
(
null
,
errors
.
onUnexpectedError
);
buttons
:
(
!
this
.
isQuickNavigate
()
&&
currentWindowId
!==
win
.
id
)
?
[
this
.
closeWindowAction
]
:
void
0
}
as
(
IQuickPickItem
&
{
payload
:
number
});
});
},
action
:
(
!
this
.
isQuickNavigate
()
&&
currentWindowId
!==
win
.
id
)
?
this
.
closeWindowAction
:
void
0
}
as
IFilePickOpenEntry
));
const
autoFocusIndex
=
(
picks
.
indexOf
(
picks
.
filter
(
pick
=>
pick
.
payload
===
currentWindowId
)[
0
])
+
1
)
%
picks
.
length
;
this
.
quickOpen
Service
.
pick
(
picks
,
{
return
this
.
quickInput
Service
.
pick
(
picks
,
{
contextKey
:
'
inWindowsPicker
'
,
a
utoFocus
:
{
autoFocusIndex
}
,
a
ctiveItem
:
picks
[
autoFocusIndex
]
,
placeHolder
,
quickNavigateConfiguration
:
this
.
isQuickNavigate
()
?
{
keybindings
:
this
.
keybindingService
.
lookupKeybindings
(
this
.
id
)
}
:
void
0
quickNavigate
:
this
.
isQuickNavigate
()
?
{
keybindings
:
this
.
keybindingService
.
lookupKeybindings
(
this
.
id
)
}
:
void
0
,
onDidTriggerItemButton
:
context
=>
{
this
.
windowsService
.
closeWindow
(
context
.
item
.
payload
).
then
(()
=>
{
context
.
removeItem
();
});
});
}
dispose
():
void
{
super
.
dispose
();
this
.
closeWindowAction
.
dispose
();
}
}
class
CloseWindowAction
extends
Action
implements
IPickOpenAction
{
static
readonly
ID
=
'
workbench.action.closeWindow
'
;
static
readonly
LABEL
=
nls
.
localize
(
'
close
'
,
"
Close Window
"
);
constructor
(
@
IWindowsService
private
windowsService
:
IWindowsService
)
{
super
(
CloseWindowAction
.
ID
,
CloseWindowAction
.
LABEL
);
this
.
class
=
'
action-remove-from-recently-opened
'
;
});
}).
then
(
pick
=>
{
if
(
pick
)
{
this
.
windowsService
.
showWindow
(
pick
.
payload
).
done
(
null
,
errors
.
onUnexpectedError
);
}
run
(
item
:
IPickOpenItem
):
TPromise
<
boolean
>
{
return
this
.
windowsService
.
closeWindow
(
item
.
getPayload
()).
then
(()
=>
{
item
.
remove
();
return
true
;
});
}
}
...
...
@@ -666,11 +651,13 @@ export class SwitchWindow extends BaseSwitchWindow {
label
:
string
,
@
IWindowsService
windowsService
:
IWindowsService
,
@
IWindowService
windowService
:
IWindowService
,
@
IQuick
OpenService
quickOpenService
:
IQuickOpen
Service
,
@
IQuick
InputService
quickInputService
:
IQuickInput
Service
,
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IModelService
modelService
:
IModelService
,
@
IModeService
modeService
:
IModeService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
)
{
super
(
id
,
label
,
windowsService
,
windowService
,
quick
OpenService
,
keybindingService
,
instantiation
Service
);
super
(
id
,
label
,
windowsService
,
windowService
,
quick
InputService
,
keybindingService
,
modelService
,
mode
Service
);
}
protected
isQuickNavigate
():
boolean
{
...
...
@@ -688,11 +675,13 @@ export class QuickSwitchWindow extends BaseSwitchWindow {
label
:
string
,
@
IWindowsService
windowsService
:
IWindowsService
,
@
IWindowService
windowService
:
IWindowService
,
@
IQuick
OpenService
quickOpenService
:
IQuickOpen
Service
,
@
IQuick
InputService
quickInputService
:
IQuickInput
Service
,
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IModelService
modelService
:
IModelService
,
@
IModeService
modeService
:
IModeService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
)
{
super
(
id
,
label
,
windowsService
,
windowService
,
quick
OpenService
,
keybindingService
,
instantiation
Service
);
super
(
id
,
label
,
windowsService
,
windowService
,
quick
InputService
,
keybindingService
,
modelService
,
mode
Service
);
}
protected
isQuickNavigate
():
boolean
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录