mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 02:32:35 -05:00
Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 (#7206)
* Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 * fix config changes * fix strictnull checks
This commit is contained in:
@@ -17,7 +17,7 @@ import * as strings from 'vs/base/common/strings';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ICodeEditor, IOverlayWidget, IOverlayWidgetPosition } from 'vs/editor/browser/editorBrowser';
|
||||
import { EditorAction, EditorCommand, registerEditorAction, registerEditorCommand, registerEditorContribution } from 'vs/editor/browser/editorExtensions';
|
||||
import * as editorOptions from 'vs/editor/common/config/editorOptions';
|
||||
import { IEditorOptions, EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { IEditorContribution } from 'vs/editor/common/editorCommon';
|
||||
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
|
||||
import { ToggleTabFocusModeAction } from 'vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode';
|
||||
@@ -185,13 +185,13 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
|
||||
}
|
||||
|
||||
private _buildContent() {
|
||||
let opts = this._editor.getConfiguration();
|
||||
const options = this._editor.getOptions();
|
||||
let text = nls.localize('introMsg', "Thank you for trying out VS Code's accessibility options.");
|
||||
|
||||
text += '\n\n' + nls.localize('status', "Status:");
|
||||
|
||||
const configuredValue = this._configurationService.getValue<editorOptions.IEditorOptions>('editor').accessibilitySupport;
|
||||
const actualValue = opts.accessibilitySupport;
|
||||
const configuredValue = this._configurationService.getValue<IEditorOptions>('editor').accessibilitySupport;
|
||||
const actualValue = options.get(EditorOption.accessibilitySupport);
|
||||
|
||||
const emergencyTurnOnMessage = (
|
||||
platform.isMacintosh
|
||||
@@ -229,7 +229,7 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
|
||||
const NLS_TAB_FOCUS_MODE_OFF = nls.localize('tabFocusModeOffMsg', "Pressing Tab in the current editor will insert the tab character. Toggle this behavior by pressing {0}.");
|
||||
const NLS_TAB_FOCUS_MODE_OFF_NO_KB = nls.localize('tabFocusModeOffMsgNoKb', "Pressing Tab in the current editor will insert the tab character. The command {0} is currently not triggerable by a keybinding.");
|
||||
|
||||
if (opts.tabFocusMode) {
|
||||
if (options.get(EditorOption.tabFocusMode)) {
|
||||
text += '\n\n - ' + this._descriptionForCommand(ToggleTabFocusModeAction.ID, NLS_TAB_FOCUS_MODE_ON, NLS_TAB_FOCUS_MODE_ON_NO_KB);
|
||||
} else {
|
||||
text += '\n\n - ' + this._descriptionForCommand(ToggleTabFocusModeAction.ID, NLS_TAB_FOCUS_MODE_OFF, NLS_TAB_FOCUS_MODE_OFF_NO_KB);
|
||||
|
||||
@@ -59,7 +59,7 @@ export abstract class SimpleFindWidget extends Widget {
|
||||
return null;
|
||||
} catch (e) {
|
||||
this.foundMatch = false;
|
||||
this._updateButtons();
|
||||
this.updateButtons(this.foundMatch);
|
||||
return { content: e.message };
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ export abstract class SimpleFindWidget extends Widget {
|
||||
|
||||
this.oninput(this._findInput.domNode, (e) => {
|
||||
this.foundMatch = this.onInputChanged();
|
||||
this._updateButtons();
|
||||
this.updateButtons(this.foundMatch);
|
||||
this._delayedUpdateHistory();
|
||||
});
|
||||
|
||||
@@ -209,7 +209,7 @@ export abstract class SimpleFindWidget extends Widget {
|
||||
}
|
||||
|
||||
this._isVisible = true;
|
||||
this._updateButtons();
|
||||
this.updateButtons(this.foundMatch);
|
||||
|
||||
setTimeout(() => {
|
||||
dom.addClass(this._innerDomNode, 'visible');
|
||||
@@ -240,7 +240,7 @@ export abstract class SimpleFindWidget extends Widget {
|
||||
// Need to delay toggling visibility until after Transition, then visibility hidden - removes from tabIndex list
|
||||
setTimeout(() => {
|
||||
this._isVisible = false;
|
||||
this._updateButtons();
|
||||
this.updateButtons(this.foundMatch);
|
||||
dom.removeClass(this._innerDomNode, 'visible');
|
||||
}, 200);
|
||||
}
|
||||
@@ -266,10 +266,10 @@ export abstract class SimpleFindWidget extends Widget {
|
||||
return this._findInput.getCaseSensitive();
|
||||
}
|
||||
|
||||
private _updateButtons() {
|
||||
let hasInput = this.inputValue.length > 0;
|
||||
this.prevBtn.setEnabled(this._isVisible && hasInput && this.foundMatch);
|
||||
this.nextBtn.setEnabled(this._isVisible && hasInput && this.foundMatch);
|
||||
protected updateButtons(foundMatch: boolean) {
|
||||
const hasInput = this.inputValue.length > 0;
|
||||
this.prevBtn.setEnabled(this._isVisible && hasInput && foundMatch);
|
||||
this.nextBtn.setEnabled(this._isVisible && hasInput && foundMatch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import { Extensions, IJSONContributionRegistry } from 'vs/platform/jsonschemas/c
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ITextMateService } from 'vs/workbench/services/textMate/common/textMateService';
|
||||
import { getParseErrorMessage } from 'vs/base/common/jsonErrorMessages';
|
||||
|
||||
interface IRegExp {
|
||||
pattern: string;
|
||||
@@ -101,7 +102,7 @@ export class LanguageConfigurationFileHandler {
|
||||
const errors: ParseError[] = [];
|
||||
const configuration = <ILanguageConfiguration>parse(contents.value.toString(), errors);
|
||||
if (errors.length) {
|
||||
console.error(nls.localize('parseErrors', "Errors parsing {0}: {1}", configFileLocation.toString(), errors.join('\n')));
|
||||
console.error(nls.localize('parseErrors', "Errors parsing {0}: {1}", configFileLocation.toString(), errors.map(e => (`[${e.offset}, ${e.length}] ${getParseErrorMessage(e.error)}`)).join('\n')));
|
||||
}
|
||||
this._handleConfig(languageIdentifier, configuration);
|
||||
}, (err) => {
|
||||
@@ -358,6 +359,7 @@ export class LanguageConfigurationFileHandler {
|
||||
const schemaId = 'vscode://schemas/language-configuration';
|
||||
const schema: IJSONSchema = {
|
||||
allowComments: true,
|
||||
allowsTrailingCommas: true,
|
||||
default: {
|
||||
comments: {
|
||||
blockComment: ['/*', '*/'],
|
||||
|
||||
@@ -9,7 +9,7 @@ import * as process from 'vs/base/common/process';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser';
|
||||
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
|
||||
import { IConfigurationChangedEvent } from 'vs/editor/common/config/editorOptions';
|
||||
import { ConfigurationChangedEvent, EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { ICursorSelectionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { IEditorContribution } from 'vs/editor/common/editorCommon';
|
||||
@@ -24,11 +24,11 @@ export class SelectionClipboard extends Disposable implements IEditorContributio
|
||||
super();
|
||||
|
||||
if (platform.isLinux) {
|
||||
let isEnabled = editor.getConfiguration().contribInfo.selectionClipboard;
|
||||
let isEnabled = editor.getOption(EditorOption.selectionClipboard);
|
||||
|
||||
this._register(editor.onDidChangeConfiguration((e: IConfigurationChangedEvent) => {
|
||||
if (e.contribInfo) {
|
||||
isEnabled = editor.getConfiguration().contribInfo.selectionClipboard;
|
||||
this._register(editor.onDidChangeConfiguration((e: ConfigurationChangedEvent) => {
|
||||
if (e.hasChanged(EditorOption.selectionClipboard)) {
|
||||
isEnabled = editor.getOption(EditorOption.selectionClipboard);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { EditorAction, ServicesAccessor, registerEditorAction, registerEditorContribution } from 'vs/editor/browser/editorExtensions';
|
||||
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { EDITOR_DEFAULTS, InternalEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { EditorOption, EditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { IEditorContribution } from 'vs/editor/common/editorCommon';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
@@ -19,6 +19,7 @@ import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/commo
|
||||
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { DefaultSettingsEditorContribution } from 'vs/workbench/contrib/preferences/browser/preferencesEditor';
|
||||
import { registerAndGetAmdImageURL } from 'vs/base/common/amd';
|
||||
|
||||
const transientWordWrapState = 'transientWordWrapState';
|
||||
const isWordWrapMinifiedKey = 'isWordWrapMinified';
|
||||
@@ -68,7 +69,7 @@ function readWordWrapState(model: ITextModel, configurationService: ITextResourc
|
||||
const _transientState = readTransientState(model, codeEditorService);
|
||||
return {
|
||||
configuredWordWrap: _configuredWordWrap,
|
||||
configuredWordWrapMinified: (typeof _configuredWordWrapMinified === 'boolean' ? _configuredWordWrapMinified : EDITOR_DEFAULTS.wordWrapMinified),
|
||||
configuredWordWrapMinified: (typeof _configuredWordWrapMinified === 'boolean' ? _configuredWordWrapMinified : EditorOptions.wordWrapMinified.defaultValue),
|
||||
transientState: _transientState
|
||||
};
|
||||
}
|
||||
@@ -83,10 +84,9 @@ function toggleWordWrap(editor: ICodeEditor, state: IWordWrapState): IWordWrapSt
|
||||
};
|
||||
}
|
||||
|
||||
const config = editor.getConfiguration();
|
||||
let transientState: IWordWrapTransientState;
|
||||
|
||||
const actualWrappingInfo = config.wrappingInfo;
|
||||
const actualWrappingInfo = editor.getOption(EditorOption.wrappingInfo);
|
||||
if (actualWrappingInfo.isWordWrapMinified) {
|
||||
// => wrapping due to minified file
|
||||
transientState = {
|
||||
@@ -139,8 +139,7 @@ class ToggleWordWrapAction extends EditorAction {
|
||||
if (!editor.hasModel()) {
|
||||
return;
|
||||
}
|
||||
const editorConfiguration = editor.getConfiguration();
|
||||
if (editorConfiguration.wrappingInfo.inDiffEditor) {
|
||||
if (editor.getOption(EditorOption.inDiffEditor)) {
|
||||
// Cannot change wrapping settings inside the diff editor
|
||||
const notificationService = accessor.get(INotificationService);
|
||||
notificationService.info(nls.localize('wordWrap.notInDiffEditor', "Cannot toggle word wrap in a diff editor."));
|
||||
@@ -177,20 +176,22 @@ class ToggleWordWrapController extends Disposable implements IEditorContribution
|
||||
) {
|
||||
super();
|
||||
|
||||
const configuration = this.editor.getConfiguration();
|
||||
const isWordWrapMinified = this.contextKeyService.createKey(isWordWrapMinifiedKey, this._isWordWrapMinified(configuration));
|
||||
const isDominatedByLongLines = this.contextKeyService.createKey(isDominatedByLongLinesKey, this._isDominatedByLongLines(configuration));
|
||||
const inDiffEditor = this.contextKeyService.createKey(inDiffEditorKey, this._inDiffEditor(configuration));
|
||||
const options = this.editor.getOptions();
|
||||
const wrappingInfo = options.get(EditorOption.wrappingInfo);
|
||||
const isWordWrapMinified = this.contextKeyService.createKey(isWordWrapMinifiedKey, wrappingInfo.isWordWrapMinified);
|
||||
const isDominatedByLongLines = this.contextKeyService.createKey(isDominatedByLongLinesKey, wrappingInfo.isDominatedByLongLines);
|
||||
const inDiffEditor = this.contextKeyService.createKey(inDiffEditorKey, options.get(EditorOption.inDiffEditor));
|
||||
let currentlyApplyingEditorConfig = false;
|
||||
|
||||
this._register(editor.onDidChangeConfiguration((e) => {
|
||||
if (!e.wrappingInfo) {
|
||||
if (!e.hasChanged(EditorOption.wrappingInfo) && !e.hasChanged(EditorOption.inDiffEditor)) {
|
||||
return;
|
||||
}
|
||||
const configuration = this.editor.getConfiguration();
|
||||
isWordWrapMinified.set(this._isWordWrapMinified(configuration));
|
||||
isDominatedByLongLines.set(this._isDominatedByLongLines(configuration));
|
||||
inDiffEditor.set(this._inDiffEditor(configuration));
|
||||
const options = this.editor.getOptions();
|
||||
const wrappingInfo = options.get(EditorOption.wrappingInfo);
|
||||
isWordWrapMinified.set(wrappingInfo.isWordWrapMinified);
|
||||
isDominatedByLongLines.set(wrappingInfo.isDominatedByLongLines);
|
||||
inDiffEditor.set(options.get(EditorOption.inDiffEditor));
|
||||
if (!currentlyApplyingEditorConfig) {
|
||||
// I am not the cause of the word wrap getting changed
|
||||
ensureWordWrapSettings();
|
||||
@@ -216,8 +217,7 @@ class ToggleWordWrapController extends Disposable implements IEditorContribution
|
||||
return;
|
||||
}
|
||||
|
||||
const configuration = this.editor.getConfiguration();
|
||||
if (this._inDiffEditor(configuration)) {
|
||||
if (this.editor.getOption(EditorOption.inDiffEditor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -255,18 +255,6 @@ class ToggleWordWrapController extends Disposable implements IEditorContribution
|
||||
});
|
||||
}
|
||||
|
||||
private _isWordWrapMinified(config: InternalEditorOptions): boolean {
|
||||
return config.wrappingInfo.isWordWrapMinified;
|
||||
}
|
||||
|
||||
private _isDominatedByLongLines(config: InternalEditorOptions): boolean {
|
||||
return config.wrappingInfo.isDominatedByLongLines;
|
||||
}
|
||||
|
||||
private _inDiffEditor(config: InternalEditorOptions): boolean {
|
||||
return config.wrappingInfo.inDiffEditor;
|
||||
}
|
||||
|
||||
public getId(): string {
|
||||
return ToggleWordWrapController._ID;
|
||||
}
|
||||
@@ -284,13 +272,16 @@ registerEditorContribution(ToggleWordWrapController);
|
||||
|
||||
registerEditorAction(ToggleWordWrapAction);
|
||||
|
||||
const WORD_WRAP_DARK_ICON = URI.parse(registerAndGetAmdImageURL('vs/workbench/contrib/codeEditor/browser/word-wrap-dark.svg'));
|
||||
const WORD_WRAP_LIGHT_ICON = URI.parse(registerAndGetAmdImageURL('vs/workbench/contrib/codeEditor/browser/word-wrap-light.svg'));
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
||||
command: {
|
||||
id: TOGGLE_WORD_WRAP_ID,
|
||||
title: nls.localize('unwrapMinified', "Disable wrapping for this file"),
|
||||
iconLocation: {
|
||||
dark: URI.parse(require.toUrl('vs/workbench/contrib/codeEditor/browser/word-wrap-dark.svg')),
|
||||
light: URI.parse(require.toUrl('vs/workbench/contrib/codeEditor/browser/word-wrap-light.svg'))
|
||||
dark: WORD_WRAP_DARK_ICON,
|
||||
light: WORD_WRAP_LIGHT_ICON
|
||||
}
|
||||
},
|
||||
group: 'navigation',
|
||||
@@ -306,8 +297,8 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
||||
id: TOGGLE_WORD_WRAP_ID,
|
||||
title: nls.localize('wrapMinified', "Enable wrapping for this file"),
|
||||
iconLocation: {
|
||||
dark: URI.parse(require.toUrl('vs/workbench/contrib/codeEditor/browser/word-wrap-dark.svg')),
|
||||
light: URI.parse(require.toUrl('vs/workbench/contrib/codeEditor/browser/word-wrap-light.svg'))
|
||||
dark: WORD_WRAP_DARK_ICON,
|
||||
light: WORD_WRAP_LIGHT_ICON
|
||||
}
|
||||
},
|
||||
group: 'navigation',
|
||||
|
||||
Reference in New Issue
Block a user