From 9965a5d86bd44e0435938552b7f4ce41b8df3bd1 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 14 Mar 2017 10:42:17 +0100 Subject: [PATCH] tweak setting, update defaut to only suggest outside of comments and strings, #9504 --- src/vs/editor/common/config/commonEditorConfig.ts | 4 ++-- src/vs/editor/common/config/defaultConfig.ts | 2 +- src/vs/editor/common/editorCommon.ts | 2 +- src/vs/editor/common/services/editorWorkerServiceImpl.ts | 2 +- src/vs/monaco.d.ts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index 0d881143588..54a1f0db9bc 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -793,9 +793,9 @@ const editorConfiguration: IConfigurationNode = { type: 'boolean', description: nls.localize('wordBasedSuggestions.comments', "Enable word based suggestions inside comments.") }, - default: { + other: { type: 'boolean', - description: nls.localize('wordBasedSuggestions.default', "Enable word based suggestions outside of strings and comments.") + description: nls.localize('wordBasedSuggestions.other', "Enable word based suggestions outside of strings and comments.") }, } } diff --git a/src/vs/editor/common/config/defaultConfig.ts b/src/vs/editor/common/config/defaultConfig.ts index e8faee7136e..117e415dc73 100644 --- a/src/vs/editor/common/config/defaultConfig.ts +++ b/src/vs/editor/common/config/defaultConfig.ts @@ -98,7 +98,7 @@ class ConfigClass implements IConfiguration { acceptSuggestionOnCommitCharacter: true, snippetSuggestions: 'bottom', emptySelectionClipboard: true, - wordBasedSuggestions: true, + wordBasedSuggestions: { other: true, strings: false, comments: false }, suggestFontSize: 0, suggestLineHeight: 0, selectionHighlight: true, diff --git a/src/vs/editor/common/editorCommon.ts b/src/vs/editor/common/editorCommon.ts index da83d7574fc..58ec81b4281 100644 --- a/src/vs/editor/common/editorCommon.ts +++ b/src/vs/editor/common/editorCommon.ts @@ -482,7 +482,7 @@ export interface IEditorOptions { /** * Enable word based suggestions. Defaults to 'true' */ - wordBasedSuggestions?: boolean | { strings?: boolean, comments?: boolean, default?: boolean }; + wordBasedSuggestions?: boolean | { strings?: boolean, comments?: boolean, other?: boolean }; /** * The font size for the suggest widget. * Defaults to the editor font size. diff --git a/src/vs/editor/common/services/editorWorkerServiceImpl.ts b/src/vs/editor/common/services/editorWorkerServiceImpl.ts index 08f740fbc40..332a6a58e23 100644 --- a/src/vs/editor/common/services/editorWorkerServiceImpl.ts +++ b/src/vs/editor/common/services/editorWorkerServiceImpl.ts @@ -105,7 +105,7 @@ class WordBasedCompletionItemProvider implements modes.ISuggestSupport { const { tokenType } = tokens.findTokenAtOffset(position.column - 1); const shoudSuggestHere = (tokenType === modes.StandardTokenType.Comment && wordBasedSuggestions.comments) || (tokenType === modes.StandardTokenType.String && wordBasedSuggestions.strings) - || (tokenType === modes.StandardTokenType.Other && wordBasedSuggestions.default); + || (tokenType === modes.StandardTokenType.Other && wordBasedSuggestions.other); if (shoudSuggestHere) { return this._workerManager.withWorker().then(client => client.textualSuggest(model.uri, position)); diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 772fa0233e2..9239b9e3d14 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -1400,7 +1400,7 @@ declare module monaco.editor { wordBasedSuggestions?: boolean | { strings?: boolean; comments?: boolean; - default?: boolean; + other?: boolean; }; /** * The font size for the suggest widget. -- GitLab