LanguageService

external interface LanguageService(source)

Properties

Link copied to clipboard
abstract external val toLineColumnOffset: (fileName: String, position: Double) -> LineAndCharacter?

Functions

Link copied to clipboard
Link copied to clipboard
abstract external fun cleanupSemanticCache()

This is used as a part of restarting the language service.

Link copied to clipboard
abstract external fun commentSelection(fileName: String, textRange: TextRange): ReadonlyArray<TextChange>
Link copied to clipboard
abstract external fun dispose()
Link copied to clipboard
abstract external fun findReferences(fileName: String, position: Double): ReadonlyArray<ReferencedSymbol>?
Link copied to clipboard
abstract external fun findRenameLocations(fileName: String, position: Double, findInStrings: Boolean, findInComments: Boolean, providePrefixAndSuffixTextForRename: Boolean = definedExternally): ReadonlyArray<RenameLocation>?
abstract external fun findRenameLocations(fileName: String, position: Double, findInStrings: Boolean, findInComments: Boolean, preferences: UserPreferences): ReadonlyArray<RenameLocation>?
Link copied to clipboard
abstract external fun getApplicableRefactors(fileName: String, positionOrRange: Double, preferences: UserPreferences?, triggerReason: RefactorTriggerReason = definedExternally, kind: String = definedExternally, includeInteractiveActions: Boolean = definedExternally): ReadonlyArray<ApplicableRefactorInfo>
abstract external fun getApplicableRefactors(fileName: String, positionOrRange: TextRange, preferences: UserPreferences?, triggerReason: RefactorTriggerReason = definedExternally, kind: String = definedExternally, includeInteractiveActions: Boolean = definedExternally): ReadonlyArray<ApplicableRefactorInfo>
Link copied to clipboard
abstract external fun getBraceMatchingAtPosition(fileName: String, position: Double): ReadonlyArray<TextSpan>
Link copied to clipboard
abstract external fun getBreakpointStatementAtPosition(fileName: String, position: Double): TextSpan?
Link copied to clipboard
abstract external fun getCodeFixesAtPosition(fileName: String, start: Double, end: Double, errorCodes: ReadonlyArray<Double>, formatOptions: FormatCodeSettings, preferences: UserPreferences): ReadonlyArray<CodeFixAction>
Link copied to clipboard
abstract external fun getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: Any, formatOptions: FormatCodeSettings, preferences: UserPreferences): CombinedCodeActions
Link copied to clipboard

Gets global diagnostics related to the program configuration and compiler options.

Link copied to clipboard
abstract external fun getCompletionEntryDetails(fileName: String, position: Double, entryName: String, formatOptions: FormatCodeOptions?, source: String?, preferences: UserPreferences?, data: CompletionEntryData?): CompletionEntryDetails?
abstract external fun getCompletionEntryDetails(fileName: String, position: Double, entryName: String, formatOptions: FormatCodeSettings?, source: String?, preferences: UserPreferences?, data: CompletionEntryData?): CompletionEntryDetails?

Gets the extended details for a completion entry retrieved from getCompletionsAtPosition.

Link copied to clipboard
abstract external fun getCompletionEntrySymbol(fileName: String, position: Double, name: String, source: String?): Symbol?
Link copied to clipboard
abstract external fun getCompletionsAtPosition(fileName: String, position: Double, options: GetCompletionsAtPositionOptions?, formattingSettings: FormatCodeSettings = definedExternally): WithMetadata<CompletionInfo>?

Gets completion entries at a particular position in a file.

Link copied to clipboard
abstract external fun getDefinitionAndBoundSpan(fileName: String, position: Double): DefinitionInfoAndBoundSpan?
Link copied to clipboard
abstract external fun getDefinitionAtPosition(fileName: String, position: Double): ReadonlyArray<DefinitionInfo>?
Link copied to clipboard
abstract external fun getDocCommentTemplateAtPosition(fileName: String, position: Double, options: DocCommentTemplateOptions = definedExternally, formatOptions: FormatCodeSettings = definedExternally): TextInsertion?
Link copied to clipboard
abstract external fun getDocumentHighlights(fileName: String, position: Double, filesToSearch: ReadonlyArray<String>): ReadonlyArray<DocumentHighlights>?
Link copied to clipboard
abstract external fun getEditsForFileRename(oldFilePath: String, newFilePath: String, formatOptions: FormatCodeSettings, preferences: UserPreferences?): ReadonlyArray<FileTextChanges>
Link copied to clipboard
abstract external fun getEditsForRefactor(fileName: String, formatOptions: FormatCodeSettings, positionOrRange: Double, refactorName: String, actionName: String, preferences: UserPreferences?, interactiveRefactorArguments: InteractiveRefactorArguments = definedExternally): RefactorEditInfo?
abstract external fun getEditsForRefactor(fileName: String, formatOptions: FormatCodeSettings, positionOrRange: TextRange, refactorName: String, actionName: String, preferences: UserPreferences?, interactiveRefactorArguments: InteractiveRefactorArguments = definedExternally): RefactorEditInfo?
Link copied to clipboard
abstract external fun getEmitOutput(fileName: String, emitOnlyDtsFiles: Boolean = definedExternally, forceDtsEmit: Boolean = definedExternally): EmitOutput
Link copied to clipboard
abstract external fun getEncodedSemanticClassifications(fileName: String, span: TextSpan, format: SemanticClassificationFormat = definedExternally): Classifications

Gets semantic highlights information for a particular file. Has two formats, an older version used by VS and a format used by VS Code.

Link copied to clipboard
abstract external fun getEncodedSyntacticClassifications(fileName: String, span: TextSpan): Classifications

Encoded as triples of start, length, ClassificationType.

Link copied to clipboard
abstract external fun getFileReferences(fileName: String): ReadonlyArray<ReferenceEntry>
Link copied to clipboard
abstract external fun getFormattingEditsAfterKeystroke(fileName: String, position: Double, key: String, options: FormatCodeOptions): ReadonlyArray<TextChange>
abstract external fun getFormattingEditsAfterKeystroke(fileName: String, position: Double, key: String, options: FormatCodeSettings): ReadonlyArray<TextChange>
Link copied to clipboard
Link copied to clipboard
abstract external fun getFormattingEditsForRange(fileName: String, start: Double, end: Double, options: FormatCodeOptions): ReadonlyArray<TextChange>
abstract external fun getFormattingEditsForRange(fileName: String, start: Double, end: Double, options: FormatCodeSettings): ReadonlyArray<TextChange>
Link copied to clipboard
abstract external fun getImplementationAtPosition(fileName: String, position: Double): ReadonlyArray<ImplementationLocation>?
Link copied to clipboard
abstract external fun getIndentationAtPosition(fileName: String, position: Double, options: EditorOptions): Double
abstract external fun getIndentationAtPosition(fileName: String, position: Double, options: EditorSettings): Double
Link copied to clipboard
abstract external fun getJsxClosingTagAtPosition(fileName: String, position: Double): JsxClosingTagInfo?

This will return a defined result if the position is after the > of the opening tag, or somewhere in the text, of a JSXElement with no closing tag. Editors should call this after > is typed.

Link copied to clipboard
abstract external fun getLinkedEditingRangeAtPosition(fileName: String, position: Double): LinkedEditingInfo?
Link copied to clipboard
abstract external fun getMoveToRefactoringFileSuggestions(fileName: String, positionOrRange: Double, preferences: UserPreferences?, triggerReason: RefactorTriggerReason = definedExternally, kind: String = definedExternally): LanguageServiceGetMoveToRefactoringFileSuggestionsResult
abstract external fun getMoveToRefactoringFileSuggestions(fileName: String, positionOrRange: TextRange, preferences: UserPreferences?, triggerReason: RefactorTriggerReason = definedExternally, kind: String = definedExternally): LanguageServiceGetMoveToRefactoringFileSuggestionsResult
Link copied to clipboard
abstract external fun getNameOrDottedNameSpan(fileName: String, startPos: Double, endPos: Double): TextSpan?
Link copied to clipboard
abstract external fun getNavigateToItems(searchValue: String, maxResultCount: Double = definedExternally, fileName: String = definedExternally, excludeDtsFiles: Boolean = definedExternally, excludeLibFiles: Boolean = definedExternally): ReadonlyArray<NavigateToItem>
Link copied to clipboard
abstract external fun getNavigationBarItems(fileName: String): ReadonlyArray<NavigationBarItem>
Link copied to clipboard
abstract external fun getNavigationTree(fileName: String): NavigationTree
Link copied to clipboard
abstract external fun getOutliningSpans(fileName: String): ReadonlyArray<OutliningSpan>
Link copied to clipboard
abstract external fun getPasteEdits(args: PasteEditsArgs, formatOptions: FormatCodeSettings): PasteEdits
Link copied to clipboard
abstract external fun getProgram(): Program?
Link copied to clipboard
abstract external fun getQuickInfoAtPosition(fileName: String, position: Double, maximumLength: Double = definedExternally): QuickInfo?

