Merge from vscode 91e99652cd5fcfc072387c64e151b435e39e8dcf (#6962)

This commit is contained in:
Anthony Dresser
2019-08-26 15:58:42 -07:00
committed by GitHub
parent edf470c8fa
commit 507bae90b7
103 changed files with 1743 additions and 1543 deletions

View File

@@ -108,6 +108,11 @@ export type EditorAutoClosingStrategy = 'always' | 'languageDefined' | 'beforeWh
*/
export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'brackets' | 'never';
/**
* Configuration options for typing over closing quotes or brackets
*/
export type EditorAutoClosingOvertypeStrategy = 'always' | 'auto' | 'never';
/**
* Configuration options for editor minimap
*/
@@ -544,6 +549,10 @@ export interface IEditorOptions {
* Defaults to language defined behavior.
*/
autoClosingQuotes?: EditorAutoClosingStrategy;
/**
* Options for typing over closing quotes or brackets.
*/
autoClosingOvertype?: EditorAutoClosingOvertypeStrategy;
/**
* Options for auto surrounding.
* Defaults to always allowing auto surrounding.
@@ -1079,6 +1088,7 @@ export interface IValidatedEditorOptions {
readonly wordWrapBreakObtrusiveCharacters: string;
readonly autoClosingBrackets: EditorAutoClosingStrategy;
readonly autoClosingQuotes: EditorAutoClosingStrategy;
readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy;
readonly autoSurround: EditorAutoSurroundStrategy;
readonly autoIndent: boolean;
readonly dragAndDrop: boolean;
@@ -1117,6 +1127,7 @@ export class InternalEditorOptions {
readonly wordSeparators: string;
readonly autoClosingBrackets: EditorAutoClosingStrategy;
readonly autoClosingQuotes: EditorAutoClosingStrategy;
readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy;
readonly autoSurround: EditorAutoSurroundStrategy;
readonly autoIndent: boolean;
readonly useTabStops: boolean;
@@ -1147,6 +1158,7 @@ export class InternalEditorOptions {
wordSeparators: string;
autoClosingBrackets: EditorAutoClosingStrategy;
autoClosingQuotes: EditorAutoClosingStrategy;
autoClosingOvertype: EditorAutoClosingOvertypeStrategy;
autoSurround: EditorAutoSurroundStrategy;
autoIndent: boolean;
useTabStops: boolean;
@@ -1172,6 +1184,7 @@ export class InternalEditorOptions {
this.wordSeparators = source.wordSeparators;
this.autoClosingBrackets = source.autoClosingBrackets;
this.autoClosingQuotes = source.autoClosingQuotes;
this.autoClosingOvertype = source.autoClosingOvertype;
this.autoSurround = source.autoSurround;
this.autoIndent = source.autoIndent;
this.useTabStops = source.useTabStops;
@@ -1203,6 +1216,7 @@ export class InternalEditorOptions {
&& this.wordSeparators === other.wordSeparators
&& this.autoClosingBrackets === other.autoClosingBrackets
&& this.autoClosingQuotes === other.autoClosingQuotes
&& this.autoClosingOvertype === other.autoClosingOvertype
&& this.autoSurround === other.autoSurround
&& this.autoIndent === other.autoIndent
&& this.useTabStops === other.useTabStops
@@ -1235,6 +1249,7 @@ export class InternalEditorOptions {
wordSeparators: (this.wordSeparators !== newOpts.wordSeparators),
autoClosingBrackets: (this.autoClosingBrackets !== newOpts.autoClosingBrackets),
autoClosingQuotes: (this.autoClosingQuotes !== newOpts.autoClosingQuotes),
autoClosingOvertype: (this.autoClosingOvertype !== newOpts.autoClosingOvertype),
autoSurround: (this.autoSurround !== newOpts.autoSurround),
autoIndent: (this.autoIndent !== newOpts.autoIndent),
useTabStops: (this.useTabStops !== newOpts.useTabStops),
@@ -1640,6 +1655,7 @@ export interface IConfigurationChangedEvent {
readonly wordSeparators: boolean;
readonly autoClosingBrackets: boolean;
readonly autoClosingQuotes: boolean;
readonly autoClosingOvertype: boolean;
readonly autoSurround: boolean;
readonly autoIndent: boolean;
readonly useTabStops: boolean;
@@ -1852,6 +1868,7 @@ export class EditorOptionsValidator {
wordWrapBreakObtrusiveCharacters: _string(opts.wordWrapBreakObtrusiveCharacters, defaults.wordWrapBreakObtrusiveCharacters),
autoClosingBrackets,
autoClosingQuotes,
autoClosingOvertype: _stringSet<EditorAutoClosingOvertypeStrategy>(opts.autoClosingOvertype, defaults.autoClosingOvertype, ['always', 'auto', 'never']),
autoSurround,
autoIndent: _boolean(opts.autoIndent, defaults.autoIndent),
dragAndDrop: _boolean(opts.dragAndDrop, defaults.dragAndDrop),
@@ -2148,7 +2165,6 @@ export class EditorOptionsValidator {
export class InternalEditorOptionsFactory {
private static _tweakValidatedOptions(opts: IValidatedEditorOptions, accessibilitySupport: AccessibilitySupport): IValidatedEditorOptions {
const accessibilityIsOn = (accessibilitySupport === AccessibilitySupport.Enabled);
const accessibilityIsOff = (accessibilitySupport === AccessibilitySupport.Disabled);
return {
inDiffEditor: opts.inDiffEditor,
@@ -2168,6 +2184,7 @@ export class InternalEditorOptionsFactory {
wordWrapBreakObtrusiveCharacters: opts.wordWrapBreakObtrusiveCharacters,
autoClosingBrackets: opts.autoClosingBrackets,
autoClosingQuotes: opts.autoClosingQuotes,
autoClosingOvertype: opts.autoClosingOvertype,
autoSurround: opts.autoSurround,
autoIndent: opts.autoIndent,
dragAndDrop: opts.dragAndDrop,
@@ -2244,7 +2261,7 @@ export class InternalEditorOptionsFactory {
selectionHighlight: opts.contribInfo.selectionHighlight,
occurrencesHighlight: opts.contribInfo.occurrencesHighlight,
codeLens: opts.contribInfo.codeLens,
folding: (accessibilityIsOn ? false : opts.contribInfo.folding), // DISABLED WHEN SCREEN READER IS ATTACHED
folding: opts.contribInfo.folding,
foldingStrategy: opts.contribInfo.foldingStrategy,
showFoldingControls: opts.contribInfo.showFoldingControls,
matchBrackets: opts.contribInfo.matchBrackets,
@@ -2396,6 +2413,7 @@ export class InternalEditorOptionsFactory {
wordSeparators: opts.wordSeparators,
autoClosingBrackets: opts.autoClosingBrackets,
autoClosingQuotes: opts.autoClosingQuotes,
autoClosingOvertype: opts.autoClosingOvertype,
autoSurround: opts.autoSurround,
autoIndent: opts.autoIndent,
useTabStops: opts.useTabStops,
@@ -2635,6 +2653,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
wordWrapBreakObtrusiveCharacters: '.',
autoClosingBrackets: 'languageDefined',
autoClosingQuotes: 'languageDefined',
autoClosingOvertype: 'auto',
autoSurround: 'languageDefined',
autoIndent: true,
dragAndDrop: true,