mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 07:00:11 +01:00
fix: Provide the missing parameters for the tsWorker.
This commit is contained in:
parent
21007360ca
commit
0d3542914b
3 changed files with 53 additions and 20 deletions
|
|
@ -459,7 +459,7 @@ export class SuggestAdapter extends Adapter implements languages.CompletionItemP
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const info = await worker.getCompletionsAtPosition(resource.toString(), offset);
|
const info = await worker.getCompletionsAtPosition(resource.toString(), offset, undefined);
|
||||||
|
|
||||||
if (!info || model.isDisposed()) {
|
if (!info || model.isDisposed()) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -509,7 +509,11 @@ export class SuggestAdapter extends Adapter implements languages.CompletionItemP
|
||||||
const details = await worker.getCompletionEntryDetails(
|
const details = await worker.getCompletionEntryDetails(
|
||||||
resource.toString(),
|
resource.toString(),
|
||||||
offset,
|
offset,
|
||||||
myItem.label
|
myItem.label,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
undefined
|
||||||
);
|
);
|
||||||
if (!details) {
|
if (!details) {
|
||||||
return myItem;
|
return myItem;
|
||||||
|
|
@ -1099,7 +1103,8 @@ export class CodeActionAdaptor extends FormatHelper implements languages.CodeAct
|
||||||
start,
|
start,
|
||||||
end,
|
end,
|
||||||
errorCodes,
|
errorCodes,
|
||||||
formatOptions
|
formatOptions,
|
||||||
|
{}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!codeFixes || model.isDisposed()) {
|
if (!codeFixes || model.isDisposed()) {
|
||||||
|
|
|
||||||
|
|
@ -414,22 +414,37 @@ export interface TypeScriptWorker {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get code completions for the given file and position.
|
* Get code completions for the given file and position.
|
||||||
|
* @param options `typescript.GetCompletionsAtPositionOptions | undefined`
|
||||||
|
* @param formattingSettings `typescript.FormatCodeSettings`
|
||||||
* @returns `Promise<typescript.CompletionInfo | undefined>`
|
* @returns `Promise<typescript.CompletionInfo | undefined>`
|
||||||
*/
|
*/
|
||||||
getCompletionsAtPosition(fileName: string, position: number): Promise<any | undefined>;
|
getCompletionsAtPosition(
|
||||||
|
fileName: string,
|
||||||
|
position: number,
|
||||||
|
options: any,
|
||||||
|
formattingSettings?: any
|
||||||
|
): Promise<any | undefined>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get code completion details for the given file, position, and entry.
|
* Get code completion details for the given file, position, and entry.
|
||||||
|
* @param formatOptions `typescript.FormatCodeOptions | typescript.FormatCodeSettings | undefined`
|
||||||
|
* @param preferences `typescript.UserPreferences | undefined`
|
||||||
|
* @param data `typescript.CompletionEntryData | undefined`
|
||||||
* @returns `Promise<typescript.CompletionEntryDetails | undefined>`
|
* @returns `Promise<typescript.CompletionEntryDetails | undefined>`
|
||||||
*/
|
*/
|
||||||
getCompletionEntryDetails(
|
getCompletionEntryDetails(
|
||||||
fileName: string,
|
fileName: string,
|
||||||
position: number,
|
position: number,
|
||||||
entry: string
|
entryName: string,
|
||||||
|
formatOptions: any,
|
||||||
|
source: string | undefined,
|
||||||
|
preferences: any,
|
||||||
|
data: any
|
||||||
): Promise<any | undefined>;
|
): Promise<any | undefined>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get signature help items for the item at the given file and position.
|
* Get signature help items for the item at the given file and position.
|
||||||
|
* @param options `typescript.SignatureHelpItemsOptions | undefined`
|
||||||
* @returns `Promise<typescript.SignatureHelpItems | undefined>`
|
* @returns `Promise<typescript.SignatureHelpItems | undefined>`
|
||||||
*/
|
*/
|
||||||
getSignatureHelpItems(fileName: string, position: number, options: any): Promise<any | undefined>;
|
getSignatureHelpItems(fileName: string, position: number, options: any): Promise<any | undefined>;
|
||||||
|
|
@ -526,6 +541,7 @@ export interface TypeScriptWorker {
|
||||||
/**
|
/**
|
||||||
* Get possible code fixes at the given position in the file.
|
* Get possible code fixes at the given position in the file.
|
||||||
* @param formatOptions `typescript.FormatCodeOptions`
|
* @param formatOptions `typescript.FormatCodeOptions`
|
||||||
|
* @param preferences `typescript.UserPreferences`
|
||||||
* @returns `Promise<ReadonlyArray<typescript.CodeFixAction>>`
|
* @returns `Promise<ReadonlyArray<typescript.CodeFixAction>>`
|
||||||
*/
|
*/
|
||||||
getCodeFixesAtPosition(
|
getCodeFixesAtPosition(
|
||||||
|
|
@ -533,7 +549,8 @@ export interface TypeScriptWorker {
|
||||||
start: number,
|
start: number,
|
||||||
end: number,
|
end: number,
|
||||||
errorCodes: number[],
|
errorCodes: number[],
|
||||||
formatOptions: any
|
formatOptions: any,
|
||||||
|
preferences: any
|
||||||
): Promise<ReadonlyArray<any>>;
|
): Promise<ReadonlyArray<any>>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -254,27 +254,38 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, ITypeScriptWork
|
||||||
|
|
||||||
async getCompletionsAtPosition(
|
async getCompletionsAtPosition(
|
||||||
fileName: string,
|
fileName: string,
|
||||||
position: number
|
position: number,
|
||||||
): Promise<ts.CompletionInfo | undefined> {
|
options: ts.GetCompletionsAtPositionOptions | undefined,
|
||||||
|
formattingSettings?: ts.FormatCodeSettings
|
||||||
|
): Promise<ts.WithMetadata<ts.CompletionInfo> | undefined> {
|
||||||
if (fileNameIsLib(fileName)) {
|
if (fileNameIsLib(fileName)) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return this._languageService.getCompletionsAtPosition(fileName, position, undefined);
|
return this._languageService.getCompletionsAtPosition(
|
||||||
|
fileName,
|
||||||
|
position,
|
||||||
|
options,
|
||||||
|
formattingSettings
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCompletionEntryDetails(
|
async getCompletionEntryDetails(
|
||||||
fileName: string,
|
fileName: string,
|
||||||
position: number,
|
position: number,
|
||||||
entry: string
|
entryName: string,
|
||||||
|
formatOptions: ts.FormatCodeOptions | ts.FormatCodeSettings | undefined,
|
||||||
|
source: string | undefined,
|
||||||
|
preferences: ts.UserPreferences | undefined,
|
||||||
|
data: ts.CompletionEntryData | undefined
|
||||||
): Promise<ts.CompletionEntryDetails | undefined> {
|
): Promise<ts.CompletionEntryDetails | undefined> {
|
||||||
return this._languageService.getCompletionEntryDetails(
|
return this._languageService.getCompletionEntryDetails(
|
||||||
fileName,
|
fileName,
|
||||||
position,
|
position,
|
||||||
entry,
|
entryName,
|
||||||
undefined,
|
formatOptions,
|
||||||
undefined,
|
source,
|
||||||
undefined,
|
preferences,
|
||||||
undefined
|
data
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -339,7 +350,7 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, ITypeScriptWork
|
||||||
|
|
||||||
async getFormattingEditsForDocument(
|
async getFormattingEditsForDocument(
|
||||||
fileName: string,
|
fileName: string,
|
||||||
options: ts.FormatCodeOptions
|
options: ts.FormatCodeOptions | ts.FormatCodeSettings
|
||||||
): Promise<ts.TextChange[]> {
|
): Promise<ts.TextChange[]> {
|
||||||
if (fileNameIsLib(fileName)) {
|
if (fileNameIsLib(fileName)) {
|
||||||
return [];
|
return [];
|
||||||
|
|
@ -351,7 +362,7 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, ITypeScriptWork
|
||||||
fileName: string,
|
fileName: string,
|
||||||
start: number,
|
start: number,
|
||||||
end: number,
|
end: number,
|
||||||
options: ts.FormatCodeOptions
|
options: ts.FormatCodeOptions | ts.FormatCodeSettings
|
||||||
): Promise<ts.TextChange[]> {
|
): Promise<ts.TextChange[]> {
|
||||||
if (fileNameIsLib(fileName)) {
|
if (fileNameIsLib(fileName)) {
|
||||||
return [];
|
return [];
|
||||||
|
|
@ -363,7 +374,7 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, ITypeScriptWork
|
||||||
fileName: string,
|
fileName: string,
|
||||||
postion: number,
|
postion: number,
|
||||||
ch: string,
|
ch: string,
|
||||||
options: ts.FormatCodeOptions
|
options: ts.FormatCodeOptions | ts.FormatCodeSettings
|
||||||
): Promise<ts.TextChange[]> {
|
): Promise<ts.TextChange[]> {
|
||||||
if (fileNameIsLib(fileName)) {
|
if (fileNameIsLib(fileName)) {
|
||||||
return [];
|
return [];
|
||||||
|
|
@ -413,12 +424,12 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, ITypeScriptWork
|
||||||
start: number,
|
start: number,
|
||||||
end: number,
|
end: number,
|
||||||
errorCodes: number[],
|
errorCodes: number[],
|
||||||
formatOptions: ts.FormatCodeOptions
|
formatOptions: ts.FormatCodeOptions | ts.FormatCodeSettings,
|
||||||
|
preferences: ts.UserPreferences
|
||||||
): Promise<ReadonlyArray<ts.CodeFixAction>> {
|
): Promise<ReadonlyArray<ts.CodeFixAction>> {
|
||||||
if (fileNameIsLib(fileName)) {
|
if (fileNameIsLib(fileName)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const preferences = {};
|
|
||||||
try {
|
try {
|
||||||
return this._languageService.getCodeFixesAtPosition(
|
return this._languageService.getCodeFixesAtPosition(
|
||||||
fileName,
|
fileName,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue