mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 19:18:32 -05:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -177,7 +177,7 @@ export class LanguageConfigurationRegistryImpl {
|
||||
|
||||
private _entries: RichEditSupport[];
|
||||
|
||||
private readonly _onDidChange: Emitter<LanguageConfigurationChangeEvent> = new Emitter<LanguageConfigurationChangeEvent>();
|
||||
private readonly _onDidChange = new Emitter<LanguageConfigurationChangeEvent>();
|
||||
public readonly onDidChange: Event<LanguageConfigurationChangeEvent> = this._onDidChange.event;
|
||||
|
||||
constructor() {
|
||||
@@ -332,7 +332,7 @@ export class LanguageConfigurationRegistryImpl {
|
||||
private getPrecedingValidLine(model: IVirtualModel, lineNumber: number, indentRulesSupport: IndentRulesSupport) {
|
||||
let languageID = model.getLanguageIdAtPosition(lineNumber, 0);
|
||||
if (lineNumber > 1) {
|
||||
let lastLineNumber = lineNumber - 1;
|
||||
let lastLineNumber: number;
|
||||
let resultLineNumber = -1;
|
||||
|
||||
for (lastLineNumber = lineNumber - 1; lastLineNumber >= 1; lastLineNumber--) {
|
||||
|
||||
@@ -30,7 +30,7 @@ export class LanguageFeatureRegistry<T> {
|
||||
|
||||
private _clock: number = 0;
|
||||
private _entries: Entry<T>[] = [];
|
||||
private readonly _onDidChange: Emitter<number> = new Emitter<number>();
|
||||
private readonly _onDidChange = new Emitter<number>();
|
||||
|
||||
constructor() {
|
||||
}
|
||||
@@ -119,8 +119,7 @@ export class LanguageFeatureRegistry<T> {
|
||||
|
||||
this._updateScores(model);
|
||||
|
||||
for (let from = 0; from < this._entries.length; from++) {
|
||||
let entry = this._entries[from];
|
||||
for (const entry of this._entries) {
|
||||
if (entry._score > 0) {
|
||||
callback(entry);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export interface LanguageFilter {
|
||||
exclusive?: boolean;
|
||||
}
|
||||
|
||||
export type LanguageSelector = string | LanguageFilter | (string | LanguageFilter)[];
|
||||
export type LanguageSelector = string | LanguageFilter | Array<string | LanguageFilter>;
|
||||
|
||||
export function score(selector: LanguageSelector, candidateUri: URI, candidateLanguage: string, candidateIsSynchronized: boolean): number {
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ export class LinkComputer {
|
||||
* document. *Note* that this operation is computational
|
||||
* expensive and should not run in the UI thread.
|
||||
*/
|
||||
export function computeLinks(model: ILinkComputerTarget): ILink[] {
|
||||
export function computeLinks(model: ILinkComputerTarget | null): ILink[] {
|
||||
if (!model || typeof model.getLineCount !== 'function' || typeof model.getLineContent !== 'function') {
|
||||
// Unknown caller!
|
||||
return [];
|
||||
|
||||
@@ -18,26 +18,28 @@ export const Extensions = {
|
||||
export class EditorModesRegistry {
|
||||
|
||||
private _languages: ILanguageExtensionPoint[];
|
||||
private _dynamicLanguages: ILanguageExtensionPoint[];
|
||||
|
||||
private readonly _onDidAddLanguages: Emitter<ILanguageExtensionPoint[]> = new Emitter<ILanguageExtensionPoint[]>();
|
||||
public readonly onDidAddLanguages: Event<ILanguageExtensionPoint[]> = this._onDidAddLanguages.event;
|
||||
private readonly _onDidChangeLanguages = new Emitter<void>();
|
||||
public readonly onDidChangeLanguages: Event<void> = this._onDidChangeLanguages.event;
|
||||
|
||||
constructor() {
|
||||
this._languages = [];
|
||||
this._dynamicLanguages = [];
|
||||
}
|
||||
|
||||
// --- languages
|
||||
|
||||
public registerLanguage(def: ILanguageExtensionPoint): void {
|
||||
this._languages.push(def);
|
||||
this._onDidAddLanguages.fire([def]);
|
||||
this._onDidChangeLanguages.fire(undefined);
|
||||
}
|
||||
public registerLanguages(def: ILanguageExtensionPoint[]): void {
|
||||
this._languages = this._languages.concat(def);
|
||||
this._onDidAddLanguages.fire(def);
|
||||
public setDynamicLanguages(def: ILanguageExtensionPoint[]): void {
|
||||
this._dynamicLanguages = def;
|
||||
this._onDidChangeLanguages.fire(undefined);
|
||||
}
|
||||
public getLanguages(): ILanguageExtensionPoint[] {
|
||||
return this._languages.slice(0);
|
||||
return (<ILanguageExtensionPoint[]>[]).concat(this._languages).concat(this._dynamicLanguages);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,9 +46,7 @@ export class CharacterPairSupport {
|
||||
let tokenIndex = context.findTokenIndexAtOffset(column - 2);
|
||||
let standardTokenType = context.getStandardTokenType(tokenIndex);
|
||||
|
||||
for (let i = 0; i < this._autoClosingPairs.length; ++i) {
|
||||
let autoClosingPair = this._autoClosingPairs[i];
|
||||
|
||||
for (const autoClosingPair of this._autoClosingPairs) {
|
||||
if (autoClosingPair.open === character) {
|
||||
return autoClosingPair.isOK(standardTokenType);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export class BracketElectricCharacterSupport {
|
||||
private readonly _richEditBrackets: RichEditBrackets | null;
|
||||
private readonly _complexAutoClosePairs: StandardAutoClosingPairConditional[];
|
||||
|
||||
constructor(richEditBrackets: RichEditBrackets | null, autoClosePairs: IAutoClosingPairConditional[], contribution: IBracketElectricCharacterContribution | undefined) {
|
||||
constructor(richEditBrackets: RichEditBrackets | null, autoClosePairs: IAutoClosingPairConditional[], contribution: IBracketElectricCharacterContribution | null | undefined) {
|
||||
contribution = contribution || {};
|
||||
this._richEditBrackets = richEditBrackets;
|
||||
this._complexAutoClosePairs = autoClosePairs.filter(pair => pair.open.length > 1 && !!pair.close).map(el => new StandardAutoClosingPairConditional(el));
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { IDisposable, toDisposable, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ColorId, ITokenizationRegistry, ITokenizationSupport, ITokenizationSupportChangedEvent } from 'vs/editor/common/modes';
|
||||
|
||||
export class TokenizationRegistryImpl implements ITokenizationRegistry {
|
||||
|
||||
private _map: { [language: string]: ITokenizationSupport };
|
||||
private _promises: { [language: string]: Thenable<IDisposable> };
|
||||
private _promises: { [language: string]: Thenable<void> };
|
||||
|
||||
private readonly _onDidChange: Emitter<ITokenizationSupportChangedEvent> = new Emitter<ITokenizationSupportChangedEvent>();
|
||||
private readonly _onDidChange = new Emitter<ITokenizationSupportChangedEvent>();
|
||||
public readonly onDidChange: Event<ITokenizationSupportChangedEvent> = this._onDidChange.event;
|
||||
|
||||
private _colorMap: Color[] | null;
|
||||
@@ -43,16 +43,25 @@ export class TokenizationRegistryImpl implements ITokenizationRegistry {
|
||||
});
|
||||
}
|
||||
|
||||
public registerPromise(language: string, supportPromise: Thenable<ITokenizationSupport | null>): Thenable<IDisposable> {
|
||||
const promise = this._promises[language] = supportPromise.then(support => {
|
||||
public registerPromise(language: string, supportPromise: Thenable<ITokenizationSupport | null>): IDisposable {
|
||||
|
||||
let registration: IDisposable | null = null;
|
||||
let isDisposed: boolean = false;
|
||||
|
||||
this._promises[language] = supportPromise.then(support => {
|
||||
delete this._promises[language];
|
||||
if (support) {
|
||||
return this.register(language, support);
|
||||
} else {
|
||||
return Disposable.None;
|
||||
if (isDisposed || !support) {
|
||||
return;
|
||||
}
|
||||
registration = this.register(language, support);
|
||||
});
|
||||
|
||||
return toDisposable(() => {
|
||||
isDisposed = true;
|
||||
if (registration) {
|
||||
registration.dispose();
|
||||
}
|
||||
});
|
||||
return promise;
|
||||
}
|
||||
|
||||
public getPromise(language: string): Thenable<ITokenizationSupport> | null {
|
||||
|
||||
Reference in New Issue
Block a user