mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
Fix formatting
This commit is contained in:
parent
3155a06129
commit
9d724f1e05
1 changed files with 14 additions and 14 deletions
|
|
@ -24,14 +24,14 @@ class PromiseAdapter<T> implements jsonService.Thenable<T> {
|
||||||
public getWrapped(): monaco.Promise<T> {
|
public getWrapped(): monaco.Promise<T> {
|
||||||
return this.wrapped;
|
return this.wrapped;
|
||||||
}
|
}
|
||||||
public cancel() : void {
|
public cancel(): void {
|
||||||
this.wrapped.cancel();
|
this.wrapped.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static resolve<T>(v: T) : jsonService.Thenable<T> {
|
public static resolve<T>(v: T): jsonService.Thenable<T> {
|
||||||
return monaco.Promise.as(v);
|
return monaco.Promise.as(v);
|
||||||
}
|
}
|
||||||
public static reject<T>(v: T) : jsonService.Thenable<T> {
|
public static reject<T>(v: T): jsonService.Thenable<T> {
|
||||||
return monaco.Promise.wrapError(v);
|
return monaco.Promise.wrapError(v);
|
||||||
}
|
}
|
||||||
public static all<T>(values: jsonService.Thenable<T>[]): jsonService.Thenable<T[]> {
|
public static all<T>(values: jsonService.Thenable<T>[]): jsonService.Thenable<T[]> {
|
||||||
|
|
@ -39,7 +39,7 @@ class PromiseAdapter<T> implements jsonService.Thenable<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toMonacoPromise<R>(thenable: jsonService.Thenable<R>) : Thenable<R> {
|
function toMonacoPromise<R>(thenable: jsonService.Thenable<R>): Thenable<R> {
|
||||||
if (thenable instanceof PromiseAdapter) {
|
if (thenable instanceof PromiseAdapter) {
|
||||||
return thenable.getWrapped();
|
return thenable.getWrapped();
|
||||||
}
|
}
|
||||||
|
|
@ -48,12 +48,12 @@ function toMonacoPromise<R>(thenable: jsonService.Thenable<R>) : Thenable<R> {
|
||||||
|
|
||||||
export class JSONWorker {
|
export class JSONWorker {
|
||||||
|
|
||||||
private _ctx:IWorkerContext;
|
private _ctx: IWorkerContext;
|
||||||
private _languageService: jsonService.LanguageService;
|
private _languageService: jsonService.LanguageService;
|
||||||
private _languageSettings: jsonService.LanguageSettings;
|
private _languageSettings: jsonService.LanguageSettings;
|
||||||
private _languageId: string;
|
private _languageId: string;
|
||||||
|
|
||||||
constructor(ctx:IWorkerContext, createData: ICreateData) {
|
constructor(ctx: IWorkerContext, createData: ICreateData) {
|
||||||
this._ctx = ctx;
|
this._ctx = ctx;
|
||||||
this._languageSettings = createData.languageSettings;
|
this._languageSettings = createData.languageSettings;
|
||||||
this._languageId = createData.languageId;
|
this._languageId = createData.languageId;
|
||||||
|
|
@ -61,7 +61,7 @@ export class JSONWorker {
|
||||||
this._languageService.configure(this._languageSettings);
|
this._languageService.configure(this._languageSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
doValidation(uri: string): Thenable<ls.Diagnostic[]> {
|
doValidation(uri: string): Thenable<ls.Diagnostic[]> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
if (document) {
|
if (document) {
|
||||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||||
|
|
@ -69,28 +69,28 @@ export class JSONWorker {
|
||||||
}
|
}
|
||||||
return Promise.as([]);
|
return Promise.as([]);
|
||||||
}
|
}
|
||||||
doComplete(uri: string, position: ls.Position): Thenable<ls.CompletionList> {
|
doComplete(uri: string, position: ls.Position): Thenable<ls.CompletionList> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||||
return this._languageService.doComplete(document, position, jsonDocument);
|
return this._languageService.doComplete(document, position, jsonDocument);
|
||||||
}
|
}
|
||||||
doResolve(item: ls.CompletionItem): Thenable<ls.CompletionItem> {
|
doResolve(item: ls.CompletionItem): Thenable<ls.CompletionItem> {
|
||||||
return this._languageService.doResolve(item);
|
return this._languageService.doResolve(item);
|
||||||
}
|
}
|
||||||
doHover(uri: string, position: ls.Position): Thenable<ls.Hover> {
|
doHover(uri: string, position: ls.Position): Thenable<ls.Hover> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||||
return this._languageService.doHover(document, position, jsonDocument);
|
return this._languageService.doHover(document, position, jsonDocument);
|
||||||
}
|
}
|
||||||
format(uri: string, range: ls.Range, options: ls.FormattingOptions): Thenable<ls.TextEdit[]> {
|
format(uri: string, range: ls.Range, options: ls.FormattingOptions): Thenable<ls.TextEdit[]> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let textEdits = this._languageService.format(document, range, options);
|
let textEdits = this._languageService.format(document, range, options);
|
||||||
return Promise.as(textEdits);
|
return Promise.as(textEdits);
|
||||||
}
|
}
|
||||||
resetSchema(uri: string): Thenable<boolean> {
|
resetSchema(uri: string): Thenable<boolean> {
|
||||||
return Promise.as(this._languageService.resetSchema(uri));
|
return Promise.as(this._languageService.resetSchema(uri));
|
||||||
}
|
}
|
||||||
findDocumentSymbols(uri: string): Promise<ls.SymbolInformation[]> {
|
findDocumentSymbols(uri: string): Promise<ls.SymbolInformation[]> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||||
let symbols = this._languageService.findDocumentSymbols(document, jsonDocument);
|
let symbols = this._languageService.findDocumentSymbols(document, jsonDocument);
|
||||||
|
|
@ -112,6 +112,6 @@ export interface ICreateData {
|
||||||
languageSettings: jsonService.LanguageSettings;
|
languageSettings: jsonService.LanguageSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function create(ctx:IWorkerContext, createData: ICreateData): JSONWorker {
|
export function create(ctx: IWorkerContext, createData: ICreateData): JSONWorker {
|
||||||
return new JSONWorker(ctx, createData);
|
return new JSONWorker(ctx, createData);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue