mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 18:32:56 +01:00
use thenable
This commit is contained in:
parent
e6f882e3f1
commit
54f904f6fe
1 changed files with 13 additions and 12 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
import Thenable = monaco.Thenable;
|
||||||
import Promise = monaco.Promise;
|
import Promise = monaco.Promise;
|
||||||
import IWorkerContext = monaco.worker.IWorkerContext;
|
import IWorkerContext = monaco.worker.IWorkerContext;
|
||||||
|
|
||||||
|
|
@ -41,7 +42,7 @@ export class CSSWorker {
|
||||||
|
|
||||||
// --- language service host ---------------
|
// --- language service host ---------------
|
||||||
|
|
||||||
doValidation(uri: string): Promise<ls.Diagnostic[]> {
|
doValidation(uri: string): Thenable<ls.Diagnostic[]> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
if (document) {
|
if (document) {
|
||||||
let stylesheet = this._languageService.parseStylesheet(document);
|
let stylesheet = this._languageService.parseStylesheet(document);
|
||||||
|
|
@ -50,66 +51,66 @@ export class CSSWorker {
|
||||||
}
|
}
|
||||||
return Promise.as([]);
|
return Promise.as([]);
|
||||||
}
|
}
|
||||||
doComplete(uri: string, position: ls.Position): Promise<ls.CompletionList> {
|
doComplete(uri: string, position: ls.Position): Thenable<ls.CompletionList> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let stylesheet = this._languageService.parseStylesheet(document);
|
let stylesheet = this._languageService.parseStylesheet(document);
|
||||||
let completions = this._languageService.doComplete(document, position, stylesheet);
|
let completions = this._languageService.doComplete(document, position, stylesheet);
|
||||||
return Promise.as(completions);
|
return Promise.as(completions);
|
||||||
}
|
}
|
||||||
doHover(uri: string, position: ls.Position): Promise<ls.Hover> {
|
doHover(uri: string, position: ls.Position): Thenable<ls.Hover> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let stylesheet = this._languageService.parseStylesheet(document);
|
let stylesheet = this._languageService.parseStylesheet(document);
|
||||||
let hover = this._languageService.doHover(document, position, stylesheet);
|
let hover = this._languageService.doHover(document, position, stylesheet);
|
||||||
return Promise.as(hover);
|
return Promise.as(hover);
|
||||||
}
|
}
|
||||||
findDefinition(uri: string, position: ls.Position): Promise<ls.Location> {
|
findDefinition(uri: string, position: ls.Position): Thenable<ls.Location> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let stylesheet = this._languageService.parseStylesheet(document);
|
let stylesheet = this._languageService.parseStylesheet(document);
|
||||||
let definition = this._languageService.findDefinition(document, position, stylesheet);
|
let definition = this._languageService.findDefinition(document, position, stylesheet);
|
||||||
return Promise.as(definition);
|
return Promise.as(definition);
|
||||||
}
|
}
|
||||||
findReferences(uri: string, position: ls.Position): Promise<ls.Location[]> {
|
findReferences(uri: string, position: ls.Position): Thenable<ls.Location[]> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let stylesheet = this._languageService.parseStylesheet(document);
|
let stylesheet = this._languageService.parseStylesheet(document);
|
||||||
let references = this._languageService.findReferences(document, position, stylesheet);
|
let references = this._languageService.findReferences(document, position, stylesheet);
|
||||||
return Promise.as(references);
|
return Promise.as(references);
|
||||||
}
|
}
|
||||||
findDocumentHighlights(uri: string, position: ls.Position): Promise<ls.DocumentHighlight[]> {
|
findDocumentHighlights(uri: string, position: ls.Position): Thenable<ls.DocumentHighlight[]> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let stylesheet = this._languageService.parseStylesheet(document);
|
let stylesheet = this._languageService.parseStylesheet(document);
|
||||||
let highlights = this._languageService.findDocumentHighlights(document, position, stylesheet);
|
let highlights = this._languageService.findDocumentHighlights(document, position, stylesheet);
|
||||||
return Promise.as(highlights);
|
return Promise.as(highlights);
|
||||||
}
|
}
|
||||||
findDocumentSymbols(uri: string): Promise<ls.SymbolInformation[]> {
|
findDocumentSymbols(uri: string): Thenable<ls.SymbolInformation[]> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let stylesheet = this._languageService.parseStylesheet(document);
|
let stylesheet = this._languageService.parseStylesheet(document);
|
||||||
let symbols = this._languageService.findDocumentSymbols(document, stylesheet);
|
let symbols = this._languageService.findDocumentSymbols(document, stylesheet);
|
||||||
return Promise.as(symbols);
|
return Promise.as(symbols);
|
||||||
}
|
}
|
||||||
doCodeActions(uri: string, range: ls.Range, context: ls.CodeActionContext): Promise<ls.Command[]> {
|
doCodeActions(uri: string, range: ls.Range, context: ls.CodeActionContext): Thenable<ls.Command[]> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let stylesheet = this._languageService.parseStylesheet(document);
|
let stylesheet = this._languageService.parseStylesheet(document);
|
||||||
let actions = this._languageService.doCodeActions(document, range, context, stylesheet);
|
let actions = this._languageService.doCodeActions(document, range, context, stylesheet);
|
||||||
return Promise.as(actions);
|
return Promise.as(actions);
|
||||||
}
|
}
|
||||||
findDocumentColors(uri: string): Promise<cssService.ColorInformation[]> {
|
findDocumentColors(uri: string): Thenable<ls.ColorInformation[]> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let stylesheet = this._languageService.parseStylesheet(document);
|
let stylesheet = this._languageService.parseStylesheet(document);
|
||||||
let colorSymbols = this._languageService.findDocumentColors(document, stylesheet);
|
let colorSymbols = this._languageService.findDocumentColors(document, stylesheet);
|
||||||
return Promise.as(colorSymbols);
|
return Promise.as(colorSymbols);
|
||||||
}
|
}
|
||||||
getColorPresentations(uri: string, color: cssService.Color, range: ls.Range): Promise<cssService.ColorPresentation[]> {
|
getColorPresentations(uri: string, color: ls.Color, range: ls.Range): Thenable<ls.ColorPresentation[]> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let stylesheet = this._languageService.parseStylesheet(document);
|
let stylesheet = this._languageService.parseStylesheet(document);
|
||||||
let colorPresentations = this._languageService.getColorPresentations(document, stylesheet, color, range);
|
let colorPresentations = this._languageService.getColorPresentations(document, stylesheet, color, range);
|
||||||
return Promise.as(colorPresentations);
|
return Promise.as(colorPresentations);
|
||||||
}
|
}
|
||||||
provideFoldingRanges(uri: string, context?: { rangeLimit?: number; }): Promise<cssService.FoldingRange[]> {
|
provideFoldingRanges(uri: string, context?: { rangeLimit?: number; }): Thenable<ls.FoldingRange[]> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let ranges = this._languageService.getFoldingRanges(document, context);
|
let ranges = this._languageService.getFoldingRanges(document, context);
|
||||||
return Promise.as(ranges);
|
return Promise.as(ranges);
|
||||||
}
|
}
|
||||||
doRename(uri: string, position: ls.Position, newName: string): Promise<ls.WorkspaceEdit> {
|
doRename(uri: string, position: ls.Position, newName: string): Thenable<ls.WorkspaceEdit> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let stylesheet = this._languageService.parseStylesheet(document);
|
let stylesheet = this._languageService.parseStylesheet(document);
|
||||||
let renames = this._languageService.doRename(document, position, newName, stylesheet);
|
let renames = this._languageService.doRename(document, position, newName, stylesheet);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue