mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-03 16:15:28 +01:00
Merge pull request #183954 from microsoft/joh/overwhelming-tuna
joh/overwhelming tuna
This commit is contained in:
@@ -4134,6 +4134,10 @@ export interface ISuggestOptions {
|
||||
* Enable graceful matching. Defaults to true.
|
||||
*/
|
||||
filterGraceful?: boolean;
|
||||
/**
|
||||
* Prevent quick suggestions when a snippet is active. Defaults to true.
|
||||
*/
|
||||
snippetsPreventQuickSuggestions?: boolean;
|
||||
/**
|
||||
* Favors words that appear close to the cursor.
|
||||
*/
|
||||
@@ -4295,6 +4299,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, ISuggestOptio
|
||||
const defaults: InternalSuggestOptions = {
|
||||
insertMode: 'insert',
|
||||
filterGraceful: true,
|
||||
snippetsPreventQuickSuggestions: false,
|
||||
localityBonus: false,
|
||||
shareSuggestSelections: false,
|
||||
selectionMode: 'always',
|
||||
@@ -4373,6 +4378,11 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, ISuggestOptio
|
||||
default: defaults.selectionMode,
|
||||
markdownDescription: nls.localize('suggest.selectionMode', "Controls whether a suggestion is selected when the widget shows. Note that this only applies to automatically triggered suggestions (`#editor.quickSuggestions#` and `#editor.suggestOnTriggerCharacters#`) and that a suggestion is always selected when explicitly invoked, e.g via `Ctrl+Space`.")
|
||||
},
|
||||
'editor.suggest.snippetsPreventQuickSuggestions': {
|
||||
type: 'boolean',
|
||||
default: defaults.snippetsPreventQuickSuggestions,
|
||||
description: nls.localize('suggest.snippetsPreventQuickSuggestions', "Controls whether an active snippet prevents quick suggestions.")
|
||||
},
|
||||
'editor.suggest.showIcons': {
|
||||
type: 'boolean',
|
||||
default: defaults.showIcons,
|
||||
@@ -4563,6 +4573,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, ISuggestOptio
|
||||
return {
|
||||
insertMode: stringSet(input.insertMode, this.defaultValue.insertMode, ['insert', 'replace']),
|
||||
filterGraceful: boolean(input.filterGraceful, this.defaultValue.filterGraceful),
|
||||
snippetsPreventQuickSuggestions: boolean(input.snippetsPreventQuickSuggestions, this.defaultValue.filterGraceful),
|
||||
localityBonus: boolean(input.localityBonus, this.defaultValue.localityBonus),
|
||||
shareSuggestSelections: boolean(input.shareSuggestSelections, this.defaultValue.shareSuggestSelections),
|
||||
selectionMode: stringSet(input.selectionMode, this.defaultValue.selectionMode, ['always', 'never', 'whenQuickSuggestion', 'whenTriggerCharacter']),
|
||||
|
||||
@@ -246,9 +246,8 @@ export class SuggestController implements IEditorContribution {
|
||||
|
||||
let noFocus = false;
|
||||
if (e.triggerOptions.auto) {
|
||||
// don't "focus" item when configured to do so or when in snippet mode (and configured to do so)
|
||||
// don't "focus" item when configured to do
|
||||
const options = this.editor.getOption(EditorOption.suggest);
|
||||
|
||||
if (options.selectionMode === 'never' || options.selectionMode === 'always') {
|
||||
// simple: always or never
|
||||
noFocus = options.selectionMode === 'never';
|
||||
@@ -777,7 +776,7 @@ registerEditorCommand(new SuggestCommand({
|
||||
kbOpts: [{
|
||||
// normal tab
|
||||
primary: KeyCode.Tab,
|
||||
kbExpr: ContextKeyExpr.and(SuggestContext.Visible, EditorContextKeys.textInputFocus, SnippetController2.InSnippetMode.toNegated()),
|
||||
kbExpr: ContextKeyExpr.and(SuggestContext.Visible, EditorContextKeys.textInputFocus),
|
||||
weight,
|
||||
}, {
|
||||
// accept on enter has special rules
|
||||
@@ -811,7 +810,7 @@ registerEditorCommand(new SuggestCommand({
|
||||
precondition: ContextKeyExpr.and(SuggestContext.Visible, EditorContextKeys.textInputFocus, SuggestContext.HasFocusedSuggestion),
|
||||
kbOpts: {
|
||||
weight: weight,
|
||||
kbExpr: ContextKeyExpr.and(EditorContextKeys.textInputFocus, SnippetController2.InSnippetMode.toNegated()),
|
||||
kbExpr: EditorContextKeys.textInputFocus,
|
||||
primary: KeyMod.Shift | KeyCode.Enter,
|
||||
secondary: [KeyMod.Shift | KeyCode.Tab],
|
||||
},
|
||||
|
||||
@@ -35,6 +35,7 @@ suite('CompletionModel', function () {
|
||||
|
||||
const defaultOptions = <InternalSuggestOptions>{
|
||||
insertMode: 'insert',
|
||||
snippetsPreventQuickSuggestions: true,
|
||||
filterGraceful: true,
|
||||
localityBonus: false,
|
||||
shareSuggestSelections: false,
|
||||
|
||||
Vendored
+4
@@ -4543,6 +4543,10 @@ declare namespace monaco.editor {
|
||||
* Enable graceful matching. Defaults to true.
|
||||
*/
|
||||
filterGraceful?: boolean;
|
||||
/**
|
||||
* Prevent quick suggestions when a snippet is active. Defaults to true.
|
||||
*/
|
||||
snippetsPreventQuickSuggestions?: boolean;
|
||||
/**
|
||||
* Favors words that appear close to the cursor.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user