Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
bc067a81
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,发现更多精彩内容 >>
提交
bc067a81
编写于
7月 06, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
disable quick suggestions when in snippet mode, #50776
上级
66d811f8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
24 addition
and
8 deletion
+24
-8
src/vs/editor/common/config/editorOptions.ts
src/vs/editor/common/config/editorOptions.ts
+4
-1
src/vs/editor/contrib/snippet/snippetController2.ts
src/vs/editor/contrib/snippet/snippetController2.ts
+4
-0
src/vs/editor/contrib/suggest/completionModel.ts
src/vs/editor/contrib/suggest/completionModel.ts
+2
-2
src/vs/editor/contrib/suggest/suggestModel.ts
src/vs/editor/contrib/suggest/suggestModel.ts
+6
-0
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/test/suggestModel.test.ts
src/vs/editor/contrib/suggest/test/suggestModel.test.ts
+4
-2
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+1
-0
未找到文件。
src/vs/editor/common/config/editorOptions.ts
浏览文件 @
bc067a81
...
...
@@ -844,6 +844,7 @@ export interface InternalEditorHoverOptions {
export
interface
InternalSuggestOptions
{
readonly
filterGraceful
:
boolean
;
readonly
snippets
:
'
top
'
|
'
bottom
'
|
'
inline
'
|
'
none
'
;
readonly
snippetsPreventQuickSuggestions
:
boolean
;
}
export
interface
EditorWrappingInfo
{
...
...
@@ -1751,6 +1752,7 @@ export class EditorOptionsValidator {
return
{
filterGraceful
:
_boolean
(
opts
.
suggest
.
filterGraceful
,
defaults
.
filterGraceful
),
snippets
:
_stringSet
<
'
top
'
|
'
bottom
'
|
'
inline
'
|
'
none
'
>
(
opts
.
snippetSuggestions
,
defaults
.
snippets
,
[
'
top
'
,
'
bottom
'
,
'
inline
'
,
'
none
'
]),
snippetsPreventQuickSuggestions
:
true
,
};
}
...
...
@@ -2470,7 +2472,8 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
suggestLineHeight
:
0
,
suggest
:
{
filterGraceful
:
true
,
snippets
:
'
inline
'
snippets
:
'
inline
'
,
snippetsPreventQuickSuggestions
:
true
},
selectionHighlight
:
true
,
occurrencesHighlight
:
true
,
...
...
src/vs/editor/contrib/snippet/snippetController2.ts
浏览文件 @
bc067a81
...
...
@@ -205,6 +205,10 @@ export class SnippetController2 implements IEditorContribution {
this
.
_updateState
();
}
isInSnippet
():
boolean
{
return
this
.
_inSnippet
.
get
();
}
getSessionEnclosingRange
():
Range
{
if
(
this
.
_session
)
{
return
this
.
_session
.
getEnclosingRange
();
...
...
src/vs/editor/contrib/suggest/completionModel.ts
浏览文件 @
bc067a81
...
...
@@ -9,7 +9,7 @@ import { fuzzyScore, fuzzyScoreGracefulAggressive, anyScore } from 'vs/base/comm
import
{
isDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ISuggestResult
,
ISuggestSupport
}
from
'
vs/editor/common/modes
'
;
import
{
ISuggestionItem
}
from
'
./suggest
'
;
import
{
InternalSuggestOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
InternalSuggestOptions
,
EDITOR_DEFAULTS
}
from
'
vs/editor/common/config/editorOptions
'
;
export
interface
ICompletionItem
extends
ISuggestionItem
{
matches
?:
number
[];
...
...
@@ -58,7 +58,7 @@ export class CompletionModel {
private
_isIncomplete
:
Set
<
ISuggestSupport
>
;
private
_stats
:
ICompletionStats
;
constructor
(
items
:
ISuggestionItem
[],
column
:
number
,
lineContext
:
LineContext
,
options
:
InternalSuggestOptions
=
{
filterGraceful
:
true
,
snippets
:
'
inline
'
}
)
{
constructor
(
items
:
ISuggestionItem
[],
column
:
number
,
lineContext
:
LineContext
,
options
:
InternalSuggestOptions
=
EDITOR_DEFAULTS
.
contribInfo
.
suggest
)
{
this
.
_items
=
items
;
this
.
_column
=
column
;
this
.
_options
=
options
;
...
...
src/vs/editor/contrib/suggest/suggestModel.ts
浏览文件 @
bc067a81
...
...
@@ -18,6 +18,7 @@ import { ITextModel, IWordAtPosition } from 'vs/editor/common/model';
import
{
ISuggestSupport
,
StandardTokenType
,
SuggestContext
,
SuggestRegistry
,
SuggestTriggerKind
}
from
'
vs/editor/common/modes
'
;
import
{
CompletionModel
}
from
'
./completionModel
'
;
import
{
ISuggestionItem
,
getSuggestionComparator
,
provideSuggestionItems
,
getSnippetSuggestSupport
}
from
'
./suggest
'
;
import
{
SnippetController2
}
from
'
vs/editor/contrib/snippet/snippetController2
'
;
export
interface
ICancelEvent
{
readonly
retrigger
:
boolean
;
...
...
@@ -273,6 +274,11 @@ export class SuggestModel implements IDisposable {
return
;
}
if
(
this
.
_editor
.
getConfiguration
().
contribInfo
.
suggest
.
snippetsPreventQuickSuggestions
&&
SnippetController2
.
get
(
this
.
_editor
).
isInSnippet
())
{
// no quick suggestion when in snippet mode
return
;
}
this
.
cancel
();
this
.
_triggerQuickSuggest
.
cancelAndSet
(()
=>
{
...
...
src/vs/editor/contrib/suggest/test/completionModel.test.ts
浏览文件 @
bc067a81
...
...
@@ -167,7 +167,7 @@ suite('CompletionModel', function () {
],
1
,
{
leadingLineContent
:
'
s
'
,
characterCountDelta
:
0
},
{
snippets
:
'
top
'
,
filterGraceful
:
true
});
},
{
snippets
:
'
top
'
,
snippetsPreventQuickSuggestions
:
true
,
filterGraceful
:
true
});
assert
.
equal
(
model
.
items
.
length
,
2
);
const
[
a
,
b
]
=
model
.
items
;
...
...
@@ -186,7 +186,7 @@ suite('CompletionModel', function () {
],
1
,
{
leadingLineContent
:
'
s
'
,
characterCountDelta
:
0
},
{
snippets
:
'
bottom
'
,
filterGraceful
:
true
});
},
{
snippets
:
'
bottom
'
,
snippetsPreventQuickSuggestions
:
true
,
filterGraceful
:
true
});
assert
.
equal
(
model
.
items
.
length
,
2
);
const
[
a
,
b
]
=
model
.
items
;
...
...
@@ -204,7 +204,7 @@ suite('CompletionModel', function () {
],
1
,
{
leadingLineContent
:
'
s
'
,
characterCountDelta
:
0
},
{
snippets
:
'
inline
'
,
filterGraceful
:
true
});
},
{
snippets
:
'
inline
'
,
snippetsPreventQuickSuggestions
:
true
,
filterGraceful
:
true
});
assert
.
equal
(
model
.
items
.
length
,
2
);
const
[
a
,
b
]
=
model
.
items
;
...
...
src/vs/editor/contrib/suggest/test/suggestModel.test.ts
浏览文件 @
bc067a81
...
...
@@ -30,13 +30,15 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
{
NullTelemetryService
}
from
'
vs/platform/telemetry/common/telemetryUtils
'
;
function
createMockEditor
(
model
:
TextModel
):
TestCodeEditor
{
return
createTestCodeEditor
({
let
editor
=
createTestCodeEditor
({
model
:
model
,
serviceCollection
:
new
ServiceCollection
(
[
ITelemetryService
,
NullTelemetryService
],
[
IStorageService
,
NullStorageService
]
)
)
,
});
editor
.
registerAndInstantiateContribution
(
SnippetController2
);
return
editor
;
}
suite
(
'
SuggestModel - Context
'
,
function
()
{
...
...
src/vs/monaco.d.ts
浏览文件 @
bc067a81
...
...
@@ -3123,6 +3123,7 @@ declare namespace monaco.editor {
export
interface
InternalSuggestOptions
{
readonly
filterGraceful
:
boolean
;
readonly
snippets
:
'
top
'
|
'
bottom
'
|
'
inline
'
|
'
none
'
;
readonly
snippetsPreventQuickSuggestions
:
boolean
;
}
export
interface
EditorWrappingInfo
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录