Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e190b866
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,发现更多精彩内容 >>
提交
e190b866
编写于
9月 24, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add locality bonus setting
上级
ff97e6a9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
27 addition
and
5 deletion
+27
-5
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+5
-0
src/vs/editor/common/config/editorOptions.ts
src/vs/editor/common/config/editorOptions.ts
+10
-2
src/vs/editor/contrib/suggest/test/completionModel.test.ts
src/vs/editor/contrib/suggest/test/completionModel.test.ts
+3
-3
src/vs/editor/contrib/suggest/wordDistance.ts
src/vs/editor/contrib/suggest/wordDistance.ts
+4
-0
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+5
-0
未找到文件。
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
e190b866
...
...
@@ -636,6 +636,11 @@ const editorConfiguration: IConfigurationNode = {
default
:
true
,
description
:
nls
.
localize
(
'
suggest.filterGraceful
'
,
"
Controls whether filtering and sorting suggestions accounts for small typos.
"
)
},
'
editor.suggest.localityBonus
'
:
{
type
:
'
boolean
'
,
default
:
false
,
description
:
nls
.
localize
(
'
suggest.localityBonus
'
,
"
Controls whether sorting favours words that appear close to the cursor.
"
)
},
'
editor.suggest.snippetsPreventQuickSuggestions
'
:
{
type
:
'
boolean
'
,
default
:
true
,
...
...
src/vs/editor/common/config/editorOptions.ts
浏览文件 @
e190b866
...
...
@@ -193,6 +193,10 @@ export interface ISuggestOptions {
* Prevent quick suggestions when a snippet is active. Defaults to true.
*/
snippetsPreventQuickSuggestions
?:
boolean
;
/**
* Favours words that appear close to the cursor.
*/
localityBonus
?:
boolean
;
}
/**
...
...
@@ -893,6 +897,7 @@ export interface InternalSuggestOptions {
readonly
filterGraceful
:
boolean
;
readonly
snippets
:
'
top
'
|
'
bottom
'
|
'
inline
'
|
'
none
'
;
readonly
snippetsPreventQuickSuggestions
:
boolean
;
readonly
localityBonus
:
boolean
;
}
export
interface
InternalParameterHintOptions
{
...
...
@@ -1336,7 +1341,8 @@ export class InternalEditorOptions {
}
else
{
return
a
.
filterGraceful
===
b
.
filterGraceful
&&
a
.
snippets
===
b
.
snippets
&&
a
.
snippetsPreventQuickSuggestions
===
b
.
snippetsPreventQuickSuggestions
;
&&
a
.
snippetsPreventQuickSuggestions
===
b
.
snippetsPreventQuickSuggestions
&&
a
.
localityBonus
===
b
.
localityBonus
;
}
}
...
...
@@ -1866,6 +1872,7 @@ export class EditorOptionsValidator {
filterGraceful
:
_boolean
(
suggestOpts
.
filterGraceful
,
defaults
.
filterGraceful
),
snippets
:
_stringSet
<
'
top
'
|
'
bottom
'
|
'
inline
'
|
'
none
'
>
(
opts
.
snippetSuggestions
,
defaults
.
snippets
,
[
'
top
'
,
'
bottom
'
,
'
inline
'
,
'
none
'
]),
snippetsPreventQuickSuggestions
:
_boolean
(
suggestOpts
.
snippetsPreventQuickSuggestions
,
defaults
.
filterGraceful
),
localityBonus
:
_boolean
(
suggestOpts
.
localityBonus
,
defaults
.
localityBonus
),
};
}
...
...
@@ -2610,7 +2617,8 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
suggest
:
{
filterGraceful
:
true
,
snippets
:
'
inline
'
,
snippetsPreventQuickSuggestions
:
true
snippetsPreventQuickSuggestions
:
true
,
localityBonus
:
false
},
selectionHighlight
:
true
,
occurrencesHighlight
:
true
,
...
...
src/vs/editor/contrib/suggest/test/completionModel.test.ts
浏览文件 @
e190b866
...
...
@@ -168,7 +168,7 @@ suite('CompletionModel', function () {
],
1
,
{
leadingLineContent
:
'
s
'
,
characterCountDelta
:
0
},
WordDistance
.
None
,
{
snippets
:
'
top
'
,
snippetsPreventQuickSuggestions
:
true
,
filterGraceful
:
true
});
},
WordDistance
.
None
,
{
snippets
:
'
top
'
,
snippetsPreventQuickSuggestions
:
true
,
filterGraceful
:
true
,
localityBonus
:
false
});
assert
.
equal
(
model
.
items
.
length
,
2
);
const
[
a
,
b
]
=
model
.
items
;
...
...
@@ -187,7 +187,7 @@ suite('CompletionModel', function () {
],
1
,
{
leadingLineContent
:
'
s
'
,
characterCountDelta
:
0
},
WordDistance
.
None
,
{
snippets
:
'
bottom
'
,
snippetsPreventQuickSuggestions
:
true
,
filterGraceful
:
true
});
},
WordDistance
.
None
,
{
snippets
:
'
bottom
'
,
snippetsPreventQuickSuggestions
:
true
,
filterGraceful
:
true
,
localityBonus
:
false
});
assert
.
equal
(
model
.
items
.
length
,
2
);
const
[
a
,
b
]
=
model
.
items
;
...
...
@@ -205,7 +205,7 @@ suite('CompletionModel', function () {
],
1
,
{
leadingLineContent
:
'
s
'
,
characterCountDelta
:
0
},
WordDistance
.
None
,
{
snippets
:
'
inline
'
,
snippetsPreventQuickSuggestions
:
true
,
filterGraceful
:
true
});
},
WordDistance
.
None
,
{
snippets
:
'
inline
'
,
snippetsPreventQuickSuggestions
:
true
,
filterGraceful
:
true
,
localityBonus
:
false
});
assert
.
equal
(
model
.
items
.
length
,
2
);
const
[
a
,
b
]
=
model
.
items
;
...
...
src/vs/editor/contrib/suggest/wordDistance.ts
浏览文件 @
e190b866
...
...
@@ -20,6 +20,10 @@ export abstract class WordDistance {
static
create
(
service
:
IEditorWorkerService
,
editor
:
ICodeEditor
):
Thenable
<
WordDistance
>
{
if
(
!
editor
.
getConfiguration
().
contribInfo
.
suggest
.
localityBonus
)
{
return
Promise
.
resolve
(
WordDistance
.
None
);
}
const
model
=
editor
.
getModel
();
const
position
=
editor
.
getPosition
();
const
range
=
new
Range
(
Math
.
max
(
1
,
position
.
lineNumber
-
100
),
1
,
Math
.
min
(
model
.
getLineCount
()
-
1
,
position
.
lineNumber
+
100
),
1
);
...
...
src/vs/monaco.d.ts
浏览文件 @
e190b866
...
...
@@ -2540,6 +2540,10 @@ declare namespace monaco.editor {
* Prevent quick suggestions when a snippet is active. Defaults to true.
*/
snippetsPreventQuickSuggestions
?:
boolean
;
/**
* Favours words that appear close to the cursor.
*/
localityBonus
?:
boolean
;
}
/**
...
...
@@ -3169,6 +3173,7 @@ declare namespace monaco.editor {
readonly
filterGraceful
:
boolean
;
readonly
snippets
:
'
top
'
|
'
bottom
'
|
'
inline
'
|
'
none
'
;
readonly
snippetsPreventQuickSuggestions
:
boolean
;
readonly
localityBonus
:
boolean
;
}
export
interface
InternalParameterHintOptions
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录