From 6f2f46ec25c134595c7cb8399219d9b59794a526 Mon Sep 17 00:00:00 2001 From: Michael Lively Date: Fri, 10 Nov 2023 13:17:10 -0800 Subject: [PATCH] Merge x-doc and occurrence setting, merge word based suggestion settings (#197690) * change x-doc setting for readability * Update editor configuration options for word-based suggestions and occurrence highlighting + settings migration * cleanup --- .../editor/browser/config/migrateOptions.ts | 2 + .../browser/services/editorWorkerService.ts | 9 +- .../config/editorConfigurationSchema.ts | 16 +- src/vs/editor/common/config/editorOptions.ts | 32 ++-- .../common/standalone/standaloneEnums.ts | 137 ++++++++-------- .../multicursor/browser/multicursor.ts | 3 +- .../browser/wordHighlighter.ts | 20 +-- .../browser/standaloneCodeEditor.ts | 2 +- src/vs/monaco.d.ts | 154 +++++++++--------- .../contrib/scm/browser/scmViewPane.ts | 4 +- 10 files changed, 183 insertions(+), 196 deletions(-) diff --git a/src/vs/editor/browser/config/migrateOptions.ts b/src/vs/editor/browser/config/migrateOptions.ts index 6c3d926ff36..b465fb5d107 100644 --- a/src/vs/editor/browser/config/migrateOptions.ts +++ b/src/vs/editor/browser/config/migrateOptions.ts @@ -91,6 +91,8 @@ registerSimpleEditorSettingMigration('autoIndent', [[false, 'advanced'], [true, registerSimpleEditorSettingMigration('matchBrackets', [[true, 'always'], [false, 'never']]); registerSimpleEditorSettingMigration('renderFinalNewline', [[true, 'on'], [false, 'off']]); registerSimpleEditorSettingMigration('cursorSmoothCaretAnimation', [[true, 'on'], [false, 'off']]); +registerSimpleEditorSettingMigration('occurrencesHighlight', [[true, 'singleFile'], [false, 'off']]); +registerSimpleEditorSettingMigration('wordBasedSuggestions', [[true, 'matchingDocuments'], [false, 'off']]); registerEditorSettingMigration('autoClosingBrackets', (value, read, write) => { if (value === false) { diff --git a/src/vs/editor/browser/services/editorWorkerService.ts b/src/vs/editor/browser/services/editorWorkerService.ts index b5cd2d9e3c1..f707c6fa25e 100644 --- a/src/vs/editor/browser/services/editorWorkerService.ts +++ b/src/vs/editor/browser/services/editorWorkerService.ts @@ -213,16 +213,15 @@ class WordBasedCompletionItemProvider implements languages.CompletionItemProvide async provideCompletionItems(model: ITextModel, position: Position): Promise { type WordBasedSuggestionsConfig = { - wordBasedSuggestions?: boolean; - wordBasedSuggestionsMode?: 'currentDocument' | 'matchingDocuments' | 'allDocuments'; + wordBasedSuggestions?: 'off' | 'currentDocument' | 'matchingDocuments' | 'allDocuments'; }; const config = this._configurationService.getValue(model.uri, position, 'editor'); - if (!config.wordBasedSuggestions) { + if (config.wordBasedSuggestions === 'off') { return undefined; } const models: URI[] = []; - if (config.wordBasedSuggestionsMode === 'currentDocument') { + if (config.wordBasedSuggestions === 'currentDocument') { // only current file and only if not too large if (canSyncModel(this._modelService, model.uri)) { models.push(model.uri); @@ -236,7 +235,7 @@ class WordBasedCompletionItemProvider implements languages.CompletionItemProvide if (candidate === model) { models.unshift(candidate.uri); - } else if (config.wordBasedSuggestionsMode === 'allDocuments' || candidate.getLanguageId() === model.getLanguageId()) { + } else if (config.wordBasedSuggestions === 'allDocuments' || candidate.getLanguageId() === model.getLanguageId()) { models.push(candidate.uri); } } diff --git a/src/vs/editor/common/config/editorConfigurationSchema.ts b/src/vs/editor/common/config/editorConfigurationSchema.ts index 5f18e0ce03f..3b22985f00d 100644 --- a/src/vs/editor/common/config/editorConfigurationSchema.ts +++ b/src/vs/editor/common/config/editorConfigurationSchema.ts @@ -62,19 +62,15 @@ const editorConfiguration: IConfigurationNode = { description: nls.localize('largeFileOptimizations', "Special handling for large files to disable certain memory intensive features.") }, 'editor.wordBasedSuggestions': { - type: 'boolean', - default: true, - description: nls.localize('wordBasedSuggestions', "Controls whether completions should be computed based on words in the document.") - }, - 'editor.wordBasedSuggestionsMode': { - enum: ['currentDocument', 'matchingDocuments', 'allDocuments'], + enum: ['off', 'currentDocument', 'matchingDocuments', 'allDocuments'], default: 'matchingDocuments', enumDescriptions: [ - nls.localize('wordBasedSuggestionsMode.currentDocument', 'Only suggest words from the active document.'), - nls.localize('wordBasedSuggestionsMode.matchingDocuments', 'Suggest words from all open documents of the same language.'), - nls.localize('wordBasedSuggestionsMode.allDocuments', 'Suggest words from all open documents.') + nls.localize('wordBasedSuggestions.off', 'Turn off Word Based Suggestions.'), + nls.localize('wordBasedSuggestions.currentDocument', 'Only suggest words from the active document.'), + nls.localize('wordBasedSuggestions.matchingDocuments', 'Suggest words from all open documents of the same language.'), + nls.localize('wordBasedSuggestions.allDocuments', 'Suggest words from all open documents.') ], - description: nls.localize('wordBasedSuggestionsMode', "Controls from which documents word based completions are computed.") + description: nls.localize('wordBasedSuggestions', "Controls whether completions should be computed based on words in the document and from which documents they are computed.") }, 'editor.semanticHighlighting.enabled': { enum: [true, false, 'configuredByTheme'], diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index b7f969da39c..0f8718e744c 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -559,14 +559,12 @@ export interface IEditorOptions { selectionHighlight?: boolean; /** * Enable semantic occurrences highlight. - * Defaults to true. + * Defaults to 'singleFile'. + * 'off' disables occurrence highlighting + * 'singleFile' triggers occurrence highlighting in the current document + * 'multiFile' triggers occurrence highlighting across valid open documents */ - occurrencesHighlight?: boolean; - /** - * Enable semantic occurrences highlight. - * Defaults to true. - */ - multiDocumentOccurrencesHighlight?: boolean; + occurrencesHighlight?: 'off' | 'singleFile' | 'multiFile'; /** * Show code lens * Defaults to true. @@ -5121,7 +5119,6 @@ export const enum EditorOption { multiCursorModifier, multiCursorPaste, multiCursorLimit, - multiDocumentOccurrencesHighlight, occurrencesHighlight, overviewRulerBorder, overviewRulerLanes, @@ -5618,13 +5615,18 @@ export const EditorOptions = { markdownDescription: nls.localize('multiCursorLimit', "Controls the max number of cursors that can be in an active editor at once.") } )), - occurrencesHighlight: register(new EditorBooleanOption( - EditorOption.occurrencesHighlight, 'occurrencesHighlight', true, - { description: nls.localize('occurrencesHighlight', "Controls whether the editor should highlight semantic symbol occurrences.") } - )), - multiDocumentOccurrencesHighlight: register(new EditorBooleanOption( - EditorOption.multiDocumentOccurrencesHighlight, 'multiDocumentOccurrencesHighlight', false, - { description: nls.localize('multiDocumentOccurrencesHighlight', "Experimental: Controls whether the editor should highlight word occurrences accross multiple open editors.") } + occurrencesHighlight: register(new EditorStringEnumOption( + EditorOption.occurrencesHighlight, 'occurrencesHighlight', + 'singleFile' as 'off' | 'singleFile' | 'multiFile', + ['off', 'singleFile', 'multiFile'] as const, + { + markdownEnumDescriptions: [ + nls.localize('occurrencesHighlight.off', "Does not highlight occurrences."), + nls.localize('occurrencesHighlight.singleFile', "Highlights occurrences only in the current file."), + nls.localize('occurrencesHighlight.multiFile', "Experimental: Highlights occurrences across all valid open files.") + ], + markdownDescription: nls.localize('occurrencesHighlight', "Controls whether occurrences should be highlighted across open files.") + } )), overviewRulerBorder: register(new EditorBooleanOption( EditorOption.overviewRulerBorder, 'overviewRulerBorder', true, diff --git a/src/vs/editor/common/standalone/standaloneEnums.ts b/src/vs/editor/common/standalone/standaloneEnums.ts index 42376eef823..44f9fb9b434 100644 --- a/src/vs/editor/common/standalone/standaloneEnums.ts +++ b/src/vs/editor/common/standalone/standaloneEnums.ts @@ -253,75 +253,74 @@ export enum EditorOption { multiCursorModifier = 77, multiCursorPaste = 78, multiCursorLimit = 79, - multiDocumentOccurrencesHighlight = 80, - occurrencesHighlight = 81, - overviewRulerBorder = 82, - overviewRulerLanes = 83, - padding = 84, - pasteAs = 85, - parameterHints = 86, - peekWidgetDefaultFocus = 87, - definitionLinkOpensInPeek = 88, - quickSuggestions = 89, - quickSuggestionsDelay = 90, - readOnly = 91, - readOnlyMessage = 92, - renameOnType = 93, - renderControlCharacters = 94, - renderFinalNewline = 95, - renderLineHighlight = 96, - renderLineHighlightOnlyWhenFocus = 97, - renderValidationDecorations = 98, - renderWhitespace = 99, - revealHorizontalRightPadding = 100, - roundedSelection = 101, - rulers = 102, - scrollbar = 103, - scrollBeyondLastColumn = 104, - scrollBeyondLastLine = 105, - scrollPredominantAxis = 106, - selectionClipboard = 107, - selectionHighlight = 108, - selectOnLineNumbers = 109, - showFoldingControls = 110, - showUnused = 111, - snippetSuggestions = 112, - smartSelect = 113, - smoothScrolling = 114, - stickyScroll = 115, - stickyTabStops = 116, - stopRenderingLineAfter = 117, - suggest = 118, - suggestFontSize = 119, - suggestLineHeight = 120, - suggestOnTriggerCharacters = 121, - suggestSelection = 122, - tabCompletion = 123, - tabIndex = 124, - unicodeHighlighting = 125, - unusualLineTerminators = 126, - useShadowDOM = 127, - useTabStops = 128, - wordBreak = 129, - wordSeparators = 130, - wordWrap = 131, - wordWrapBreakAfterCharacters = 132, - wordWrapBreakBeforeCharacters = 133, - wordWrapColumn = 134, - wordWrapOverride1 = 135, - wordWrapOverride2 = 136, - wrappingIndent = 137, - wrappingStrategy = 138, - showDeprecated = 139, - inlayHints = 140, - editorClassName = 141, - pixelRatio = 142, - tabFocusMode = 143, - layoutInfo = 144, - wrappingInfo = 145, - defaultColorDecorators = 146, - colorDecoratorsActivatedOn = 147, - inlineCompletionsAccessibilityVerbose = 148 + occurrencesHighlight = 80, + overviewRulerBorder = 81, + overviewRulerLanes = 82, + padding = 83, + pasteAs = 84, + parameterHints = 85, + peekWidgetDefaultFocus = 86, + definitionLinkOpensInPeek = 87, + quickSuggestions = 88, + quickSuggestionsDelay = 89, + readOnly = 90, + readOnlyMessage = 91, + renameOnType = 92, + renderControlCharacters = 93, + renderFinalNewline = 94, + renderLineHighlight = 95, + renderLineHighlightOnlyWhenFocus = 96, + renderValidationDecorations = 97, + renderWhitespace = 98, + revealHorizontalRightPadding = 99, + roundedSelection = 100, + rulers = 101, + scrollbar = 102, + scrollBeyondLastColumn = 103, + scrollBeyondLastLine = 104, + scrollPredominantAxis = 105, + selectionClipboard = 106, + selectionHighlight = 107, + selectOnLineNumbers = 108, + showFoldingControls = 109, + showUnused = 110, + snippetSuggestions = 111, + smartSelect = 112, + smoothScrolling = 113, + stickyScroll = 114, + stickyTabStops = 115, + stopRenderingLineAfter = 116, + suggest = 117, + suggestFontSize = 118, + suggestLineHeight = 119, + suggestOnTriggerCharacters = 120, + suggestSelection = 121, + tabCompletion = 122, + tabIndex = 123, + unicodeHighlighting = 124, + unusualLineTerminators = 125, + useShadowDOM = 126, + useTabStops = 127, + wordBreak = 128, + wordSeparators = 129, + wordWrap = 130, + wordWrapBreakAfterCharacters = 131, + wordWrapBreakBeforeCharacters = 132, + wordWrapColumn = 133, + wordWrapOverride1 = 134, + wordWrapOverride2 = 135, + wrappingIndent = 136, + wrappingStrategy = 137, + showDeprecated = 138, + inlayHints = 139, + editorClassName = 140, + pixelRatio = 141, + tabFocusMode = 142, + layoutInfo = 143, + wrappingInfo = 144, + defaultColorDecorators = 145, + colorDecoratorsActivatedOn = 146, + inlineCompletionsAccessibilityVerbose = 147 } /** diff --git a/src/vs/editor/contrib/multicursor/browser/multicursor.ts b/src/vs/editor/contrib/multicursor/browser/multicursor.ts index d99511cbe34..02e7a44e7f5 100644 --- a/src/vs/editor/contrib/multicursor/browser/multicursor.ts +++ b/src/vs/editor/contrib/multicursor/browser/multicursor.ts @@ -1037,7 +1037,8 @@ export class SelectionHighlighter extends Disposable implements IEditorContribut } } - const hasSemanticHighlights = this._languageFeaturesService.documentHighlightProvider.has(model) && this.editor.getOption(EditorOption.occurrencesHighlight); + const occurrenceHighlighting: boolean = this.editor.getOption(EditorOption.occurrencesHighlight) !== 'off'; + const hasSemanticHighlights = this._languageFeaturesService.documentHighlightProvider.has(model) && occurrenceHighlighting; const decorations = matches.map(r => { return { range: r, diff --git a/src/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.ts b/src/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.ts index 75cf64a446b..6bfb4c0e186 100644 --- a/src/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.ts +++ b/src/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.ts @@ -256,8 +256,7 @@ class WordHighlighter { private readonly editor: IActiveCodeEditor; private readonly providers: LanguageFeatureRegistry; private readonly multiDocumentProviders: LanguageFeatureRegistry; - private occurrencesHighlight: boolean; - private multiDocumentOccurrencesHighlight: boolean; + private occurrencesHighlight: string; private readonly model: ITextModel; private readonly decorations: IEditorDecorationsCollection; private readonly toUnhook = new DisposableStore(); @@ -285,7 +284,6 @@ class WordHighlighter { this._hasWordHighlights = ctxHasWordHighlights.bindTo(contextKeyService); this._ignorePositionChangeEvent = false; this.occurrencesHighlight = this.editor.getOption(EditorOption.occurrencesHighlight); - this.multiDocumentOccurrencesHighlight = this.editor.getOption(EditorOption.multiDocumentOccurrencesHighlight); this.model = this.editor.getModel(); this.toUnhook.add(editor.onDidChangeCursorPosition((e: ICursorPositionChangedEvent) => { if (this._ignorePositionChangeEvent) { @@ -293,7 +291,7 @@ class WordHighlighter { return; } - if (!this.occurrencesHighlight) { + if (this.occurrencesHighlight === 'off') { // Early exit if nothing needs to be done! // Leave some form of early exit check here if you wish to continue being a cursor position change listener ;) return; @@ -319,12 +317,6 @@ class WordHighlighter { this.occurrencesHighlight = newValue; this._stopAll(); } - - const newMultiDocumentValue = this.editor.getOption(EditorOption.multiDocumentOccurrencesHighlight); - if (this.multiDocumentOccurrencesHighlight !== newMultiDocumentValue) { - this.multiDocumentOccurrencesHighlight = newMultiDocumentValue; - this._stopAll(); - } })); this.decorations = this.editor.createDecorationsCollection(); @@ -346,14 +338,14 @@ class WordHighlighter { } public restore(): void { - if (!this.occurrencesHighlight) { + if (this.occurrencesHighlight === 'off') { return; } this._run(); } public stop(): void { - if (!this.occurrencesHighlight) { + if (this.occurrencesHighlight === 'off') { return; } @@ -513,7 +505,7 @@ class WordHighlighter { private _onPositionChanged(e: ICursorPositionChangedEvent): void { // disabled - if (!this.occurrencesHighlight) { + if (this.occurrencesHighlight === 'off') { this._stopAll(); return; } @@ -586,7 +578,7 @@ class WordHighlighter { } // multi-doc OFF - if (!this.multiDocumentOccurrencesHighlight) { + if (this.occurrencesHighlight === 'singleFile') { return []; } diff --git a/src/vs/editor/standalone/browser/standaloneCodeEditor.ts b/src/vs/editor/standalone/browser/standaloneCodeEditor.ts index 7ad3d3c44d4..60c16599bf3 100644 --- a/src/vs/editor/standalone/browser/standaloneCodeEditor.ts +++ b/src/vs/editor/standalone/browser/standaloneCodeEditor.ts @@ -120,7 +120,7 @@ export interface IGlobalEditorOptions { * Controls whether completions should be computed based on words in the document. * Defaults to true. */ - wordBasedSuggestions?: boolean; + wordBasedSuggestions?: 'off' | 'currentDocument' | 'matchingDocuments' | 'allDocuments'; /** * Controls whether word based completions should be included from opened documents of the same language or any language. */ diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 3ebb426a173..c90387e62b4 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -1317,7 +1317,7 @@ declare namespace monaco.editor { * Controls whether completions should be computed based on words in the document. * Defaults to true. */ - wordBasedSuggestions?: boolean; + wordBasedSuggestions?: 'off' | 'currentDocument' | 'matchingDocuments' | 'allDocuments'; /** * Controls whether word based completions should be included from opened documents of the same language or any language. */ @@ -3538,14 +3538,12 @@ declare namespace monaco.editor { selectionHighlight?: boolean; /** * Enable semantic occurrences highlight. - * Defaults to true. + * Defaults to 'singleFile'. + * 'off' disables occurrence highlighting + * 'singleFile' triggers occurrence highlighting in the current document + * 'multiFile' triggers occurrence highlighting across valid open documents */ - occurrencesHighlight?: boolean; - /** - * Enable semantic occurrences highlight. - * Defaults to true. - */ - multiDocumentOccurrencesHighlight?: boolean; + occurrencesHighlight?: 'off' | 'singleFile' | 'multiFile'; /** * Show code lens * Defaults to true. @@ -4801,75 +4799,74 @@ declare namespace monaco.editor { multiCursorModifier = 77, multiCursorPaste = 78, multiCursorLimit = 79, - multiDocumentOccurrencesHighlight = 80, - occurrencesHighlight = 81, - overviewRulerBorder = 82, - overviewRulerLanes = 83, - padding = 84, - pasteAs = 85, - parameterHints = 86, - peekWidgetDefaultFocus = 87, - definitionLinkOpensInPeek = 88, - quickSuggestions = 89, - quickSuggestionsDelay = 90, - readOnly = 91, - readOnlyMessage = 92, - renameOnType = 93, - renderControlCharacters = 94, - renderFinalNewline = 95, - renderLineHighlight = 96, - renderLineHighlightOnlyWhenFocus = 97, - renderValidationDecorations = 98, - renderWhitespace = 99, - revealHorizontalRightPadding = 100, - roundedSelection = 101, - rulers = 102, - scrollbar = 103, - scrollBeyondLastColumn = 104, - scrollBeyondLastLine = 105, - scrollPredominantAxis = 106, - selectionClipboard = 107, - selectionHighlight = 108, - selectOnLineNumbers = 109, - showFoldingControls = 110, - showUnused = 111, - snippetSuggestions = 112, - smartSelect = 113, - smoothScrolling = 114, - stickyScroll = 115, - stickyTabStops = 116, - stopRenderingLineAfter = 117, - suggest = 118, - suggestFontSize = 119, - suggestLineHeight = 120, - suggestOnTriggerCharacters = 121, - suggestSelection = 122, - tabCompletion = 123, - tabIndex = 124, - unicodeHighlighting = 125, - unusualLineTerminators = 126, - useShadowDOM = 127, - useTabStops = 128, - wordBreak = 129, - wordSeparators = 130, - wordWrap = 131, - wordWrapBreakAfterCharacters = 132, - wordWrapBreakBeforeCharacters = 133, - wordWrapColumn = 134, - wordWrapOverride1 = 135, - wordWrapOverride2 = 136, - wrappingIndent = 137, - wrappingStrategy = 138, - showDeprecated = 139, - inlayHints = 140, - editorClassName = 141, - pixelRatio = 142, - tabFocusMode = 143, - layoutInfo = 144, - wrappingInfo = 145, - defaultColorDecorators = 146, - colorDecoratorsActivatedOn = 147, - inlineCompletionsAccessibilityVerbose = 148 + occurrencesHighlight = 80, + overviewRulerBorder = 81, + overviewRulerLanes = 82, + padding = 83, + pasteAs = 84, + parameterHints = 85, + peekWidgetDefaultFocus = 86, + definitionLinkOpensInPeek = 87, + quickSuggestions = 88, + quickSuggestionsDelay = 89, + readOnly = 90, + readOnlyMessage = 91, + renameOnType = 92, + renderControlCharacters = 93, + renderFinalNewline = 94, + renderLineHighlight = 95, + renderLineHighlightOnlyWhenFocus = 96, + renderValidationDecorations = 97, + renderWhitespace = 98, + revealHorizontalRightPadding = 99, + roundedSelection = 100, + rulers = 101, + scrollbar = 102, + scrollBeyondLastColumn = 103, + scrollBeyondLastLine = 104, + scrollPredominantAxis = 105, + selectionClipboard = 106, + selectionHighlight = 107, + selectOnLineNumbers = 108, + showFoldingControls = 109, + showUnused = 110, + snippetSuggestions = 111, + smartSelect = 112, + smoothScrolling = 113, + stickyScroll = 114, + stickyTabStops = 115, + stopRenderingLineAfter = 116, + suggest = 117, + suggestFontSize = 118, + suggestLineHeight = 119, + suggestOnTriggerCharacters = 120, + suggestSelection = 121, + tabCompletion = 122, + tabIndex = 123, + unicodeHighlighting = 124, + unusualLineTerminators = 125, + useShadowDOM = 126, + useTabStops = 127, + wordBreak = 128, + wordSeparators = 129, + wordWrap = 130, + wordWrapBreakAfterCharacters = 131, + wordWrapBreakBeforeCharacters = 132, + wordWrapColumn = 133, + wordWrapOverride1 = 134, + wordWrapOverride2 = 135, + wrappingIndent = 136, + wrappingStrategy = 137, + showDeprecated = 138, + inlayHints = 139, + editorClassName = 140, + pixelRatio = 141, + tabFocusMode = 142, + layoutInfo = 143, + wrappingInfo = 144, + defaultColorDecorators = 145, + colorDecoratorsActivatedOn = 146, + inlineCompletionsAccessibilityVerbose = 147 } export const EditorOptions: { @@ -4955,8 +4952,7 @@ declare namespace monaco.editor { multiCursorModifier: IEditorOption; multiCursorPaste: IEditorOption; multiCursorLimit: IEditorOption; - occurrencesHighlight: IEditorOption; - multiDocumentOccurrencesHighlight: IEditorOption; + occurrencesHighlight: IEditorOption; overviewRulerBorder: IEditorOption; overviewRulerLanes: IEditorOption; padding: IEditorOption>>; diff --git a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts index 75b99c986a6..21214286731 100644 --- a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts +++ b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts @@ -1759,8 +1759,8 @@ class SCMInputWidget { } const uri = input.repository.provider.inputBoxDocumentUri; - if (this.configurationService.getValue('editor.wordBasedSuggestions', { resource: uri }) !== false) { - this.configurationService.updateValue('editor.wordBasedSuggestions', false, { resource: uri }, ConfigurationTarget.MEMORY); + if (this.configurationService.getValue('editor.wordBasedSuggestions', { resource: uri }) !== 'off') { + this.configurationService.updateValue('editor.wordBasedSuggestions', 'off', { resource: uri }, ConfigurationTarget.MEMORY); } const modelValue: typeof this.model = { input, textModelRef: undefined };