Improve monaco.d.ts documentation

This commit is contained in:
Alex Dima
2016-06-11 13:54:13 +02:00
parent 6588d5fe1d
commit eca3662d6b
55 changed files with 2380 additions and 525 deletions

View File

@@ -293,7 +293,7 @@ class QuickFixAdapter {
this._provider = provider;
}
provideCodeActions(resource: URI, range: IRange): TPromise<modes.IQuickFix[]> {
provideCodeActions(resource: URI, range: IRange): TPromise<modes.CodeAction[]> {
const doc = this._documents.getDocumentData(resource).document;
const ran = TypeConverters.toRange(range);
@@ -316,7 +316,7 @@ class QuickFixAdapter {
return;
}
return commands.map((command, i) => {
return <modes.IQuickFix> {
return <modes.CodeAction> {
command: TypeConverters.Command.from(command, this._cachedCommands),
score: i
};
@@ -335,7 +335,7 @@ class DocumentFormattingAdapter {
this._provider = provider;
}
provideDocumentFormattingEdits(resource: URI, options: modes.IFormattingOptions): TPromise<ISingleEditOperation[]> {
provideDocumentFormattingEdits(resource: URI, options: modes.FormattingOptions): TPromise<ISingleEditOperation[]> {
let doc = this._documents.getDocumentData(resource).document;
@@ -357,7 +357,7 @@ class RangeFormattingAdapter {
this._provider = provider;
}
provideDocumentRangeFormattingEdits(resource: URI, range: IRange, options: modes.IFormattingOptions): TPromise<ISingleEditOperation[]> {
provideDocumentRangeFormattingEdits(resource: URI, range: IRange, options: modes.FormattingOptions): TPromise<ISingleEditOperation[]> {
let doc = this._documents.getDocumentData(resource).document;
let ran = TypeConverters.toRange(range);
@@ -382,7 +382,7 @@ class OnTypeFormattingAdapter {
autoFormatTriggerCharacters: string[] = []; // not here
provideOnTypeFormattingEdits(resource: URI, position: IPosition, ch: string, options: modes.IFormattingOptions): TPromise<ISingleEditOperation[]> {
provideOnTypeFormattingEdits(resource: URI, position: IPosition, ch: string, options: modes.FormattingOptions): TPromise<ISingleEditOperation[]> {
let doc = this._documents.getDocumentData(resource).document;
let pos = TypeConverters.toPosition(position);
@@ -722,7 +722,7 @@ export class ExtHostLanguageFeatures {
return this._createDisposable(handle);
}
$provideCodeActions(handle: number, resource: URI, range: IRange): TPromise<modes.IQuickFix[]> {
$provideCodeActions(handle: number, resource: URI, range: IRange): TPromise<modes.CodeAction[]> {
return this._withAdapter(handle, QuickFixAdapter, adapter => adapter.provideCodeActions(resource, range));
}
@@ -735,7 +735,7 @@ export class ExtHostLanguageFeatures {
return this._createDisposable(handle);
}
$provideDocumentFormattingEdits(handle: number, resource: URI, options: modes.IFormattingOptions): TPromise<ISingleEditOperation[]> {
$provideDocumentFormattingEdits(handle: number, resource: URI, options: modes.FormattingOptions): TPromise<ISingleEditOperation[]> {
return this._withAdapter(handle, DocumentFormattingAdapter, adapter => adapter.provideDocumentFormattingEdits(resource, options));
}
@@ -746,7 +746,7 @@ export class ExtHostLanguageFeatures {
return this._createDisposable(handle);
}
$provideDocumentRangeFormattingEdits(handle: number, resource: URI, range: IRange, options: modes.IFormattingOptions): TPromise<ISingleEditOperation[]> {
$provideDocumentRangeFormattingEdits(handle: number, resource: URI, range: IRange, options: modes.FormattingOptions): TPromise<ISingleEditOperation[]> {
return this._withAdapter(handle, RangeFormattingAdapter, adapter => adapter.provideDocumentRangeFormattingEdits(resource, range, options));
}
@@ -757,7 +757,7 @@ export class ExtHostLanguageFeatures {
return this._createDisposable(handle);
}
$provideOnTypeFormattingEdits(handle: number, resource: URI, position: IPosition, ch: string, options: modes.IFormattingOptions): TPromise<ISingleEditOperation[]> {
$provideOnTypeFormattingEdits(handle: number, resource: URI, position: IPosition, ch: string, options: modes.FormattingOptions): TPromise<ISingleEditOperation[]> {
return this._withAdapter(handle, OnTypeFormattingAdapter, adapter => adapter.provideOnTypeFormattingEdits(resource, position, ch, options));
}
@@ -910,7 +910,7 @@ export class MainThreadLanguageFeatures {
$registerQuickFixSupport(handle: number, selector: vscode.DocumentSelector): TPromise<any> {
this._registrations[handle] = modes.CodeActionProviderRegistry.register(selector, <modes.CodeActionProvider>{
provideCodeActions: (model:IReadOnlyModel, range:EditorRange, token: CancellationToken): Thenable<modes.IQuickFix[]> => {
provideCodeActions: (model:IReadOnlyModel, range:EditorRange, token: CancellationToken): Thenable<modes.CodeAction[]> => {
return wireCancellationToken(token, this._proxy.$provideCodeActions(handle, model.uri, range));
}
});
@@ -921,7 +921,7 @@ export class MainThreadLanguageFeatures {
$registerDocumentFormattingSupport(handle: number, selector: vscode.DocumentSelector): TPromise<any> {
this._registrations[handle] = modes.DocumentFormattingEditProviderRegistry.register(selector, <modes.DocumentFormattingEditProvider>{
provideDocumentFormattingEdits: (model: IReadOnlyModel, options: modes.IFormattingOptions, token: CancellationToken): Thenable<ISingleEditOperation[]> => {
provideDocumentFormattingEdits: (model: IReadOnlyModel, options: modes.FormattingOptions, token: CancellationToken): Thenable<ISingleEditOperation[]> => {
return wireCancellationToken(token, this._proxy.$provideDocumentFormattingEdits(handle, model.uri, options));
}
});
@@ -930,7 +930,7 @@ export class MainThreadLanguageFeatures {
$registerRangeFormattingSupport(handle: number, selector: vscode.DocumentSelector): TPromise<any> {
this._registrations[handle] = modes.DocumentRangeFormattingEditProviderRegistry.register(selector, <modes.DocumentRangeFormattingEditProvider>{
provideDocumentRangeFormattingEdits: (model: IReadOnlyModel, range: EditorRange, options: modes.IFormattingOptions, token: CancellationToken): Thenable<ISingleEditOperation[]> => {
provideDocumentRangeFormattingEdits: (model: IReadOnlyModel, range: EditorRange, options: modes.FormattingOptions, token: CancellationToken): Thenable<ISingleEditOperation[]> => {
return wireCancellationToken(token, this._proxy.$provideDocumentRangeFormattingEdits(handle, model.uri, range, options));
}
});
@@ -942,7 +942,7 @@ export class MainThreadLanguageFeatures {
autoFormatTriggerCharacters,
provideOnTypeFormattingEdits: (model: IReadOnlyModel, position: EditorPosition, ch: string, options: modes.IFormattingOptions, token: CancellationToken): Thenable<ISingleEditOperation[]> => {
provideOnTypeFormattingEdits: (model: IReadOnlyModel, position: EditorPosition, ch: string, options: modes.FormattingOptions, token: CancellationToken): Thenable<ISingleEditOperation[]> => {
return wireCancellationToken(token, this._proxy.$provideOnTypeFormattingEdits(handle, model.uri, position, ch, options));
}
});

View File

@@ -367,13 +367,13 @@ export namespace Command {
});
}
export function from(command: vscode.Command, disposables: IDisposable[]): modes.ICommand {
export function from(command: vscode.Command, disposables: IDisposable[]): modes.Command {
if (!command) {
return;
}
const result = <modes.ICommand>{
const result = <modes.Command>{
id: command.command,
title: command.title
};
@@ -397,7 +397,7 @@ export namespace Command {
return result;
}
export function to(command: modes.ICommand): vscode.Command {
export function to(command: modes.Command): vscode.Command {
let result: vscode.Command;
if (command.id === _delegateId) {
let [key] = command.arguments;