Gets semantic information about the identifier at a particular position in a file. Quick info is what you typically see when you hover in an editor.

Link copied to clipboard
abstract external fun getReferencesAtPosition(fileName: String, position: Double): ReadonlyArray<ReferenceEntry>?
Link copied to clipboard
abstract external fun getRenameInfo(fileName: String, position: Double, options: RenameInfoOptions = definedExternally): RenameInfo
abstract external fun getRenameInfo(fileName: String, position: Double, preferences: UserPreferences): RenameInfo
Link copied to clipboard
abstract external fun getSemanticClassifications(fileName: String, span: TextSpan): ReadonlyArray<ClassifiedSpan>
abstract external fun getSemanticClassifications(fileName: String, span: TextSpan, format: SemanticClassificationFormat): Any
Link copied to clipboard
abstract external fun getSemanticDiagnostics(fileName: String): ReadonlyArray<Diagnostic>

Gets warnings or errors indicating type system issues in a given file. Requesting semantic diagnostics may start up the type system and run deferred work, so the first call may take longer than subsequent calls.

Link copied to clipboard
abstract external fun getSignatureHelpItems(fileName: String, position: Double, options: SignatureHelpItemsOptions?): SignatureHelpItems?
Link copied to clipboard
abstract external fun getSmartSelectionRange(fileName: String, position: Double): SelectionRange
Link copied to clipboard
abstract external fun getSpanOfEnclosingComment(fileName: String, position: Double, onlyMultiLine: Boolean): TextSpan?
Link copied to clipboard

Gets suggestion diagnostics for a specific file. These diagnostics tend to proactively suggest refactors, as opposed to diagnostics that indicate potentially incorrect runtime behavior.

Link copied to clipboard
abstract external fun getSupportedCodeFixes(fileName: String = definedExternally): ReadonlyArray<String>
Link copied to clipboard
abstract external fun getSyntacticClassifications(fileName: String, span: TextSpan): ReadonlyArray<ClassifiedSpan>
abstract external fun getSyntacticClassifications(fileName: String, span: TextSpan, format: SemanticClassificationFormat): Any
Link copied to clipboard

Gets errors indicating invalid syntax in a file.

Link copied to clipboard
abstract external fun getTodoComments(fileName: String, descriptors: ReadonlyArray<TodoCommentDescriptor>): ReadonlyArray<TodoComment>
Link copied to clipboard
abstract external fun getTypeDefinitionAtPosition(fileName: String, position: Double): ReadonlyArray<DefinitionInfo>?
Link copied to clipboard
abstract external fun isValidBraceCompletionAtPosition(fileName: String, position: Double, openingBrace: Double): Boolean
Link copied to clipboard
abstract external fun organizeImports(args: OrganizeImportsArgs, formatOptions: FormatCodeSettings, preferences: UserPreferences?): ReadonlyArray<FileTextChanges>
Link copied to clipboard
abstract external fun prepareCallHierarchy(fileName: String, position: Double): Any?
Link copied to clipboard
abstract external fun preparePasteEditsForFile(fileName: String, copiedTextRanges: ReadonlyArray<TextRange>): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract external fun provideInlayHints(fileName: String, span: TextSpan, preferences: UserPreferences?): ReadonlyArray<InlayHint>
Link copied to clipboard
abstract external fun toggleLineComment(fileName: String, textRange: TextRange): ReadonlyArray<TextChange>
Link copied to clipboard
abstract external fun toggleMultilineComment(fileName: String, textRange: TextRange): ReadonlyArray<TextChange>
Link copied to clipboard
abstract external fun uncommentSelection(fileName: String, textRange: TextRange): ReadonlyArray<TextChange>