Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
677b68da
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,发现更多精彩内容 >>
提交
677b68da
编写于
9月 11, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qick open - tweak delay and cancellation further
上级
0ee556cb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
13 deletion
+9
-13
src/vs/workbench/parts/search/browser/openAnythingHandler.ts
src/vs/workbench/parts/search/browser/openAnythingHandler.ts
+4
-5
src/vs/workbench/parts/search/browser/openSymbolHandler.ts
src/vs/workbench/parts/search/browser/openSymbolHandler.ts
+5
-8
未找到文件。
src/vs/workbench/parts/search/browser/openAnythingHandler.ts
浏览文件 @
677b68da
...
...
@@ -37,8 +37,7 @@ export class OpenAnythingHandler extends QuickOpenHandler {
private
static
readonly
LINE_COLON_PATTERN
=
/
[
#|:|
\(](\d
*
)([
#|:|,
](\d
*
))?\)?
$/
;
private
static
readonly
FILE_SEARCH_DELAY
=
200
;
private
static
readonly
SYMBOL_SEARCH_DELAY
=
500
;
// go easier on those symbols!
private
static
readonly
TYPING_SEARCH_DELAY
=
200
;
// This delay accommodates for the user typing a word and then stops typing to start searching
private
static
readonly
MAX_DISPLAYED_RESULTS
=
512
;
...
...
@@ -57,7 +56,7 @@ export class OpenAnythingHandler extends QuickOpenHandler {
super
();
this
.
scorerCache
=
Object
.
create
(
null
);
this
.
searchDelayer
=
new
ThrottledDelayer
<
QuickOpenModel
>
(
OpenAnythingHandler
.
FILE
_SEARCH_DELAY
);
this
.
searchDelayer
=
new
ThrottledDelayer
<
QuickOpenModel
>
(
OpenAnythingHandler
.
TYPING
_SEARCH_DELAY
);
this
.
openSymbolHandler
=
instantiationService
.
createInstance
(
OpenSymbolHandler
);
this
.
openFileHandler
=
instantiationService
.
createInstance
(
OpenFileHandler
);
...
...
@@ -103,7 +102,7 @@ export class OpenAnythingHandler extends QuickOpenHandler {
}
// The throttler needs a factory for its promises
const
promiseFactory
=
()
=>
{
const
resultsPromise
=
()
=>
{
const
resultPromises
:
TPromise
<
QuickOpenModel
|
FileQuickOpenModel
>
[]
=
[];
// File Results
...
...
@@ -155,7 +154,7 @@ export class OpenAnythingHandler extends QuickOpenHandler {
};
// Trigger through delayer to prevent accumulation while the user is typing (except when expecting results to come from cache)
return
this
.
hasShortResponseTime
()
?
promiseFactory
()
:
this
.
searchDelayer
.
trigger
(
promiseFactory
,
this
.
includeSymbols
?
OpenAnythingHandler
.
SYMBOL_SEARCH_DELAY
:
OpenAnythingHandler
.
FILE
_SEARCH_DELAY
);
return
this
.
hasShortResponseTime
()
?
resultsPromise
()
:
this
.
searchDelayer
.
trigger
(
resultsPromise
,
OpenAnythingHandler
.
TYPING
_SEARCH_DELAY
);
}
hasShortResponseTime
():
boolean
{
...
...
src/vs/workbench/parts/search/browser/openSymbolHandler.ts
浏览文件 @
677b68da
...
...
@@ -15,7 +15,7 @@ import { IAutoFocus, Mode, IEntryRunContext } from 'vs/base/parts/quickopen/comm
import
*
as
filters
from
'
vs/base/common/filters
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
EditorInput
,
IWorkbenchEditorConfiguration
}
from
'
vs/workbench/common/editor
'
;
import
{
IWorkbenchEditorConfiguration
}
from
'
vs/workbench/common/editor
'
;
import
{
symbolKindToCssClass
}
from
'
vs/editor/common/modes
'
;
import
{
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -71,10 +71,7 @@ class SymbolEntry extends EditorQuickOpenEntry {
run
(
mode
:
Mode
,
context
:
IEntryRunContext
):
boolean
{
// resolve this type bearing if neccessary
if
(
!
this
.
bearingResolve
&&
typeof
this
.
provider
.
resolveWorkspaceSymbol
===
'
function
'
&&
!
this
.
bearing
.
location
.
range
)
{
if
(
!
this
.
bearingResolve
&&
typeof
this
.
provider
.
resolveWorkspaceSymbol
===
'
function
'
&&
!
this
.
bearing
.
location
.
range
)
{
this
.
bearingResolve
=
Promise
.
resolve
(
this
.
provider
.
resolveWorkspaceSymbol
(
this
.
bearing
,
CancellationToken
.
None
)).
then
(
result
=>
{
this
.
bearing
=
result
||
this
.
bearing
;
...
...
@@ -90,7 +87,7 @@ class SymbolEntry extends EditorQuickOpenEntry {
return
mode
===
Mode
.
OPEN
;
}
getInput
():
IResourceInput
|
EditorInput
{
getInput
():
IResourceInput
{
const
input
:
IResourceInput
=
{
resource
:
this
.
bearing
.
location
.
uri
,
options
:
{
...
...
@@ -130,7 +127,7 @@ export class OpenSymbolHandler extends QuickOpenHandler {
static
readonly
ID
=
'
workbench.picker.symbols
'
;
private
static
readonly
SEARCH_DELAY
=
200
;
// This delay accommodates for the user typing a word and then stops typing to start searching
private
static
readonly
TYPING_
SEARCH_DELAY
=
200
;
// This delay accommodates for the user typing a word and then stops typing to start searching
private
delayer
:
ThrottledDelayer
<
QuickOpenEntry
[]
>
;
private
options
:
IOpenSymbolOptions
;
...
...
@@ -138,7 +135,7 @@ export class OpenSymbolHandler extends QuickOpenHandler {
constructor
(@
IInstantiationService
private
instantiationService
:
IInstantiationService
)
{
super
();
this
.
delayer
=
new
ThrottledDelayer
<
QuickOpenEntry
[]
>
(
OpenSymbolHandler
.
SEARCH_DELAY
);
this
.
delayer
=
new
ThrottledDelayer
<
QuickOpenEntry
[]
>
(
OpenSymbolHandler
.
TYPING_
SEARCH_DELAY
);
this
.
options
=
Object
.
create
(
null
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录