提交 fea0ee3d 编写于 作者: A Alex Dima

Fixes #57411: Rename `autoWrapping` to `autoSurround` to avoid confusions related to text wrapping

上级 1e164410
......@@ -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',
......
......@@ -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<EditorAutoClosingStrategy>(opts.autoClosingBrackets, defaults.autoClosingBrackets, ['always', 'languageDefined', 'beforeWhitespace', 'never']);
autoClosingQuotes = _stringSet<EditorAutoClosingStrategy>(opts.autoClosingQuotes, defaults.autoClosingQuotes, ['always', 'languageDefined', 'beforeWhitespace', 'never']);
autoWrapping = _stringSet<EditorAutoWrappingStrategy>(opts.autoWrapping, defaults.autoWrapping, ['always', 'brackets', 'quotes', 'never'], );
autoSurround = _stringSet<EditorAutoSurroundStrategy>(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,
......
......@@ -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 = {};
......
......@@ -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');
}
}
......
......@@ -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) => {
......
......@@ -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;
......
......@@ -117,7 +117,7 @@ const configurationValueWhitelist = [
'editor.parameterHints.cycle',
'editor.autoClosingBrackets',
'editor.autoClosingQuotes',
'editor.autoWrapping',
'editor.autoSurround',
'editor.autoIndent',
'editor.formatOnType',
'editor.formatOnPaste',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册