/// /** * A few types used by webapp/src/tsworker.ts * * These types should be exported by monaco-typescript, but they aren't */ declare namespace monaco.languages.typescript { export interface CustomTSWebWorkerFactory { ( TSWorkerClass: typeof TSWorker, tsc: any, libs: Record ): typeof TSWorker; } export interface ICreateData { compilerOptions: ts.CompilerOptions; extraLibs: IExtraLibs; customWorkerPath?: string; } export class TSWorker implements TypeScriptWorker { constructor(ctx: monaco.worker.IWorkerContext, createData: ICreateData); /** * Get diagnostic messages for any syntax issues in the given file. */ getSyntacticDiagnostics(fileName: string): Promise; /** * Get diagnostic messages for any semantic issues in the given file. */ getSemanticDiagnostics(fileName: string): Promise; /** * Get diagnostic messages for any suggestions related to the given file. */ getSuggestionDiagnostics(fileName: string): Promise; /** * Get the content of a given file. */ getScriptText(fileName: string): Promise; /** * Get diagnostic messages related to the current compiler options. * @param fileName Not used */ getCompilerOptionsDiagnostics(fileName: string): Promise; /** * Get code completions for the given file and position. * @returns `Promise` */ getCompletionsAtPosition(fileName: string, position: number): Promise; /** * Get code completion details for the given file, position, and entry. * @returns `Promise` */ getCompletionEntryDetails( fileName: string, position: number, entry: string ): Promise; /** * Get signature help items for the item at the given file and position. * @returns `Promise` */ getSignatureHelpItems( fileName: string, position: number, options: any ): Promise; /** * Get quick info for the item at the given position in the file. * @returns `Promise` */ getQuickInfoAtPosition(fileName: string, position: number): Promise; /** * Get other ranges which are related to the item at the given position in the file (often used for highlighting). * @returns `Promise | undefined>` */ getOccurrencesAtPosition( fileName: string, position: number ): Promise | undefined>; /** * Get the definition of the item at the given position in the file. * @returns `Promise | undefined>` */ getDefinitionAtPosition( fileName: string, position: number ): Promise | undefined>; /** * Get references to the item at the given position in the file. * @returns `Promise` */ getReferencesAtPosition(fileName: string, position: number): Promise; /** * Get outline entries for the item at the given position in the file. * @returns `Promise` */ getNavigationBarItems(fileName: string): Promise; /** * Get changes which should be applied to format the given file. * @param options `typescript.FormatCodeOptions` * @returns `Promise` */ getFormattingEditsForDocument(fileName: string, options: any): Promise; /** * Get changes which should be applied to format the given range in the file. * @param options `typescript.FormatCodeOptions` * @returns `Promise` */ getFormattingEditsForRange( fileName: string, start: number, end: number, options: any ): Promise; /** * Get formatting changes which should be applied after the given keystroke. * @param options `typescript.FormatCodeOptions` * @returns `Promise` */ getFormattingEditsAfterKeystroke( fileName: string, postion: number, ch: string, options: any ): Promise; /** * Get other occurrences which should be updated when renaming the item at the given file and position. * @returns `Promise` */ findRenameLocations( fileName: string, positon: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename: boolean ): Promise; /** * Get edits which should be applied to rename the item at the given file and position (or a failure reason). * @param options `typescript.RenameInfoOptions` * @returns `Promise` */ getRenameInfo(fileName: string, positon: number, options: any): Promise; /** * Get transpiled output for the given file. * @returns `typescript.EmitOutput` */ getEmitOutput(fileName: string): Promise; /** * Get possible code fixes at the given position in the file. * @param formatOptions `typescript.FormatCodeOptions` * @returns `Promise>` */ getCodeFixesAtPosition( fileName: string, start: number, end: number, errorCodes: number[], formatOptions: any ): Promise>; } }