Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e808161b
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e808161b
编写于
10月 02, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
perf - pre-compute and cache lower case variants for label, sortText, and filterText
上级
46238353
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
42 addition
and
17 deletion
+42
-17
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+9
-0
src/vs/editor/contrib/suggest/completionModel.ts
src/vs/editor/contrib/suggest/completionModel.ts
+3
-4
src/vs/editor/contrib/suggest/suggest.ts
src/vs/editor/contrib/suggest/suggest.ts
+25
-10
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+0
-2
src/vs/workbench/api/node/extHostLanguageFeatures.ts
src/vs/workbench/api/node/extHostLanguageFeatures.ts
+5
-1
未找到文件。
src/vs/editor/common/modes.ts
浏览文件 @
e808161b
...
...
@@ -437,8 +437,17 @@ export interface CompletionItem {
* A command that should be run upon acceptance of this item.
*/
command
?:
Command
;
/**@internal*/
noWhitespaceAdjust
?:
boolean
;
/**@internal*/
noAutoAccept
?:
boolean
;
/**@internal*/
_labelLow
?:
string
;
/**@internal*/
_sortTextLow
?:
string
;
/**@internal*/
_filterTextLow
?:
string
;
}
export
interface
CompletionList
{
...
...
src/vs/editor/contrib/suggest/completionModel.ts
浏览文件 @
e808161b
...
...
@@ -21,7 +21,6 @@ export interface ICompletionItem extends ISuggestionItem {
word
?:
string
;
}
/* __GDPR__FRAGMENT__
"ICompletionStats" : {
"suggestionCount" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
...
...
@@ -221,16 +220,16 @@ export class CompletionModel {
// if it matches we check with the label to compute highlights
// and if that doesn't yield a result we have no highlights,
// despite having the match
let
match
=
scoreFn
(
word
,
wordLow
,
wordPos
,
suggestion
.
filterText
,
suggestion
.
filterText
.
toLowerCase
()
,
0
,
false
);
let
match
=
scoreFn
(
word
,
wordLow
,
wordPos
,
suggestion
.
filterText
,
suggestion
.
_filterTextLow
,
0
,
false
);
if
(
!
match
)
{
continue
;
}
item
.
score
=
match
[
0
];
item
.
matches
=
(
fuzzyScore
(
word
,
wordLow
,
0
,
suggestion
.
label
,
suggestion
.
label
.
toLowerCase
()
,
0
,
true
)
||
anyScore
(
word
,
suggestion
.
label
))[
1
];
item
.
matches
=
(
fuzzyScore
(
word
,
wordLow
,
0
,
suggestion
.
label
,
suggestion
.
_labelLow
,
0
,
true
)
||
anyScore
(
word
,
suggestion
.
label
))[
1
];
}
else
{
// by default match `word` against the `label`
let
match
=
scoreFn
(
word
,
wordLow
,
wordPos
,
suggestion
.
label
,
suggestion
.
label
.
toLowerCase
()
,
0
,
false
);
let
match
=
scoreFn
(
word
,
wordLow
,
wordPos
,
suggestion
.
label
,
suggestion
.
_labelLow
,
0
,
false
);
if
(
match
)
{
item
.
score
=
match
[
0
];
item
.
matches
=
match
[
1
];
...
...
src/vs/editor/contrib/suggest/suggest.ts
浏览文件 @
e808161b
...
...
@@ -5,7 +5,6 @@
import
{
first
}
from
'
vs/base/common/async
'
;
import
{
isFalsyOrEmpty
}
from
'
vs/base/common/arrays
'
;
import
{
compareIgnoreCase
}
from
'
vs/base/common/strings
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
onUnexpectedExternalError
,
canceled
}
from
'
vs/base/common/errors
'
;
import
{
IEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
...
...
@@ -94,10 +93,22 @@ export function provideSuggestionItems(
for
(
let
suggestion
of
container
.
suggestions
)
{
if
(
acceptSuggestion
(
suggestion
))
{
// fill in default range when missing
if
(
!
suggestion
.
range
)
{
suggestion
.
range
=
defaultRange
;
}
// fill in lower-case text
if
(
!
suggestion
.
_labelLow
)
{
suggestion
.
_labelLow
=
suggestion
.
label
.
toLowerCase
();
}
if
(
suggestion
.
sortText
&&
!
suggestion
.
_sortTextLow
)
{
suggestion
.
_sortTextLow
=
suggestion
.
sortText
.
toLowerCase
();
}
if
(
suggestion
.
filterText
&&
!
suggestion
.
_filterTextLow
)
{
suggestion
.
_filterTextLow
=
suggestion
.
filterText
.
toLowerCase
();
}
allSuggestions
.
push
({
position
,
container
,
...
...
@@ -156,28 +167,32 @@ function createSuggesionFilter(snippetConfig: SnippetConfig): (candidate: Comple
}
function
defaultComparator
(
a
:
ISuggestionItem
,
b
:
ISuggestionItem
):
number
{
let
ret
=
0
;
// check with 'sortText'
if
(
typeof
a
.
suggestion
.
sortText
===
'
string
'
&&
typeof
b
.
suggestion
.
sortText
===
'
string
'
)
{
ret
=
compareIgnoreCase
(
a
.
suggestion
.
sortText
,
b
.
suggestion
.
sortText
);
if
(
a
.
suggestion
.
_sortTextLow
<
b
.
suggestion
.
_sortTextLow
)
{
return
-
1
;
}
else
if
(
a
.
suggestion
.
_sortTextLow
>
b
.
suggestion
.
_sortTextLow
)
{
return
1
;
}
}
// check with 'label'
if
(
ret
===
0
)
{
ret
=
compareIgnoreCase
(
a
.
suggestion
.
label
,
b
.
suggestion
.
label
);
if
(
a
.
suggestion
.
label
<
b
.
suggestion
.
label
)
{
return
-
1
;
}
else
if
(
a
.
suggestion
.
label
>
b
.
suggestion
.
label
)
{
return
1
;
}
// check with 'type' and lower snippets
if
(
ret
===
0
&&
a
.
suggestion
.
kind
!==
b
.
suggestion
.
kind
)
{
if
(
a
.
suggestion
.
kind
!==
b
.
suggestion
.
kind
)
{
if
(
a
.
suggestion
.
kind
===
CompletionItemKind
.
Snippet
)
{
ret
=
1
;
ret
urn
1
;
}
else
if
(
b
.
suggestion
.
kind
===
CompletionItemKind
.
Snippet
)
{
ret
=
-
1
;
ret
urn
-
1
;
}
}
return
ret
;
return
0
;
}
function
snippetUpComparator
(
a
:
ISuggestionItem
,
b
:
ISuggestionItem
):
number
{
...
...
src/vs/monaco.d.ts
浏览文件 @
e808161b
...
...
@@ -4757,8 +4757,6 @@ declare namespace monaco.languages {
* A command that should be run upon acceptance of this item.
*/
command
?:
Command
;
noWhitespaceAdjust
?:
boolean
;
noAutoAccept
?:
boolean
;
}
export
interface
CompletionList
{
...
...
src/vs/workbench/api/node/extHostLanguageFeatures.ts
浏览文件 @
e808161b
...
...
@@ -675,7 +675,11 @@ class SuggestAdapter {
insertText
:
undefined
,
additionalTextEdits
:
item
.
additionalTextEdits
&&
item
.
additionalTextEdits
.
map
(
typeConvert
.
TextEdit
.
from
),
command
:
this
.
_commands
.
toInternal
(
item
.
command
),
commitCharacters
:
item
.
commitCharacters
commitCharacters
:
item
.
commitCharacters
,
// help with perf
_labelLow
:
item
.
label
.
toLowerCase
(),
_filterTextLow
:
item
.
filterText
&&
item
.
filterText
.
toLowerCase
(),
_sortTextLow
:
item
.
sortText
&&
item
.
sortText
.
toLowerCase
()
};
// 'insertText'-logic
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录