mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode 966b87dd4013be1a9c06e2b8334522ec61905cc2 (#4696)
This commit is contained in:
@@ -1567,9 +1567,9 @@ export interface ITokenizationRegistry {
|
||||
|
||||
/**
|
||||
* Get the tokenization support for a language.
|
||||
* Returns null if not found.
|
||||
* Returns `null` if not found.
|
||||
*/
|
||||
get(language: string): ITokenizationSupport;
|
||||
get(language: string): ITokenizationSupport | null;
|
||||
|
||||
/**
|
||||
* Get the promise of a tokenization support for a language.
|
||||
|
||||
@@ -57,7 +57,7 @@ export class RichEditSupport {
|
||||
public readonly indentationRules: IndentationRule | undefined;
|
||||
public readonly foldingRules: FoldingRules;
|
||||
|
||||
constructor(languageIdentifier: LanguageIdentifier, previous: RichEditSupport, rawConf: LanguageConfiguration) {
|
||||
constructor(languageIdentifier: LanguageIdentifier, previous: RichEditSupport | undefined, rawConf: LanguageConfiguration) {
|
||||
this._languageIdentifier = languageIdentifier;
|
||||
|
||||
this._brackets = null;
|
||||
@@ -175,34 +175,30 @@ export class LanguageConfigurationChangeEvent {
|
||||
|
||||
export class LanguageConfigurationRegistryImpl {
|
||||
|
||||
private readonly _entries: RichEditSupport[];
|
||||
private readonly _entries = new Map<LanguageId, RichEditSupport>();
|
||||
|
||||
private readonly _onDidChange = new Emitter<LanguageConfigurationChangeEvent>();
|
||||
public readonly onDidChange: Event<LanguageConfigurationChangeEvent> = this._onDidChange.event;
|
||||
|
||||
constructor() {
|
||||
this._entries = [];
|
||||
}
|
||||
|
||||
public register(languageIdentifier: LanguageIdentifier, configuration: LanguageConfiguration): IDisposable {
|
||||
let previous = this._getRichEditSupport(languageIdentifier.id);
|
||||
let current = new RichEditSupport(languageIdentifier, previous, configuration);
|
||||
this._entries[languageIdentifier.id] = current;
|
||||
this._entries.set(languageIdentifier.id, current);
|
||||
this._onDidChange.fire({ languageIdentifier });
|
||||
return toDisposable(() => {
|
||||
if (this._entries[languageIdentifier.id] === current) {
|
||||
this._entries[languageIdentifier.id] = previous;
|
||||
if (this._entries.get(languageIdentifier.id) === current) {
|
||||
this._entries.set(languageIdentifier.id, previous);
|
||||
this._onDidChange.fire({ languageIdentifier });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private _getRichEditSupport(languageId: LanguageId): RichEditSupport {
|
||||
return this._entries[languageId] || null;
|
||||
private _getRichEditSupport(languageId: LanguageId): RichEditSupport | undefined {
|
||||
return this._entries.get(languageId);
|
||||
}
|
||||
|
||||
public getIndentationRules(languageId: LanguageId) {
|
||||
let value = this._entries[languageId];
|
||||
const value = this._entries.get(languageId);
|
||||
|
||||
if (!value) {
|
||||
return null;
|
||||
|
||||
@@ -7,11 +7,13 @@ import { Color } from 'vs/base/common/color';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ColorId, ITokenizationRegistry, ITokenizationSupport, ITokenizationSupportChangedEvent } from 'vs/editor/common/modes';
|
||||
import { withUndefinedAsNull } from 'vs/base/common/types';
|
||||
import { keys } from 'vs/base/common/map';
|
||||
|
||||
export class TokenizationRegistryImpl implements ITokenizationRegistry {
|
||||
|
||||
private readonly _map: { [language: string]: ITokenizationSupport };
|
||||
private readonly _promises: { [language: string]: Thenable<void> };
|
||||
private readonly _map = new Map<string, ITokenizationSupport>();
|
||||
private readonly _promises = new Map<string, Thenable<void>>();
|
||||
|
||||
private readonly _onDidChange = new Emitter<ITokenizationSupportChangedEvent>();
|
||||
public readonly onDidChange: Event<ITokenizationSupportChangedEvent> = this._onDidChange.event;
|
||||
@@ -19,8 +21,6 @@ export class TokenizationRegistryImpl implements ITokenizationRegistry {
|
||||
private _colorMap: Color[] | null;
|
||||
|
||||
constructor() {
|
||||
this._map = Object.create(null);
|
||||
this._promises = Object.create(null);
|
||||
this._colorMap = null;
|
||||
}
|
||||
|
||||
@@ -32,13 +32,13 @@ export class TokenizationRegistryImpl implements ITokenizationRegistry {
|
||||
}
|
||||
|
||||
public register(language: string, support: ITokenizationSupport) {
|
||||
this._map[language] = support;
|
||||
this._map.set(language, support);
|
||||
this.fire([language]);
|
||||
return toDisposable(() => {
|
||||
if (this._map[language] !== support) {
|
||||
if (this._map.get(language) !== support) {
|
||||
return;
|
||||
}
|
||||
delete this._map[language];
|
||||
this._map.delete(language);
|
||||
this.fire([language]);
|
||||
});
|
||||
}
|
||||
@@ -48,13 +48,13 @@ export class TokenizationRegistryImpl implements ITokenizationRegistry {
|
||||
let registration: IDisposable | null = null;
|
||||
let isDisposed: boolean = false;
|
||||
|
||||
this._promises[language] = supportPromise.then(support => {
|
||||
delete this._promises[language];
|
||||
this._promises.set(language, supportPromise.then(support => {
|
||||
this._promises.delete(language);
|
||||
if (isDisposed || !support) {
|
||||
return;
|
||||
}
|
||||
registration = this.register(language, support);
|
||||
});
|
||||
}));
|
||||
|
||||
return toDisposable(() => {
|
||||
isDisposed = true;
|
||||
@@ -69,21 +69,21 @@ export class TokenizationRegistryImpl implements ITokenizationRegistry {
|
||||
if (support) {
|
||||
return Promise.resolve(support);
|
||||
}
|
||||
const promise = this._promises[language];
|
||||
const promise = this._promises.get(language);
|
||||
if (promise) {
|
||||
return promise.then(_ => this.get(language));
|
||||
return promise.then(_ => this.get(language)!);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public get(language: string): ITokenizationSupport {
|
||||
return (this._map[language] || null);
|
||||
public get(language: string): ITokenizationSupport | null {
|
||||
return withUndefinedAsNull(this._map.get(language));
|
||||
}
|
||||
|
||||
public setColorMap(colorMap: Color[]): void {
|
||||
this._colorMap = colorMap;
|
||||
this._onDidChange.fire({
|
||||
changedLanguages: Object.keys(this._map),
|
||||
changedLanguages: keys(this._map),
|
||||
changedColorMap: true
|
||||
});
|
||||
}
|
||||
|
||||
84
src/vs/editor/common/standaloneStrings.ts
Normal file
84
src/vs/editor/common/standaloneStrings.ts
Normal file
@@ -0,0 +1,84 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
export namespace AccessibilityHelpNLS {
|
||||
export const noSelection = nls.localize("noSelection", "No selection");
|
||||
export const singleSelectionRange = nls.localize("singleSelectionRange", "Line {0}, Column {1} ({2} selected)");
|
||||
export const singleSelection = nls.localize("singleSelection", "Line {0}, Column {1}");
|
||||
export const multiSelectionRange = nls.localize("multiSelectionRange", "{0} selections ({1} characters selected)");
|
||||
export const multiSelection = nls.localize("multiSelection", "{0} selections");
|
||||
export const emergencyConfOn = nls.localize("emergencyConfOn", "Now changing the setting `accessibilitySupport` to 'on'.");
|
||||
export const openingDocs = nls.localize("openingDocs", "Now opening the Editor Accessibility documentation page.");
|
||||
export const readonlyDiffEditor = nls.localize("readonlyDiffEditor", " in a read-only pane of a diff editor.");
|
||||
export const editableDiffEditor = nls.localize("editableDiffEditor", " in a pane of a diff editor.");
|
||||
export const readonlyEditor = nls.localize("readonlyEditor", " in a read-only code editor");
|
||||
export const editableEditor = nls.localize("editableEditor", " in a code editor");
|
||||
export const changeConfigToOnMac = nls.localize("changeConfigToOnMac", "To configure the editor to be optimized for usage with a Screen Reader press Command+E now.");
|
||||
export const changeConfigToOnWinLinux = nls.localize("changeConfigToOnWinLinux", "To configure the editor to be optimized for usage with a Screen Reader press Control+E now.");
|
||||
export const auto_on = nls.localize("auto_on", "The editor is configured to be optimized for usage with a Screen Reader.");
|
||||
export const auto_off = nls.localize("auto_off", "The editor is configured to never be optimized for usage with a Screen Reader, which is not the case at this time.");
|
||||
export const tabFocusModeOnMsg = nls.localize("tabFocusModeOnMsg", "Pressing Tab in the current editor will move focus to the next focusable element. Toggle this behavior by pressing {0}.");
|
||||
export const tabFocusModeOnMsgNoKb = nls.localize("tabFocusModeOnMsgNoKb", "Pressing Tab in the current editor will move focus to the next focusable element. The command {0} is currently not triggerable by a keybinding.");
|
||||
export const tabFocusModeOffMsg = nls.localize("tabFocusModeOffMsg", "Pressing Tab in the current editor will insert the tab character. Toggle this behavior by pressing {0}.");
|
||||
export const tabFocusModeOffMsgNoKb = nls.localize("tabFocusModeOffMsgNoKb", "Pressing Tab in the current editor will insert the tab character. The command {0} is currently not triggerable by a keybinding.");
|
||||
export const openDocMac = nls.localize("openDocMac", "Press Command+H now to open a browser window with more information related to editor accessibility.");
|
||||
export const openDocWinLinux = nls.localize("openDocWinLinux", "Press Control+H now to open a browser window with more information related to editor accessibility.");
|
||||
export const outroMsg = nls.localize("outroMsg", "You can dismiss this tooltip and return to the editor by pressing Escape or Shift+Escape.");
|
||||
export const showAccessibilityHelpAction = nls.localize("showAccessibilityHelpAction", "Show Accessibility Help");
|
||||
}
|
||||
|
||||
export namespace InspectTokensNLS {
|
||||
export const inspectTokensAction = nls.localize('inspectTokens', "Developer: Inspect Tokens");
|
||||
}
|
||||
|
||||
export namespace GoToLineNLS {
|
||||
export const gotoLineLabelValidLineAndColumn = nls.localize('gotoLineLabelValidLineAndColumn', "Go to line {0} and character {1}");
|
||||
export const gotoLineLabelValidLine = nls.localize('gotoLineLabelValidLine', "Go to line {0}");
|
||||
export const gotoLineLabelEmptyWithLineLimit = nls.localize('gotoLineLabelEmptyWithLineLimit', "Type a line number between 1 and {0} to navigate to");
|
||||
export const gotoLineLabelEmptyWithLineAndColumnLimit = nls.localize('gotoLineLabelEmptyWithLineAndColumnLimit', "Type a character between 1 and {0} to navigate to");
|
||||
export const gotoLineAriaLabel = nls.localize('gotoLineAriaLabel', "Current Line: {0}. Go to line {1}.");
|
||||
export const gotoLineActionInput = nls.localize('gotoLineActionInput', "Type a line number, followed by an optional colon and a character number to navigate to");
|
||||
export const gotoLineActionLabel = nls.localize('gotoLineActionLabel', "Go to Line...");
|
||||
}
|
||||
|
||||
export namespace QuickCommandNLS {
|
||||
export const ariaLabelEntryWithKey = nls.localize('ariaLabelEntryWithKey', "{0}, {1}, commands");
|
||||
export const ariaLabelEntry = nls.localize('ariaLabelEntry', "{0}, commands");
|
||||
export const quickCommandActionInput = nls.localize('quickCommandActionInput', "Type the name of an action you want to execute");
|
||||
export const quickCommandActionLabel = nls.localize('quickCommandActionLabel', "Command Palette");
|
||||
}
|
||||
|
||||
export namespace QuickOutlineNLS {
|
||||
export const entryAriaLabel = nls.localize('entryAriaLabel', "{0}, symbols");
|
||||
export const quickOutlineActionInput = nls.localize('quickOutlineActionInput', "Type the name of an identifier you wish to navigate to");
|
||||
export const quickOutlineActionLabel = nls.localize('quickOutlineActionLabel', "Go to Symbol...");
|
||||
export const _symbols_ = nls.localize('symbols', "symbols ({0})");
|
||||
export const _modules_ = nls.localize('modules', "modules ({0})");
|
||||
export const _class_ = nls.localize('class', "classes ({0})");
|
||||
export const _interface_ = nls.localize('interface', "interfaces ({0})");
|
||||
export const _method_ = nls.localize('method', "methods ({0})");
|
||||
export const _function_ = nls.localize('function', "functions ({0})");
|
||||
export const _property_ = nls.localize('property', "properties ({0})");
|
||||
export const _variable_ = nls.localize('variable', "variables ({0})");
|
||||
export const _variable2_ = nls.localize('variable2', "variables ({0})");
|
||||
export const _constructor_ = nls.localize('_constructor', "constructors ({0})");
|
||||
export const _call_ = nls.localize('call', "calls ({0})");
|
||||
}
|
||||
|
||||
export namespace StandaloneCodeEditorNLS {
|
||||
export const editorViewAccessibleLabel = nls.localize('editorViewAccessibleLabel', "Editor content");
|
||||
export const accessibilityHelpMessageIE = nls.localize('accessibilityHelpMessageIE', "Press Ctrl+F1 for Accessibility Options.");
|
||||
export const accessibilityHelpMessage = nls.localize('accessibilityHelpMessage', "Press Alt+F1 for Accessibility Options.");
|
||||
}
|
||||
|
||||
export namespace ToggleHighContrastNLS {
|
||||
export const toggleHighContrast = nls.localize('toggleHighContrast', "Toggle High Contrast Theme");
|
||||
}
|
||||
|
||||
export namespace SimpleServicesNLS {
|
||||
export const bulkEditServiceSummary = nls.localize('bulkEditServiceSummary', "Made {0} edits in {1} files");
|
||||
}
|
||||
Reference in New Issue
Block a user