Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3190c252
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,发现更多精彩内容 >>
未验证
提交
3190c252
编写于
3月 07, 2019
作者:
J
Johannes Rieken
提交者:
GitHub
3月 07, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #69942 from svipas/max-suggestions-to-show-and-icons
Add showIcons and maxSuggestionsToShow settings
上级
7b45f268
2a6b0ded
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
76 addition
and
31 deletion
+76
-31
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+12
-0
src/vs/editor/common/config/editorOptions.ts
src/vs/editor/common/config/editorOptions.ts
+19
-14
src/vs/editor/contrib/suggest/suggestWidget.ts
src/vs/editor/contrib/suggest/suggestWidget.ts
+7
-6
src/vs/editor/contrib/suggest/test/completionModel.test.ts
src/vs/editor/contrib/suggest/test/completionModel.test.ts
+27
-3
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+10
-6
src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts
...Editor/browser/suggestEnabledInput/suggestEnabledInput.ts
+1
-2
未找到文件。
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
3190c252
...
...
@@ -679,6 +679,18 @@ const editorConfiguration: IConfigurationNode = {
default
:
true
,
description
:
nls
.
localize
(
'
suggest.snippetsPreventQuickSuggestions
'
,
"
Control whether an active snippet prevents quick suggestions.
"
)
},
'
editor.suggest.showIcons
'
:
{
type
:
'
boolean
'
,
default
:
EDITOR_DEFAULTS
.
contribInfo
.
suggest
.
showIcons
,
description
:
nls
.
localize
(
'
suggest.showIcons
'
,
"
Controls whether to show or hide icons in suggestions.
"
)
},
'
editor.suggest.maxSuggestionsToShow
'
:
{
type
:
'
number
'
,
default
:
EDITOR_DEFAULTS
.
contribInfo
.
suggest
.
maxSuggestionsToShow
,
minimum
:
1
,
maximum
:
12
,
description
:
nls
.
localize
(
'
suggest.maxSuggestionsToShow
'
,
"
Controls how many suggestions to show in suggestions.
"
)
},
'
editor.selectionHighlight
'
:
{
'
type
'
:
'
boolean
'
,
'
default
'
:
EDITOR_DEFAULTS
.
contribInfo
.
selectionHighlight
,
...
...
src/vs/editor/common/config/editorOptions.ts
浏览文件 @
3190c252
...
...
@@ -199,11 +199,18 @@ export interface ISuggestOptions {
* Favours words that appear close to the cursor.
*/
localityBonus
?:
boolean
;
/**
* Enable using global storage for remembering suggestions.
*/
shareSuggestSelections
?:
boolean
;
/**
* Enable or disable icons in suggestions. Defaults to true.
*/
showIcons
?:
boolean
;
/**
* Max suggestions to show in suggestions. Defaults to 12.
*/
maxSuggestionsToShow
?:
boolean
;
}
/**
...
...
@@ -506,11 +513,6 @@ export interface IEditorOptions {
* Parameter hint options.
*/
parameterHints
?:
IEditorParameterHintOptions
;
/**
* Render icons in suggestions box.
* Defaults to true.
*/
iconsInSuggestions
?:
boolean
;
/**
* Options for auto closing brackets.
* Defaults to language defined behavior.
...
...
@@ -923,6 +925,8 @@ export interface InternalSuggestOptions {
readonly
snippetsPreventQuickSuggestions
:
boolean
;
readonly
localityBonus
:
boolean
;
readonly
shareSuggestSelections
:
boolean
;
readonly
showIcons
:
boolean
;
readonly
maxSuggestionsToShow
:
number
;
}
export
interface
InternalParameterHintOptions
{
...
...
@@ -993,7 +997,6 @@ export interface EditorContribOptions {
readonly
quickSuggestions
:
boolean
|
{
other
:
boolean
,
comments
:
boolean
,
strings
:
boolean
};
readonly
quickSuggestionsDelay
:
number
;
readonly
parameterHints
:
InternalParameterHintOptions
;
readonly
iconsInSuggestions
:
boolean
;
readonly
formatOnType
:
boolean
;
readonly
formatOnPaste
:
boolean
;
readonly
suggestOnTriggerCharacters
:
boolean
;
...
...
@@ -1374,7 +1377,9 @@ export class InternalEditorOptions {
&&
a
.
snippets
===
b
.
snippets
&&
a
.
snippetsPreventQuickSuggestions
===
b
.
snippetsPreventQuickSuggestions
&&
a
.
localityBonus
===
b
.
localityBonus
&&
a
.
shareSuggestSelections
===
b
.
shareSuggestSelections
;
&&
a
.
shareSuggestSelections
===
b
.
shareSuggestSelections
&&
a
.
showIcons
===
b
.
showIcons
&&
a
.
maxSuggestionsToShow
===
b
.
maxSuggestionsToShow
;
}
}
...
...
@@ -1407,7 +1412,6 @@ export class InternalEditorOptions {
&&
InternalEditorOptions
.
_equalsQuickSuggestions
(
a
.
quickSuggestions
,
b
.
quickSuggestions
)
&&
a
.
quickSuggestionsDelay
===
b
.
quickSuggestionsDelay
&&
this
.
_equalsParameterHintOptions
(
a
.
parameterHints
,
b
.
parameterHints
)
&&
a
.
iconsInSuggestions
===
b
.
iconsInSuggestions
&&
a
.
formatOnType
===
b
.
formatOnType
&&
a
.
formatOnPaste
===
b
.
formatOnPaste
&&
a
.
suggestOnTriggerCharacters
===
b
.
suggestOnTriggerCharacters
...
...
@@ -1907,7 +1911,9 @@ export class EditorOptionsValidator {
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
),
shareSuggestSelections
:
_boolean
(
suggestOpts
.
shareSuggestSelections
,
defaults
.
shareSuggestSelections
)
shareSuggestSelections
:
_boolean
(
suggestOpts
.
shareSuggestSelections
,
defaults
.
shareSuggestSelections
),
showIcons
:
_boolean
(
suggestOpts
.
showIcons
,
defaults
.
showIcons
),
maxSuggestionsToShow
:
_clampedInt
(
suggestOpts
.
maxSuggestionsToShow
,
defaults
.
maxSuggestionsToShow
,
1
,
12
)
};
}
...
...
@@ -2052,7 +2058,6 @@ export class EditorOptionsValidator {
quickSuggestions
:
quickSuggestions
,
quickSuggestionsDelay
:
_clampedInt
(
opts
.
quickSuggestionsDelay
,
defaults
.
quickSuggestionsDelay
,
Constants
.
MIN_SAFE_SMALL_INTEGER
,
Constants
.
MAX_SAFE_SMALL_INTEGER
),
parameterHints
:
this
.
_sanitizeParameterHintOpts
(
opts
.
parameterHints
,
defaults
.
parameterHints
),
iconsInSuggestions
:
_boolean
(
opts
.
iconsInSuggestions
,
defaults
.
iconsInSuggestions
),
formatOnType
:
_boolean
(
opts
.
formatOnType
,
defaults
.
formatOnType
),
formatOnPaste
:
_boolean
(
opts
.
formatOnPaste
,
defaults
.
formatOnPaste
),
suggestOnTriggerCharacters
:
_boolean
(
opts
.
suggestOnTriggerCharacters
,
defaults
.
suggestOnTriggerCharacters
),
...
...
@@ -2166,7 +2171,6 @@ export class InternalEditorOptionsFactory {
quickSuggestions
:
opts
.
contribInfo
.
quickSuggestions
,
quickSuggestionsDelay
:
opts
.
contribInfo
.
quickSuggestionsDelay
,
parameterHints
:
opts
.
contribInfo
.
parameterHints
,
iconsInSuggestions
:
opts
.
contribInfo
.
iconsInSuggestions
,
formatOnType
:
opts
.
contribInfo
.
formatOnType
,
formatOnPaste
:
opts
.
contribInfo
.
formatOnPaste
,
suggestOnTriggerCharacters
:
opts
.
contribInfo
.
suggestOnTriggerCharacters
,
...
...
@@ -2651,7 +2655,6 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
enabled
:
true
,
cycle
:
false
},
iconsInSuggestions
:
true
,
formatOnType
:
false
,
formatOnPaste
:
false
,
suggestOnTriggerCharacters
:
true
,
...
...
@@ -2667,7 +2670,9 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
snippets
:
'
inline
'
,
snippetsPreventQuickSuggestions
:
true
,
localityBonus
:
false
,
shareSuggestSelections
:
false
shareSuggestSelections
:
false
,
showIcons
:
true
,
maxSuggestionsToShow
:
12
},
selectionHighlight
:
true
,
occurrencesHighlight
:
true
,
...
...
src/vs/editor/contrib/suggest/suggestWidget.ts
浏览文件 @
3190c252
...
...
@@ -40,7 +40,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
FileKind
}
from
'
vs/platform/files/common/files
'
;
const
expandSuggestionDocsByDefault
=
false
;
const
maxSuggestionsToShow
=
12
;
interface
ISuggestionTemplateData
{
root
:
HTMLElement
;
...
...
@@ -466,14 +465,14 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this
.
storageService
=
storageService
;
this
.
element
=
$
(
'
.editor-widget.suggest-widget
'
);
if
(
!
this
.
editor
.
getConfiguration
().
contribInfo
.
iconsInSuggestions
)
{
addClass
(
this
.
element
,
'
no-icons
'
);
}
this
.
messageElement
=
append
(
this
.
element
,
$
(
'
.message
'
));
this
.
listElement
=
append
(
this
.
element
,
$
(
'
.tree
'
));
this
.
details
=
new
SuggestionDetails
(
this
.
element
,
this
,
this
.
editor
,
markdownRenderer
,
triggerKeybindingLabel
);
const
applyIconStyle
=
()
=>
toggleClass
(
this
.
element
,
'
no-icons
'
,
!
this
.
editor
.
getConfiguration
().
contribInfo
.
suggest
.
showIcons
);
applyIconStyle
();
let
renderer
=
instantiationService
.
createInstance
(
Renderer
,
this
,
this
.
editor
,
triggerKeybindingLabel
);
this
.
list
=
new
List
(
this
.
listElement
,
this
,
[
renderer
],
{
...
...
@@ -492,7 +491,8 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this
.
list
.
onMouseDown
(
e
=>
this
.
onListMouseDown
(
e
)),
this
.
list
.
onSelectionChange
(
e
=>
this
.
onListSelection
(
e
)),
this
.
list
.
onFocusChange
(
e
=>
this
.
onListFocus
(
e
)),
this
.
editor
.
onDidChangeCursorSelection
(()
=>
this
.
onCursorSelectionChanged
())
this
.
editor
.
onDidChangeCursorSelection
(()
=>
this
.
onCursorSelectionChanged
()),
this
.
editor
.
onDidChangeConfiguration
(
e
=>
e
.
contribInfo
&&
applyIconStyle
())
];
this
.
suggestWidgetVisible
=
SuggestContext
.
Visible
.
bindTo
(
contextKeyService
);
...
...
@@ -1037,6 +1037,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
height
=
this
.
unfocusedHeight
;
}
else
{
const
suggestionCount
=
this
.
list
.
contentHeight
/
this
.
unfocusedHeight
;
const
maxSuggestionsToShow
=
this
.
editor
.
getConfiguration
().
contribInfo
.
suggest
.
maxSuggestionsToShow
;
height
=
Math
.
min
(
suggestionCount
,
maxSuggestionsToShow
)
*
this
.
unfocusedHeight
;
}
...
...
@@ -1117,7 +1118,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
// Heights
private
get
maxWidgetHeight
():
number
{
return
this
.
unfocusedHeight
*
maxSuggestionsToShow
;
return
this
.
unfocusedHeight
*
this
.
editor
.
getConfiguration
().
contribInfo
.
suggest
.
maxSuggestionsToShow
;
}
private
get
unfocusedHeight
():
number
{
...
...
src/vs/editor/contrib/suggest/test/completionModel.test.ts
浏览文件 @
3190c252
...
...
@@ -157,7 +157,15 @@ suite('CompletionModel', function () {
],
1
,
{
leadingLineContent
:
'
s
'
,
characterCountDelta
:
0
},
WordDistance
.
None
,
{
snippets
:
'
top
'
,
snippetsPreventQuickSuggestions
:
true
,
filterGraceful
:
true
,
localityBonus
:
false
,
shareSuggestSelections
:
false
});
},
WordDistance
.
None
,
{
snippets
:
'
top
'
,
snippetsPreventQuickSuggestions
:
true
,
filterGraceful
:
true
,
localityBonus
:
false
,
shareSuggestSelections
:
false
,
showIcons
:
true
,
maxSuggestionsToShow
:
12
});
assert
.
equal
(
model
.
items
.
length
,
2
);
const
[
a
,
b
]
=
model
.
items
;
...
...
@@ -176,7 +184,15 @@ suite('CompletionModel', function () {
],
1
,
{
leadingLineContent
:
'
s
'
,
characterCountDelta
:
0
},
WordDistance
.
None
,
{
snippets
:
'
bottom
'
,
snippetsPreventQuickSuggestions
:
true
,
filterGraceful
:
true
,
localityBonus
:
false
,
shareSuggestSelections
:
false
});
},
WordDistance
.
None
,
{
snippets
:
'
bottom
'
,
snippetsPreventQuickSuggestions
:
true
,
filterGraceful
:
true
,
localityBonus
:
false
,
shareSuggestSelections
:
false
,
showIcons
:
true
,
maxSuggestionsToShow
:
12
});
assert
.
equal
(
model
.
items
.
length
,
2
);
const
[
a
,
b
]
=
model
.
items
;
...
...
@@ -194,7 +210,15 @@ suite('CompletionModel', function () {
],
1
,
{
leadingLineContent
:
'
s
'
,
characterCountDelta
:
0
},
WordDistance
.
None
,
{
snippets
:
'
inline
'
,
snippetsPreventQuickSuggestions
:
true
,
filterGraceful
:
true
,
localityBonus
:
false
,
shareSuggestSelections
:
false
});
},
WordDistance
.
None
,
{
snippets
:
'
inline
'
,
snippetsPreventQuickSuggestions
:
true
,
filterGraceful
:
true
,
localityBonus
:
false
,
shareSuggestSelections
:
false
,
showIcons
:
true
,
maxSuggestionsToShow
:
12
});
assert
.
equal
(
model
.
items
.
length
,
2
);
const
[
a
,
b
]
=
model
.
items
;
...
...
src/vs/monaco.d.ts
浏览文件 @
3190c252
...
...
@@ -2547,6 +2547,14 @@ declare namespace monaco.editor {
* Enable using global storage for remembering suggestions.
*/
shareSuggestSelections
?:
boolean
;
/**
* Enable or disable icons in suggestions. Defaults to true.
*/
showIcons
?:
boolean
;
/**
* Max suggestions to show in suggestions. Defaults to 12.
*/
maxSuggestionsToShow
?:
boolean
;
}
/**
...
...
@@ -2841,11 +2849,6 @@ declare namespace monaco.editor {
* Parameter hint options.
*/
parameterHints
?:
IEditorParameterHintOptions
;
/**
* Render icons in suggestions box.
* Defaults to true.
*/
iconsInSuggestions
?:
boolean
;
/**
* Options for auto closing brackets.
* Defaults to language defined behavior.
...
...
@@ -3195,6 +3198,8 @@ declare namespace monaco.editor {
readonly
snippetsPreventQuickSuggestions
:
boolean
;
readonly
localityBonus
:
boolean
;
readonly
shareSuggestSelections
:
boolean
;
readonly
showIcons
:
boolean
;
readonly
maxSuggestionsToShow
:
number
;
}
export
interface
InternalParameterHintOptions
{
...
...
@@ -3269,7 +3274,6 @@ declare namespace monaco.editor {
};
readonly
quickSuggestionsDelay
:
number
;
readonly
parameterHints
:
InternalParameterHintOptions
;
readonly
iconsInSuggestions
:
boolean
;
readonly
formatOnType
:
boolean
;
readonly
formatOnPaste
:
boolean
;
readonly
suggestOnTriggerCharacters
:
boolean
;
...
...
src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts
浏览文件 @
3190c252
...
...
@@ -294,7 +294,6 @@ function getSuggestEnabledInputOptions(ariaLabel?: string): IEditorOptions {
ariaLabel
:
ariaLabel
||
''
,
snippetSuggestions
:
'
none
'
,
suggest
:
{
filterGraceful
:
false
},
iconsInSuggestions
:
false
suggest
:
{
filterGraceful
:
false
,
showIcons
:
false
}
};
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录