Stop using Thenable

This commit is contained in:
Alex Dima 2020-09-07 14:44:01 +02:00
parent cbf1d6a12b
commit ff1c7a5a5c
No known key found for this signature in database
GPG key ID: 6E58D7B045760DA0
2 changed files with 24 additions and 26 deletions

View file

@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import Thenable = monaco.Thenable;
import IWorkerContext = monaco.worker.IWorkerContext;
import * as cssService from 'vscode-css-languageservice';
@ -40,7 +39,7 @@ export class CSSWorker {
// --- language service host ---------------
doValidation(uri: string): Thenable<cssService.Diagnostic[]> {
async doValidation(uri: string): Promise<cssService.Diagnostic[]> {
let document = this._getTextDocument(uri);
if (document) {
let stylesheet = this._languageService.parseStylesheet(document);
@ -49,72 +48,72 @@ export class CSSWorker {
}
return Promise.resolve([]);
}
doComplete(uri: string, position: cssService.Position): Thenable<cssService.CompletionList> {
async doComplete(uri: string, position: cssService.Position): Promise<cssService.CompletionList> {
let document = this._getTextDocument(uri);
let stylesheet = this._languageService.parseStylesheet(document);
let completions = this._languageService.doComplete(document, position, stylesheet);
return Promise.resolve(completions);
}
doHover(uri: string, position: cssService.Position): Thenable<cssService.Hover> {
async doHover(uri: string, position: cssService.Position): Promise<cssService.Hover> {
let document = this._getTextDocument(uri);
let stylesheet = this._languageService.parseStylesheet(document);
let hover = this._languageService.doHover(document, position, stylesheet);
return Promise.resolve(hover);
}
findDefinition(uri: string, position: cssService.Position): Thenable<cssService.Location> {
async findDefinition(uri: string, position: cssService.Position): Promise<cssService.Location> {
let document = this._getTextDocument(uri);
let stylesheet = this._languageService.parseStylesheet(document);
let definition = this._languageService.findDefinition(document, position, stylesheet);
return Promise.resolve(definition);
}
findReferences(uri: string, position: cssService.Position): Thenable<cssService.Location[]> {
async findReferences(uri: string, position: cssService.Position): Promise<cssService.Location[]> {
let document = this._getTextDocument(uri);
let stylesheet = this._languageService.parseStylesheet(document);
let references = this._languageService.findReferences(document, position, stylesheet);
return Promise.resolve(references);
}
findDocumentHighlights(uri: string, position: cssService.Position): Thenable<cssService.DocumentHighlight[]> {
async findDocumentHighlights(uri: string, position: cssService.Position): Promise<cssService.DocumentHighlight[]> {
let document = this._getTextDocument(uri);
let stylesheet = this._languageService.parseStylesheet(document);
let highlights = this._languageService.findDocumentHighlights(document, position, stylesheet);
return Promise.resolve(highlights);
}
findDocumentSymbols(uri: string): Thenable<cssService.SymbolInformation[]> {
async findDocumentSymbols(uri: string): Promise<cssService.SymbolInformation[]> {
let document = this._getTextDocument(uri);
let stylesheet = this._languageService.parseStylesheet(document);
let symbols = this._languageService.findDocumentSymbols(document, stylesheet);
return Promise.resolve(symbols);
}
doCodeActions(uri: string, range: cssService.Range, context: cssService.CodeActionContext): Thenable<cssService.Command[]> {
async doCodeActions(uri: string, range: cssService.Range, context: cssService.CodeActionContext): Promise<cssService.Command[]> {
let document = this._getTextDocument(uri);
let stylesheet = this._languageService.parseStylesheet(document);
let actions = this._languageService.doCodeActions(document, range, context, stylesheet);
return Promise.resolve(actions);
}
findDocumentColors(uri: string): Thenable<cssService.ColorInformation[]> {
async findDocumentColors(uri: string): Promise<cssService.ColorInformation[]> {
let document = this._getTextDocument(uri);
let stylesheet = this._languageService.parseStylesheet(document);
let colorSymbols = this._languageService.findDocumentColors(document, stylesheet);
return Promise.resolve(colorSymbols);
}
getColorPresentations(uri: string, color: cssService.Color, range: cssService.Range): Thenable<cssService.ColorPresentation[]> {
async getColorPresentations(uri: string, color: cssService.Color, range: cssService.Range): Promise<cssService.ColorPresentation[]> {
let document = this._getTextDocument(uri);
let stylesheet = this._languageService.parseStylesheet(document);
let colorPresentations = this._languageService.getColorPresentations(document, stylesheet, color, range);
return Promise.resolve(colorPresentations);
}
getFoldingRanges(uri: string, context?: { rangeLimit?: number; }): Thenable<cssService.FoldingRange[]> {
async getFoldingRanges(uri: string, context?: { rangeLimit?: number; }): Promise<cssService.FoldingRange[]> {
let document = this._getTextDocument(uri);
let ranges = this._languageService.getFoldingRanges(document, context);
return Promise.resolve(ranges);
}
getSelectionRanges(uri: string, positions: cssService.Position[]): Thenable<cssService.SelectionRange[]> {
async getSelectionRanges(uri: string, positions: cssService.Position[]): Promise<cssService.SelectionRange[]> {
let document = this._getTextDocument(uri);
let stylesheet = this._languageService.parseStylesheet(document);
let ranges = this._languageService.getSelectionRanges(document, positions, stylesheet);
return Promise.resolve(ranges);
}
doRename(uri: string, position: cssService.Position, newName: string): Thenable<cssService.WorkspaceEdit> {
async doRename(uri: string, position: cssService.Position, newName: string): Promise<cssService.WorkspaceEdit> {
let document = this._getTextDocument(uri);
let stylesheet = this._languageService.parseStylesheet(document);
let renames = this._languageService.doRename(document, position, newName, stylesheet);