Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
38e46c9a
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,发现更多精彩内容 >>
提交
38e46c9a
编写于
10月 22, 2020
作者:
J
Johannes Rieken
提交者:
GitHub
10月 22, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
duration for word based suggestions, Perf telemetry for completions #109167
上级
a6366cb0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
10 deletion
+13
-10
src/vs/editor/common/services/editorSimpleWorker.ts
src/vs/editor/common/services/editorSimpleWorker.ts
+4
-3
src/vs/editor/common/services/editorWorkerServiceImpl.ts
src/vs/editor/common/services/editorWorkerServiceImpl.ts
+6
-5
src/vs/editor/test/common/services/editorSimpleWorker.test.ts
...vs/editor/test/common/services/editorSimpleWorker.test.ts
+3
-2
未找到文件。
src/vs/editor/common/services/editorSimpleWorker.ts
浏览文件 @
38e46c9a
...
...
@@ -23,6 +23,7 @@ import { IDiffComputationResult } from 'vs/editor/common/services/editorWorkerSe
import
{
createMonacoBaseAPI
}
from
'
vs/editor/common/standalone/standaloneBase
'
;
import
*
as
types
from
'
vs/base/common/types
'
;
import
{
EditorWorkerHost
}
from
'
vs/editor/common/services/editorWorkerServiceImpl
'
;
import
{
StopWatch
}
from
'
vs/base/common/stopwatch
'
;
export
interface
IMirrorModel
{
readonly
uri
:
URI
;
...
...
@@ -529,13 +530,13 @@ export class EditorSimpleWorker implements IRequestHandler, IDisposable {
private
static
readonly
_suggestionsLimit
=
10000
;
public
async
textualSuggest
(
modelUrl
:
string
,
position
:
IPosition
,
wordDef
:
string
,
wordDefFlags
:
string
):
Promise
<
string
[]
|
null
>
{
public
async
textualSuggest
(
modelUrl
:
string
,
position
:
IPosition
,
wordDef
:
string
,
wordDefFlags
:
string
):
Promise
<
{
words
:
string
[],
duration
:
number
}
|
null
>
{
const
model
=
this
.
_getModel
(
modelUrl
);
if
(
!
model
)
{
return
null
;
}
const
sw
=
new
StopWatch
(
true
);
const
words
:
string
[]
=
[];
const
seen
=
new
Set
<
string
>
();
const
wordDefRegExp
=
new
RegExp
(
wordDef
,
wordDefFlags
);
...
...
@@ -558,7 +559,7 @@ export class EditorSimpleWorker implements IRequestHandler, IDisposable {
break
;
}
}
return
words
;
return
{
words
,
duration
:
sw
.
elapsed
()
}
;
}
...
...
src/vs/editor/common/services/editorWorkerServiceImpl.ts
浏览文件 @
38e46c9a
...
...
@@ -161,20 +161,21 @@ class WordBasedCompletionItemProvider implements modes.CompletionItemProvider {
const
insert
=
replace
.
setEndPosition
(
position
.
lineNumber
,
position
.
column
);
const
client
=
await
this
.
_workerManager
.
withWorker
();
const
words
=
await
client
.
textualSuggest
(
model
.
uri
,
position
);
if
(
!
words
)
{
const
data
=
await
client
.
textualSuggest
(
model
.
uri
,
position
);
if
(
!
data
)
{
return
undefined
;
}
return
{
suggestions
:
words
.
map
((
word
):
modes
.
CompletionItem
=>
{
duration
:
data
.
duration
,
suggestions
:
data
.
words
.
map
((
word
):
modes
.
CompletionItem
=>
{
return
{
kind
:
modes
.
CompletionItemKind
.
Text
,
label
:
word
,
insertText
:
word
,
range
:
{
insert
,
replace
}
};
})
})
,
};
}
}
...
...
@@ -462,7 +463,7 @@ export class EditorWorkerClient extends Disposable {
});
}
public
textualSuggest
(
resource
:
URI
,
position
:
IPosition
):
Promise
<
string
[]
|
null
>
{
public
textualSuggest
(
resource
:
URI
,
position
:
IPosition
):
Promise
<
{
words
:
string
[],
duration
:
number
}
|
null
>
{
return
this
.
_withSyncedResources
([
resource
]).
then
(
proxy
=>
{
let
model
=
this
.
_modelService
.
getModel
(
resource
);
if
(
!
model
)
{
...
...
src/vs/editor/test/common/services/editorSimpleWorker.test.ts
浏览文件 @
38e46c9a
...
...
@@ -167,8 +167,9 @@ suite('EditorSimpleWorker', () => {
assert
.
ok
(
false
);
return
;
}
assert
.
equal
(
result
.
length
,
1
);
assert
.
equal
(
result
,
'
foobar
'
);
assert
.
equal
(
result
.
words
.
length
,
1
);
assert
.
equal
(
typeof
result
.
duration
,
'
number
'
);
assert
.
equal
(
result
.
words
[
0
],
'
foobar
'
);
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录