Module

x/ts_morph/mod.ts>LanguageService

TypeScript Compiler API wrapper for static analysis and programmatic code changes.
Go to Latest
class LanguageService
import { LanguageService } from "https://dotland.deno.dev/x/ts_morph@17.0.0/mod.ts";

Constructors

new
private
LanguageService()

Properties

readonly
compilerObject: ts.LanguageService

Gets the compiler language service.

Methods

Finds references based on the specified node.

findReferencesAsNodes(node: Node): Node<ts.Node>[]

Finds the nodes that reference the definition(s) of the specified node.

Finds references based on the specified position.

Find the rename locations for the specified node.

getCodeFixesAtPosition(
filePathOrSourceFile: string | SourceFile,
start: number,
end: number,
errorCodes: ReadonlyArray<number>,
formatOptions?: FormatCodeSettings,
preferences?: UserPreferences,
): CodeFixAction[]

Gets the edit information for applying a code fix at the provided text range in a source file.

getCombinedCodeFix(
filePathOrSourceFile: string | SourceFile,
fixId: { },
formatSettings?: FormatCodeSettings,
preferences?: UserPreferences,
): CombinedCodeActions

Gets file changes and actions to perform for the provided fixId.

Gets the definitions for the specified node.

Gets the definitions at the specified position.

getEditsForRefactor(
filePathOrSourceFile: string | SourceFile,
formatSettings: FormatCodeSettings,
positionOrRange: number | { getPos(): number; getEnd(): number; },
refactorName: string,
actionName: string,
preferences?: UserPreferences,
): RefactorEditInfo | undefined

Gets the edit information for applying a refactor at a the provided position in a source file.

getEmitOutput(sourceFile: SourceFile, emitOnlyDtsFiles?: boolean): EmitOutput

Gets the emit output of a source file.

getEmitOutput(filePath: string, emitOnlyDtsFiles?: boolean): EmitOutput

Gets the emit output of a source file.

getFormattedDocumentText(filePath: string, formatSettings: FormatCodeSettings): string

Gets the formatted text for a document.

getFormattingEditsForDocument(filePath: string, formatSettings: FormatCodeSettings): TextChange[]

Gets the formatting edits for a document.

getFormattingEditsForRange(
filePath: string,
range: [number, number],
formatSettings: FormatCodeSettings,
): TextChange[]

Gets the formatting edits for a range.

getIdentationAtPosition(
sourceFile: SourceFile,
position: number,
settings?: EditorSettings,
): number

Gets the indentation at the specified position.

getIdentationAtPosition(
filePath: string,
position: number,
settings?: EditorSettings,
): number

Gets the indentation at the specified position.

Gets the implementations for the specified node.

Gets the implementations at the specified position.

Gets the language service's program.

Gets the suggestion diagnostics.

organizeImports(
sourceFile: SourceFile,
formatSettings?: FormatCodeSettings,
userPreferences?: UserPreferences,
): FileTextChanges[]

Gets the file text changes for organizing the imports in a source file.

organizeImports(
filePath: string,
formatSettings?: FormatCodeSettings,
userPreferences?: UserPreferences,
): FileTextChanges[]

Gets the file text changes for organizing the imports in a source file.