Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
18c97395
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,发现更多精彩内容 >>
提交
18c97395
编写于
5月 08, 2018
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Quick Pick tests (#49340)
上级
50cf92c2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
83 addition
and
1 deletion
+83
-1
extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts
...ns/vscode-api-tests/src/singlefolder-tests/window.test.ts
+38
-0
src/vs/platform/quickinput/common/quickInput.ts
src/vs/platform/quickinput/common/quickInput.ts
+2
-0
src/vs/workbench/browser/parts/quickinput/quickInput.contribution.ts
...bench/browser/parts/quickinput/quickInput.contribution.ts
+15
-0
src/vs/workbench/browser/parts/quickinput/quickInput.ts
src/vs/workbench/browser/parts/quickinput/quickInput.ts
+27
-1
src/vs/workbench/workbench.main.ts
src/vs/workbench/workbench.main.ts
+1
-0
未找到文件。
extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts
浏览文件 @
18c97395
...
@@ -298,6 +298,44 @@ suite('window namespace tests', () => {
...
@@ -298,6 +298,44 @@ suite('window namespace tests', () => {
});
});
test
(
'
showQuickPick, accept first
'
,
async
function
()
{
const
pick
=
window
.
showQuickPick
([
'
eins
'
,
'
zwei
'
,
'
drei
'
]);
await
commands
.
executeCommand
(
'
workbench.action.acceptSelectedQuickOpenItem
'
);
assert
.
equal
(
await
pick
,
'
eins
'
);
});
test
(
'
showQuickPick, accept second
'
,
async
function
()
{
const
resolves
:
((
value
:
string
)
=>
void
)[]
=
[];
const
first
=
new
Promise
(
resolve
=>
resolves
.
push
(
resolve
));
const
pick
=
window
.
showQuickPick
([
'
eins
'
,
'
zwei
'
,
'
drei
'
],
{
onDidSelectItem
:
item
=>
resolves
.
shift
()
!
(
item
as
string
)
});
assert
.
equal
(
await
first
,
'
eins
'
);
const
second
=
new
Promise
(
resolve
=>
resolves
.
push
(
resolve
));
await
commands
.
executeCommand
(
'
workbench.action.quickOpenSelectNext
'
);
assert
.
equal
(
await
second
,
'
zwei
'
);
await
commands
.
executeCommand
(
'
workbench.action.acceptSelectedQuickOpenItem
'
);
assert
.
equal
(
await
pick
,
'
zwei
'
);
});
test
(
'
showQuickPick, select first two
'
,
async
function
()
{
const
resolves
:
((
value
:
string
)
=>
void
)[]
=
[];
const
picks
=
window
.
showQuickPick
([
'
eins
'
,
'
zwei
'
,
'
drei
'
],
{
onDidSelectItem
:
item
=>
resolves
.
shift
()
!
(
item
as
string
),
canPickMany
:
true
});
const
first
=
new
Promise
(
resolve
=>
resolves
.
push
(
resolve
));
await
commands
.
executeCommand
(
'
workbench.action.quickOpenSelectNext
'
);
assert
.
equal
(
await
first
,
'
eins
'
);
await
commands
.
executeCommand
(
'
workbench.action.quickPickManyToggle
'
);
const
second
=
new
Promise
(
resolve
=>
resolves
.
push
(
resolve
));
await
commands
.
executeCommand
(
'
workbench.action.quickOpenSelectNext
'
);
assert
.
equal
(
await
second
,
'
zwei
'
);
await
commands
.
executeCommand
(
'
workbench.action.quickPickManyToggle
'
);
await
commands
.
executeCommand
(
'
workbench.action.acceptSelectedQuickOpenItem
'
);
assert
.
deepStrictEqual
(
await
picks
,
[
'
eins
'
,
'
zwei
'
]);
});
test
(
'
showQuickPick, undefined on cancel
'
,
function
()
{
test
(
'
showQuickPick, undefined on cancel
'
,
function
()
{
const
source
=
new
CancellationTokenSource
();
const
source
=
new
CancellationTokenSource
();
const
p
=
window
.
showQuickPick
([
'
eins
'
,
'
zwei
'
,
'
drei
'
],
undefined
,
source
.
token
);
const
p
=
window
.
showQuickPick
([
'
eins
'
,
'
zwei
'
,
'
drei
'
],
undefined
,
source
.
token
);
...
...
src/vs/platform/quickinput/common/quickInput.ts
浏览文件 @
18c97395
...
@@ -27,6 +27,8 @@ export interface IQuickInputService {
...
@@ -27,6 +27,8 @@ export interface IQuickInputService {
focus
():
void
;
focus
():
void
;
toggle
():
void
;
navigate
(
next
:
boolean
):
void
;
navigate
(
next
:
boolean
):
void
;
accept
():
TPromise
<
void
>
;
accept
():
TPromise
<
void
>
;
...
...
src/vs/workbench/browser/parts/quickinput/quickInput.contribution.ts
0 → 100644
浏览文件 @
18c97395
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
as
ActionExtensions
}
from
'
vs/workbench/common/actions
'
;
import
{
QuickPickManyToggleAction
}
from
'
vs/workbench/browser/parts/quickinput/quickInput
'
;
import
{
inQuickOpenContext
}
from
'
vs/workbench/browser/parts/quickopen/quickopen
'
;
const
registry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
ActionExtensions
.
WorkbenchActions
);
registry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
QuickPickManyToggleAction
,
QuickPickManyToggleAction
.
ID
,
QuickPickManyToggleAction
.
LABEL
,
null
,
inQuickOpenContext
),
'
Toggle Selection in Quick Pick
'
);
src/vs/workbench/browser/parts/quickinput/quickInput.ts
浏览文件 @
18c97395
...
@@ -35,6 +35,7 @@ import { onUnexpectedError, canceled } from 'vs/base/common/errors';
...
@@ -35,6 +35,7 @@ import { onUnexpectedError, canceled } from 'vs/base/common/errors';
import
Severity
from
'
vs/base/common/severity
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IContextKeyService
,
RawContextKey
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IContextKeyService
,
RawContextKey
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
const
$
=
dom
.
$
;
const
$
=
dom
.
$
;
...
@@ -588,11 +589,17 @@ export class QuickInputService extends Component implements IQuickInputService {
...
@@ -588,11 +589,17 @@ export class QuickInputService extends Component implements IQuickInputService {
}
}
focus
()
{
focus
()
{
if
(
this
.
ui
)
{
if
(
this
.
isDisplayed
()
)
{
this
.
ui
.
inputBox
.
setFocus
();
this
.
ui
.
inputBox
.
setFocus
();
}
}
}
}
toggle
()
{
if
(
this
.
isDisplayed
()
&&
this
.
controller
instanceof
PickManyController
)
{
this
.
ui
.
checkboxList
.
toggleCheckbox
();
}
}
navigate
(
next
:
boolean
)
{
navigate
(
next
:
boolean
)
{
if
(
this
.
isDisplayed
()
&&
this
.
ui
.
checkboxList
.
isDisplayed
())
{
if
(
this
.
isDisplayed
()
&&
this
.
ui
.
checkboxList
.
isDisplayed
())
{
this
.
ui
.
checkboxList
.
focus
(
next
?
'
Next
'
:
'
Previous
'
);
this
.
ui
.
checkboxList
.
focus
(
next
?
'
Next
'
:
'
Previous
'
);
...
@@ -649,3 +656,22 @@ export class QuickInputService extends Component implements IQuickInputService {
...
@@ -649,3 +656,22 @@ export class QuickInputService extends Component implements IQuickInputService {
return
this
.
container
&&
this
.
container
.
style
.
display
!==
'
none
'
;
return
this
.
container
&&
this
.
container
.
style
.
display
!==
'
none
'
;
}
}
}
}
export
class
QuickPickManyToggleAction
extends
Action
{
public
static
readonly
ID
=
'
workbench.action.quickPickManyToggle
'
;
public
static
readonly
LABEL
=
localize
(
'
quickPickManyToggle
'
,
"
Toggle Selection in Quick Pick
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IQuickInputService
private
quickInputService
:
IQuickInputService
)
{
super
(
id
,
label
);
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
this
.
quickInputService
.
toggle
();
return
TPromise
.
as
(
true
);
}
}
src/vs/workbench/workbench.main.ts
浏览文件 @
18c97395
...
@@ -41,6 +41,7 @@ import 'vs/workbench/parts/logs/electron-browser/logs.contribution';
...
@@ -41,6 +41,7 @@ import 'vs/workbench/parts/logs/electron-browser/logs.contribution';
import
'
vs/workbench/browser/parts/quickopen/quickopen.contribution
'
;
import
'
vs/workbench/browser/parts/quickopen/quickopen.contribution
'
;
import
'
vs/workbench/parts/quickopen/browser/quickopen.contribution
'
;
import
'
vs/workbench/parts/quickopen/browser/quickopen.contribution
'
;
import
'
vs/workbench/browser/parts/editor/editorPicker
'
;
import
'
vs/workbench/browser/parts/editor/editorPicker
'
;
import
'
vs/workbench/browser/parts/quickinput/quickInput.contribution
'
;
import
'
vs/workbench/parts/files/electron-browser/explorerViewlet
'
;
import
'
vs/workbench/parts/files/electron-browser/explorerViewlet
'
;
import
'
vs/workbench/parts/files/electron-browser/fileActions.contribution
'
;
import
'
vs/workbench/parts/files/electron-browser/fileActions.contribution
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录