Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ee081520
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,发现更多精彩内容 >>
提交
ee081520
编写于
10月 29, 2018
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix timing issue (fixes #61748)
上级
0d987455
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
35 deletion
+28
-35
extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts
...ns/vscode-api-tests/src/singlefolder-tests/window.test.ts
+1
-0
src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts
src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts
+17
-27
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+3
-3
src/vs/workbench/api/node/extHostQuickOpen.ts
src/vs/workbench/api/node/extHostQuickOpen.ts
+7
-5
未找到文件。
extensions/vscode-api-tests/src/singlefolder-tests/window.test.ts
浏览文件 @
ee081520
...
...
@@ -422,6 +422,7 @@ suite('window namespace tests', () => {
canPickMany
:
true
});
const
first
=
new
Promise
(
resolve
=>
resolves
.
push
(
resolve
));
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
10
));
// Allow UI to update.
await
commands
.
executeCommand
(
'
workbench.action.quickOpenSelectNext
'
);
assert
.
equal
(
await
first
,
'
eins
'
);
await
commands
.
executeCommand
(
'
workbench.action.quickPickManyToggle
'
);
...
...
src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts
浏览文件 @
ee081520
...
...
@@ -21,10 +21,10 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape {
private
_proxy
:
ExtHostQuickOpenShape
;
private
_quickInputService
:
IQuickInputService
;
private
_
doSetItems
:
(
items
:
TransferQuickPickItems
[])
=>
any
;
private
_doSetError
:
(
error
:
Error
)
=>
any
;
private
_contents
:
TPromise
<
TransferQuickPickItems
[]
>
;
private
_token
:
number
=
0
;
private
_
items
:
Record
<
number
,
{
resolve
(
items
:
TransferQuickPickItems
[]):
void
;
reject
(
error
:
Error
):
void
;
}
>
=
{}
;
constructor
(
extHostContext
:
IExtHostContext
,
...
...
@@ -37,21 +37,9 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape {
public
dispose
():
void
{
}
$show
(
options
:
IPickOptions
<
TransferQuickPickItems
>
,
token
:
CancellationToken
):
Thenable
<
number
|
number
[]
>
{
const
myToken
=
++
this
.
_token
;
this
.
_contents
=
new
TPromise
<
TransferQuickPickItems
[]
>
((
c
,
e
)
=>
{
this
.
_doSetItems
=
(
items
)
=>
{
if
(
myToken
===
this
.
_token
)
{
c
(
items
);
}
};
this
.
_doSetError
=
(
error
)
=>
{
if
(
myToken
===
this
.
_token
)
{
e
(
error
);
}
};
$show
(
instance
:
number
,
options
:
IPickOptions
<
TransferQuickPickItems
>
,
token
:
CancellationToken
):
Thenable
<
number
|
number
[]
>
{
const
contents
=
new
Promise
<
TransferQuickPickItems
[]
>
((
resolve
,
reject
)
=>
{
this
.
_items
[
instance
]
=
{
resolve
,
reject
};
});
options
=
{
...
...
@@ -64,14 +52,14 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape {
};
if
(
options
.
canPickMany
)
{
return
this
.
_quickInputService
.
pick
(
this
.
_
contents
,
options
as
{
canPickMany
:
true
},
token
).
then
(
items
=>
{
return
this
.
_quickInputService
.
pick
(
contents
,
options
as
{
canPickMany
:
true
},
token
).
then
(
items
=>
{
if
(
items
)
{
return
items
.
map
(
item
=>
item
.
handle
);
}
return
undefined
;
});
}
else
{
return
this
.
_quickInputService
.
pick
(
this
.
_
contents
,
options
,
token
).
then
(
item
=>
{
return
this
.
_quickInputService
.
pick
(
contents
,
options
,
token
).
then
(
item
=>
{
if
(
item
)
{
return
item
.
handle
;
}
...
...
@@ -80,16 +68,18 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape {
}
}
$setItems
(
items
:
TransferQuickPickItems
[]):
Thenable
<
void
>
{
if
(
this
.
_doSetItems
)
{
this
.
_doSetItems
(
items
);
$setItems
(
instance
:
number
,
items
:
TransferQuickPickItems
[]):
Thenable
<
void
>
{
if
(
this
.
_items
[
instance
])
{
this
.
_items
[
instance
].
resolve
(
items
);
delete
this
.
_items
[
instance
];
}
return
undefined
;
}
$setError
(
error
:
Error
):
Thenable
<
void
>
{
if
(
this
.
_doSetError
)
{
this
.
_doSetError
(
error
);
$setError
(
instance
:
number
,
error
:
Error
):
Thenable
<
void
>
{
if
(
this
.
_items
[
instance
])
{
this
.
_items
[
instance
].
reject
(
error
);
delete
this
.
_items
[
instance
];
}
return
undefined
;
}
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
ee081520
...
...
@@ -416,9 +416,9 @@ export interface TransferInputBox extends BaseTransferQuickInput {
}
export
interface
MainThreadQuickOpenShape
extends
IDisposable
{
$show
(
options
:
IPickOptions
<
TransferQuickPickItems
>
,
token
:
CancellationToken
):
Thenable
<
number
|
number
[]
>
;
$setItems
(
items
:
TransferQuickPickItems
[]):
Thenable
<
void
>
;
$setError
(
error
:
Error
):
Thenable
<
void
>
;
$show
(
instance
:
number
,
options
:
IPickOptions
<
TransferQuickPickItems
>
,
token
:
CancellationToken
):
Thenable
<
number
|
number
[]
>
;
$setItems
(
i
nstance
:
number
,
i
tems
:
TransferQuickPickItems
[]):
Thenable
<
void
>
;
$setError
(
instance
:
number
,
error
:
Error
):
Thenable
<
void
>
;
$input
(
options
:
vscode
.
InputBoxOptions
,
validateInput
:
boolean
,
token
:
CancellationToken
):
Thenable
<
string
>
;
$createOrUpdate
(
params
:
TransferQuickInput
):
Thenable
<
void
>
;
$dispose
(
id
:
number
):
Thenable
<
void
>
;
...
...
src/vs/workbench/api/node/extHostQuickOpen.ts
浏览文件 @
ee081520
...
...
@@ -28,6 +28,8 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
private
_sessions
=
new
Map
<
number
,
ExtHostQuickInput
>
();
private
_instances
=
0
;
constructor
(
mainContext
:
IMainContext
,
workspace
:
ExtHostWorkspace
,
commands
:
ExtHostCommands
)
{
this
.
_proxy
=
mainContext
.
getProxy
(
MainContext
.
MainThreadQuickOpen
);
this
.
_workspace
=
workspace
;
...
...
@@ -44,7 +46,9 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
const
itemsPromise
=
<
Promise
<
Item
[]
>>
Promise
.
resolve
(
itemsOrItemsPromise
);
const
quickPickWidget
=
this
.
_proxy
.
$show
({
const
instance
=
++
this
.
_instances
;
const
quickPickWidget
=
this
.
_proxy
.
$show
(
instance
,
{
placeHolder
:
options
&&
options
.
placeHolder
,
matchOnDescription
:
options
&&
options
.
matchOnDescription
,
matchOnDetail
:
options
&&
options
.
matchOnDetail
,
...
...
@@ -99,7 +103,7 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
}
// show items
this
.
_proxy
.
$setItems
(
pickItems
);
this
.
_proxy
.
$setItems
(
instance
,
pickItems
);
return
quickPickWidget
.
then
(
handle
=>
{
if
(
typeof
handle
===
'
number
'
)
{
...
...
@@ -115,7 +119,7 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
return
undefined
;
}
this
.
_proxy
.
$setError
(
err
);
this
.
_proxy
.
$setError
(
instance
,
err
);
return
Promise
.
reject
(
err
);
});
...
...
@@ -140,8 +144,6 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
return
undefined
;
}
this
.
_proxy
.
$setError
(
err
);
return
Promise
.
reject
(
err
);
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录