From fea0ee3d0237b930f93830ac682e96ae16ecafd8 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Wed, 29 Aug 2018 16:46:45 +0200 Subject: [PATCH] Fixes #57411: Rename `autoWrapping` to `autoSurround` to avoid confusions related to text wrapping --- .../common/config/commonEditorConfig.ts | 10 +++--- src/vs/editor/common/config/editorOptions.ts | 36 +++++++++---------- .../editor/common/controller/cursorCommon.ts | 8 ++--- .../common/controller/cursorTypeOperations.ts | 4 +-- .../test/browser/controller/cursor.test.ts | 6 ++-- src/vs/monaco.d.ts | 12 +++---- .../telemetry/common/telemetryUtils.ts | 2 +- 7 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index 8756cbfe4e0..3b21bd90fbb 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -524,17 +524,17 @@ const editorConfiguration: IConfigurationNode = { 'default': EDITOR_DEFAULTS.autoClosingQuotes, 'description': nls.localize('autoClosingQuotes', "Controls whether the editor should automatically close quotes after the user adds an opening quote.") }, - 'editor.autoWrapping': { + 'editor.autoSurround': { type: 'string', enum: ['always', 'brackets', 'quotes', 'never'], enumDescriptions: [ '', - nls.localize('editor.autoWrapping.brackets', "Wrap with brackets but not quotes."), - nls.localize('editor.autoWrapping.quotes', "Wrap with quotes but not brackets."), + nls.localize('editor.autoSurround.brackets', "Surround with brackets but not quotes."), + nls.localize('editor.autoSurround.quotes', "Surround with quotes but not brackets."), '' ], - 'default': EDITOR_DEFAULTS.autoWrapping, - 'description': nls.localize('autoWrapping', "Controls whether the editor should automatically wrap selections.") + 'default': EDITOR_DEFAULTS.autoSurround, + 'description': nls.localize('autoSurround', "Controls whether the editor should automatically surround selections.") }, 'editor.formatOnType': { 'type': 'boolean', diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index 563ee25d957..ddfdab92a53 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -103,7 +103,7 @@ export type EditorAutoClosingStrategy = 'always' | 'languageDefined' | 'beforeWh /** * Configuration options for auto wrapping quotes and brackets */ -export type EditorAutoWrappingStrategy = 'always' | 'quotes' | 'brackets' | 'never'; +export type EditorAutoSurroundStrategy = 'always' | 'quotes' | 'brackets' | 'never'; /** * Configuration options for editor minimap @@ -496,10 +496,10 @@ export interface IEditorOptions { */ autoClosingQuotes?: EditorAutoClosingStrategy; /** - * Options for autowrapping. - * Defaults to always allowing autowrapping. + * Options for auto surrounding. + * Defaults to always allowing auto surrounding. */ - autoWrapping?: EditorAutoWrappingStrategy; + autoSurround?: EditorAutoSurroundStrategy; /** * Enable auto indentation adjustment. * Defaults to false. @@ -1002,7 +1002,7 @@ export interface IValidatedEditorOptions { readonly wordWrapBreakObtrusiveCharacters: string; readonly autoClosingBrackets: EditorAutoClosingStrategy; readonly autoClosingQuotes: EditorAutoClosingStrategy; - readonly autoWrapping: EditorAutoWrappingStrategy; + readonly autoSurround: EditorAutoSurroundStrategy; readonly autoIndent: boolean; readonly dragAndDrop: boolean; readonly emptySelectionClipboard: boolean; @@ -1039,7 +1039,7 @@ export class InternalEditorOptions { readonly wordSeparators: string; readonly autoClosingBrackets: EditorAutoClosingStrategy; readonly autoClosingQuotes: EditorAutoClosingStrategy; - readonly autoWrapping: EditorAutoWrappingStrategy; + readonly autoSurround: EditorAutoSurroundStrategy; readonly autoIndent: boolean; readonly useTabStops: boolean; readonly tabFocusMode: boolean; @@ -1068,7 +1068,7 @@ export class InternalEditorOptions { wordSeparators: string; autoClosingBrackets: EditorAutoClosingStrategy; autoClosingQuotes: EditorAutoClosingStrategy; - autoWrapping: EditorAutoWrappingStrategy; + autoSurround: EditorAutoSurroundStrategy; autoIndent: boolean; useTabStops: boolean; tabFocusMode: boolean; @@ -1092,7 +1092,7 @@ export class InternalEditorOptions { this.wordSeparators = source.wordSeparators; this.autoClosingBrackets = source.autoClosingBrackets; this.autoClosingQuotes = source.autoClosingQuotes; - this.autoWrapping = source.autoWrapping; + this.autoSurround = source.autoSurround; this.autoIndent = source.autoIndent; this.useTabStops = source.useTabStops; this.tabFocusMode = source.tabFocusMode; @@ -1122,7 +1122,7 @@ export class InternalEditorOptions { && this.wordSeparators === other.wordSeparators && this.autoClosingBrackets === other.autoClosingBrackets && this.autoClosingQuotes === other.autoClosingQuotes - && this.autoWrapping === other.autoWrapping + && this.autoSurround === other.autoSurround && this.autoIndent === other.autoIndent && this.useTabStops === other.useTabStops && this.tabFocusMode === other.tabFocusMode @@ -1153,7 +1153,7 @@ export class InternalEditorOptions { wordSeparators: (this.wordSeparators !== newOpts.wordSeparators), autoClosingBrackets: (this.autoClosingBrackets !== newOpts.autoClosingBrackets), autoClosingQuotes: (this.autoClosingQuotes !== newOpts.autoClosingQuotes), - autoWrapping: (this.autoWrapping !== newOpts.autoWrapping), + autoSurround: (this.autoSurround !== newOpts.autoSurround), autoIndent: (this.autoIndent !== newOpts.autoIndent), useTabStops: (this.useTabStops !== newOpts.useTabStops), tabFocusMode: (this.tabFocusMode !== newOpts.tabFocusMode), @@ -1536,7 +1536,7 @@ export interface IConfigurationChangedEvent { readonly wordSeparators: boolean; readonly autoClosingBrackets: boolean; readonly autoClosingQuotes: boolean; - readonly autoWrapping: boolean; + readonly autoSurround: boolean; readonly autoIndent: boolean; readonly useTabStops: boolean; readonly tabFocusMode: boolean; @@ -1717,16 +1717,16 @@ export class EditorOptionsValidator { let autoClosingBrackets: EditorAutoClosingStrategy; let autoClosingQuotes: EditorAutoClosingStrategy; - let autoWrapping: EditorAutoWrappingStrategy; + let autoSurround: EditorAutoSurroundStrategy; if (typeof opts.autoClosingBrackets === 'boolean' && opts.autoClosingBrackets === false) { // backwards compatibility: disable all on boolean false autoClosingBrackets = 'never'; autoClosingQuotes = 'never'; - autoWrapping = 'never'; + autoSurround = 'never'; } else { autoClosingBrackets = _stringSet(opts.autoClosingBrackets, defaults.autoClosingBrackets, ['always', 'languageDefined', 'beforeWhitespace', 'never']); autoClosingQuotes = _stringSet(opts.autoClosingQuotes, defaults.autoClosingQuotes, ['always', 'languageDefined', 'beforeWhitespace', 'never']); - autoWrapping = _stringSet(opts.autoWrapping, defaults.autoWrapping, ['always', 'brackets', 'quotes', 'never'], ); + autoSurround = _stringSet(opts.autoSurround, defaults.autoSurround, ['always', 'brackets', 'quotes', 'never'], ); } return { @@ -1747,7 +1747,7 @@ export class EditorOptionsValidator { wordWrapBreakObtrusiveCharacters: _string(opts.wordWrapBreakObtrusiveCharacters, defaults.wordWrapBreakObtrusiveCharacters), autoClosingBrackets, autoClosingQuotes, - autoWrapping, + autoSurround, autoIndent: _boolean(opts.autoIndent, defaults.autoIndent), dragAndDrop: _boolean(opts.dragAndDrop, defaults.dragAndDrop), emptySelectionClipboard: _boolean(opts.emptySelectionClipboard, defaults.emptySelectionClipboard), @@ -2030,7 +2030,7 @@ export class InternalEditorOptionsFactory { wordWrapBreakObtrusiveCharacters: opts.wordWrapBreakObtrusiveCharacters, autoClosingBrackets: opts.autoClosingBrackets, autoClosingQuotes: opts.autoClosingQuotes, - autoWrapping: opts.autoWrapping, + autoSurround: opts.autoSurround, autoIndent: opts.autoIndent, dragAndDrop: opts.dragAndDrop, emptySelectionClipboard: opts.emptySelectionClipboard, @@ -2253,7 +2253,7 @@ export class InternalEditorOptionsFactory { wordSeparators: opts.wordSeparators, autoClosingBrackets: opts.autoClosingBrackets, autoClosingQuotes: opts.autoClosingQuotes, - autoWrapping: opts.autoWrapping, + autoSurround: opts.autoSurround, autoIndent: opts.autoIndent, useTabStops: opts.useTabStops, tabFocusMode: opts.readOnly ? true : env.tabFocusMode, @@ -2488,7 +2488,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = { wordWrapBreakObtrusiveCharacters: '.', autoClosingBrackets: 'languageDefined', autoClosingQuotes: 'languageDefined', - autoWrapping: 'always', + autoSurround: 'always', autoIndent: true, dragAndDrop: true, emptySelectionClipboard: true, diff --git a/src/vs/editor/common/controller/cursorCommon.ts b/src/vs/editor/common/controller/cursorCommon.ts index cba876a0772..f777806ee39 100644 --- a/src/vs/editor/common/controller/cursorCommon.ts +++ b/src/vs/editor/common/controller/cursorCommon.ts @@ -15,7 +15,7 @@ import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageCo import { onUnexpectedError } from 'vs/base/common/errors'; import { LanguageIdentifier } from 'vs/editor/common/modes'; import { IAutoClosingPair } from 'vs/editor/common/modes/languageConfiguration'; -import { IConfigurationChangedEvent, EditorAutoClosingStrategy, EditorAutoWrappingStrategy } from 'vs/editor/common/config/editorOptions'; +import { IConfigurationChangedEvent, EditorAutoClosingStrategy, EditorAutoSurroundStrategy } from 'vs/editor/common/config/editorOptions'; import { IViewModel } from 'vs/editor/common/viewModel/viewModel'; import { CursorChangeReason } from 'vs/editor/common/controller/cursorEvents'; import { VerticalRevealType } from 'vs/editor/common/view/viewEvents'; @@ -85,7 +85,7 @@ export class CursorConfiguration { public readonly multiCursorMergeOverlapping: boolean; public readonly autoClosingBrackets: EditorAutoClosingStrategy; public readonly autoClosingQuotes: EditorAutoClosingStrategy; - public readonly autoWrapping: EditorAutoWrappingStrategy; + public readonly autoSurround: EditorAutoSurroundStrategy; public readonly autoIndent: boolean; public readonly autoClosingPairsOpen: CharacterMap; public readonly autoClosingPairsClose: CharacterMap; @@ -103,7 +103,7 @@ export class CursorConfiguration { || e.multiCursorMergeOverlapping || e.autoClosingBrackets || e.autoClosingQuotes - || e.autoWrapping + || e.autoSurround || e.useTabStops || e.lineHeight || e.readOnly @@ -132,7 +132,7 @@ export class CursorConfiguration { this.multiCursorMergeOverlapping = c.multiCursorMergeOverlapping; this.autoClosingBrackets = c.autoClosingBrackets; this.autoClosingQuotes = c.autoClosingQuotes; - this.autoWrapping = c.autoWrapping; + this.autoSurround = c.autoSurround; this.autoIndent = c.autoIndent; this.autoClosingPairsOpen = {}; diff --git a/src/vs/editor/common/controller/cursorTypeOperations.ts b/src/vs/editor/common/controller/cursorTypeOperations.ts index ac7158f32df..48dda503ba1 100644 --- a/src/vs/editor/common/controller/cursorTypeOperations.ts +++ b/src/vs/editor/common/controller/cursorTypeOperations.ts @@ -589,10 +589,10 @@ export class TypeOperations { private static _shouldSurroundChar(config: CursorConfiguration, ch: string): boolean { if (isQuote(ch)) { - return (config.autoWrapping === 'quotes' || config.autoWrapping === 'always'); + return (config.autoSurround === 'quotes' || config.autoSurround === 'always'); } else { // Character is a bracket - return (config.autoWrapping === 'brackets' || config.autoWrapping === 'always'); + return (config.autoSurround === 'brackets' || config.autoSurround === 'always'); } } diff --git a/src/vs/editor/test/browser/controller/cursor.test.ts b/src/vs/editor/test/browser/controller/cursor.test.ts index 85f20c7dd29..30e26feb954 100644 --- a/src/vs/editor/test/browser/controller/cursor.test.ts +++ b/src/vs/editor/test/browser/controller/cursor.test.ts @@ -4277,7 +4277,7 @@ suite('autoClosingPairs', () => { ], languageIdentifier: mode.getLanguageIdentifier(), editorOpts: { - autoWrapping: 'never' + autoSurround: 'never' } }, (model, cursor) => { @@ -4297,7 +4297,7 @@ suite('autoClosingPairs', () => { ], languageIdentifier: mode.getLanguageIdentifier(), editorOpts: { - autoWrapping: 'quotes' + autoSurround: 'quotes' } }, (model, cursor) => { @@ -4320,7 +4320,7 @@ suite('autoClosingPairs', () => { ], languageIdentifier: mode.getLanguageIdentifier(), editorOpts: { - autoWrapping: 'brackets' + autoSurround: 'brackets' } }, (model, cursor) => { diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index ae5eaba610d..31c3f8a4b88 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -2485,7 +2485,7 @@ declare namespace monaco.editor { /** * Configuration options for auto wrapping quotes and brackets */ - export type EditorAutoWrappingStrategy = 'always' | 'quotes' | 'brackets' | 'never'; + export type EditorAutoSurroundStrategy = 'always' | 'quotes' | 'brackets' | 'never'; /** * Configuration options for editor minimap @@ -2870,10 +2870,10 @@ declare namespace monaco.editor { */ autoClosingQuotes?: EditorAutoClosingStrategy; /** - * Options for autowrapping. - * Defaults to always allowing autowrapping. + * Options for auto surrounding. + * Defaults to always allowing auto surrounding. */ - autoWrapping?: EditorAutoWrappingStrategy; + autoSurround?: EditorAutoSurroundStrategy; /** * Enable auto indentation adjustment. * Defaults to false. @@ -3309,7 +3309,7 @@ declare namespace monaco.editor { readonly wordSeparators: string; readonly autoClosingBrackets: EditorAutoClosingStrategy; readonly autoClosingQuotes: EditorAutoClosingStrategy; - readonly autoWrapping: EditorAutoWrappingStrategy; + readonly autoSurround: EditorAutoSurroundStrategy; readonly autoIndent: boolean; readonly useTabStops: boolean; readonly tabFocusMode: boolean; @@ -3449,7 +3449,7 @@ declare namespace monaco.editor { readonly wordSeparators: boolean; readonly autoClosingBrackets: boolean; readonly autoClosingQuotes: boolean; - readonly autoWrapping: boolean; + readonly autoSurround: boolean; readonly autoIndent: boolean; readonly useTabStops: boolean; readonly tabFocusMode: boolean; diff --git a/src/vs/platform/telemetry/common/telemetryUtils.ts b/src/vs/platform/telemetry/common/telemetryUtils.ts index 0bc5f903798..1a0460f4656 100644 --- a/src/vs/platform/telemetry/common/telemetryUtils.ts +++ b/src/vs/platform/telemetry/common/telemetryUtils.ts @@ -117,7 +117,7 @@ const configurationValueWhitelist = [ 'editor.parameterHints.cycle', 'editor.autoClosingBrackets', 'editor.autoClosingQuotes', - 'editor.autoWrapping', + 'editor.autoSurround', 'editor.autoIndent', 'editor.formatOnType', 'editor.formatOnPaste', -- GitLab