Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6d541611
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,发现更多精彩内容 >>
提交
6d541611
编写于
6月 01, 2017
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Handle progress results in quick open controller (#27152)"
This reverts commit
dfd35808
.
上级
eef9baf1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
36 deletion
+20
-36
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
.../workbench/browser/parts/quickopen/quickOpenController.ts
+2
-3
src/vs/workbench/browser/quickopen.ts
src/vs/workbench/browser/quickopen.ts
+2
-2
src/vs/workbench/parts/search/browser/openAnythingHandler.ts
src/vs/workbench/parts/search/browser/openAnythingHandler.ts
+16
-31
未找到文件。
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
浏览文件 @
6d541611
...
...
@@ -774,7 +774,7 @@ export class QuickOpenController extends Component implements IQuickOpenService
}
// Get results
const
handleResult
=
(
result
)
=>
{
return
resolvedHandler
.
getResults
(
value
).
then
(
result
=>
{
if
(
this
.
currentResultToken
===
currentResultToken
)
{
// now is the time to show the input if we did not have set it before
...
...
@@ -787,8 +787,7 @@ export class QuickOpenController extends Component implements IQuickOpenService
const
handlerResults
=
(
result
&&
result
.
entries
)
||
[];
this
.
mergeResults
(
quickOpenModel
,
handlerResults
,
resolvedHandler
.
getGroupLabel
());
}
};
return
resolvedHandler
.
getResults
(
value
).
then
(
handleResult
,
undefined
,
handleResult
);
});
});
}
...
...
src/vs/workbench/browser/quickopen.ts
浏览文件 @
6d541611
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
{
PPromise
,
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
*
as
objects
from
'
vs/base/common/objects
'
;
import
filters
=
require
(
'
vs/base/common/filters
'
);
import
arrays
=
require
(
'
vs/base/common/arrays
'
);
...
...
@@ -34,7 +34,7 @@ export class QuickOpenHandler {
* As such, returning the same model instance across multiple searches will yield best
* results in terms of performance when many items are shown.
*/
public
getResults
(
searchValue
:
string
):
PPromise
<
IModel
<
any
>
,
IModel
<
any
>>
{
public
getResults
(
searchValue
:
string
):
TPromise
<
IModel
<
any
>>
{
return
TPromise
.
as
(
null
);
}
...
...
src/vs/workbench/parts/search/browser/openAnythingHandler.ts
浏览文件 @
6d541611
...
...
@@ -7,7 +7,7 @@
import
*
as
arrays
from
'
vs/base/common/arrays
'
;
import
*
as
objects
from
'
vs/base/common/objects
'
;
import
{
PPromise
,
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
{
ThrottledDelayer
}
from
'
vs/base/common/async
'
;
import
types
=
require
(
'
vs/base/common/types
'
);
...
...
@@ -91,7 +91,7 @@ export class OpenAnythingHandler extends QuickOpenHandler {
private
openSymbolHandler
:
OpenSymbolHandler
;
private
openFileHandler
:
OpenFileHandler
;
private
searchDelayer
:
ThrottledDelayer
<
QuickOpenModel
>
;
private
pendingSearch
:
PPromise
<
QuickOpenModel
,
QuickOpenModel
>
;
private
pendingSearch
:
TPromise
<
QuickOpenModel
>
;
private
isClosed
:
boolean
;
private
scorerCache
:
{
[
key
:
string
]:
number
};
private
includeSymbols
:
boolean
;
...
...
@@ -135,7 +135,7 @@ export class OpenAnythingHandler extends QuickOpenHandler {
});
}
public
getResults
(
searchValue
:
string
):
PPromise
<
QuickOpenModel
,
QuickOpenModel
>
{
public
getResults
(
searchValue
:
string
):
TPromise
<
QuickOpenModel
>
{
const
startTime
=
Date
.
now
();
this
.
cancelPendingSearch
();
...
...
@@ -166,21 +166,21 @@ export class OpenAnythingHandler extends QuickOpenHandler {
// Symbol Results (unless disabled or a range or absolute path is specified)
if
(
this
.
includeSymbols
&&
!
searchWithRange
)
{
resultPromises
.
push
(
this
.
openSymbolHandler
.
getResults
(
searchValue
));
}
else
{
resultPromises
.
push
(
TPromise
.
as
(
new
QuickOpenModel
()));
// We need this empty promise because we are using the throttler below!
}
// Join and sort unified
const
handleResults
=
(
results
:
(
QuickOpenModel
|
FileQuickOpenModel
)[])
=>
{
this
.
pendingSearch
=
TPromise
.
join
(
resultPromises
).
then
(
results
=>
{
this
.
pendingSearch
=
null
;
// If the quick open widget has been closed meanwhile, ignore the result
if
(
this
.
isClosed
)
{
return
new
QuickOpenModel
(
);
return
TPromise
.
as
<
QuickOpenModel
>
(
new
QuickOpenModel
()
);
}
// Combine file results and symbol results (if any)
const
mergedResults
:
QuickOpenEntry
[]
=
results
.
reduce
((
entries
:
QuickOpenEntry
[],
model
:
QuickOpenModel
)
=>
{
return
entries
.
concat
(
model
.
entries
);
},
[]);
const
mergedResults
=
[...
results
[
0
].
entries
,
...
results
[
1
].
entries
];
// Sort
const
unsortedResultTime
=
Date
.
now
();
...
...
@@ -200,11 +200,10 @@ export class OpenAnythingHandler extends QuickOpenHandler {
});
let
fileSearchStats
:
ISearchStats
;
for
(
const
result
of
results
)
{
if
(
result
instanceof
FileQuickOpenModel
)
{
fileSearchStats
=
(
<
FileQuickOpenModel
>
result
).
stats
;
break
;
}
if
(
results
[
0
]
instanceof
FileQuickOpenModel
)
{
fileSearchStats
=
(
<
FileQuickOpenModel
>
results
[
0
]).
stats
;
}
else
if
(
results
[
1
]
instanceof
FileQuickOpenModel
)
{
fileSearchStats
=
(
<
FileQuickOpenModel
>
results
[
1
]).
stats
;
}
const
duration
=
new
Date
().
getTime
()
-
startTime
;
...
...
@@ -219,24 +218,10 @@ export class OpenAnythingHandler extends QuickOpenHandler {
this
.
telemetryService
.
publicLog
(
'
openAnything
'
,
objects
.
assign
(
data
,
{
duration
}));
return
new
QuickOpenModel
(
viewResults
);
};
this
.
pendingSearch
=
new
PPromise
<
QuickOpenModel
,
QuickOpenModel
>
((
complete
,
error
,
progress
)
=>
{
// When any of the result promises return, forward the result as progress.
resultPromises
.
map
(
resultPromise
=>
{
resultPromise
.
then
(
result
=>
{
progress
(
handleResults
([
result
]));
});
});
// Complete the promise when all promises have completed.
TPromise
.
join
(
resultPromises
).
then
(()
=>
{
// We already sent the results via progress.
complete
(
new
QuickOpenModel
());
},
error
=>
{
this
.
pendingSearch
=
null
;
this
.
messageService
.
show
(
Severity
.
Error
,
error
);
});
return
TPromise
.
as
<
QuickOpenModel
>
(
new
QuickOpenModel
(
viewResults
));
},
(
error
:
Error
)
=>
{
this
.
pendingSearch
=
null
;
this
.
messageService
.
show
(
Severity
.
Error
,
error
);
});
return
this
.
pendingSearch
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录