LanguageService

sealed external interface LanguageService(source)

Properties

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

Functions

Link copied to clipboard
abstract fun cleanupSemanticCache()

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

Link copied to clipboard
abstract fun commentSelection(fileName: String, textRange: TextRange): ReadonlyArray<TextChange>
Link copied to clipboard
abstract fun dispose()
Link copied to clipboard
abstract fun findReferences(fileName: String, position: Double): ReadonlyArray<ReferencedSymbol>?
Link copied to clipboard
abstract fun findRenameLocations(fileName: String, position: Double, findInStrings: Boolean, findInComments: Boolean, providePrefixAndSuffixTextForRename: Boolean = definedExternally): ReadonlyArray<RenameLocation>?
abstract fun findRenameLocations(fileName: String, position: Double, findInStrings: Boolean, findInComments: Boolean, preferences: UserPreferences): ReadonlyArray<RenameLocation>?
Link copied to clipboard
abstract fun getApplicableRefactors(fileName: String, positionOrRange: Double, preferences: UserPreferences?, triggerReason: RefactorTriggerReason = definedExternally, kind: String = definedExternally, includeInteractiveActions: Boolean = definedExternally): ReadonlyArray<ApplicableRefactorInfo>
abstract fun getApplicableRefactors(fileName: String, positionOrRange: TextRange, preferences: UserPreferences?, triggerReason: RefactorTriggerReason = definedExternally, kind: String = definedExternally, includeInteractiveActions: Boolean = definedExternally): ReadonlyArray<ApplicableRefactorInfo>
Link copied to clipboard
abstract fun getBraceMatchingAtPosition(fileName: String, position: Double): ReadonlyArray<TextSpan>
Link copied to clipboard
abstract fun getBreakpointStatementAtPosition(fileName: String, position: Double): TextSpan?
Link copied to clipboard
abstract fun getCodeFixesAtPosition(fileName: String, start: Double, end: Double, errorCodes: ReadonlyArray<Double>, formatOptions: FormatCodeSettings, preferences: UserPreferences): ReadonlyArray<CodeFixAction>
Link copied to clipboard
abstract 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 fun getCompletionEntryDetails(fileName: String, position: Double, entryName: String, formatOptions: FormatCodeOptions?, source: String?, preferences: UserPreferences?, data: CompletionEntryData?): CompletionEntryDetails?
abstract 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 fun getCompletionEntrySymbol(fileName: String, position: Double, name: String, source: String?): Symbol?
Link copied to clipboard
abstract 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
Link copied to clipboard
abstract fun getDefinitionAtPosition(fileName: String, position: Double): ReadonlyArray<DefinitionInfo>?
Link copied to clipboard
abstract fun getDocCommentTemplateAtPosition(fileName: String, position: Double, options: DocCommentTemplateOptions = definedExternally, formatOptions: FormatCodeSettings = definedExternally): TextInsertion?
Link copied to clipboard
abstract fun getDocumentHighlights(fileName: String, position: Double, filesToSearch: ReadonlyArray<String>): ReadonlyArray<DocumentHighlights>?
Link copied to clipboard
abstract fun getEditsForFileRename(oldFilePath: String, newFilePath: String, formatOptions: FormatCodeSettings, preferences: UserPreferences?): ReadonlyArray<FileTextChanges>
Link copied to clipboard
abstract fun getEditsForRefactor(fileName: String, formatOptions: FormatCodeSettings, positionOrRange: Double, refactorName: String, actionName: String, preferences: UserPreferences?, interactiveRefactorArguments: InteractiveRefactorArguments = definedExternally): RefactorEditInfo?
abstract fun getEditsForRefactor(fileName: String, formatOptions: FormatCodeSettings, positionOrRange: TextRange, refactorName: String, actionName: String, preferences: UserPreferences?, interactiveRefactorArguments: InteractiveRefactorArguments = definedExternally): RefactorEditInfo?
Link copied to clipboard
abstract fun getEmitOutput(fileName: String, emitOnlyDtsFiles: Boolean = definedExternally, forceDtsEmit: Boolean = definedExternally): EmitOutput
Link copied to clipboard
abstract 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

Encoded as triples of start, length, ClassificationType.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract fun getIndentationAtPosition(fileName: String, position: Double, options: EditorOptions): Double
abstract fun getIndentationAtPosition(fileName: String, position: Double, options: EditorSettings): Double
Link copied to clipboard
abstract 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 fun getLinkedEditingRangeAtPosition(fileName: String, position: Double): LinkedEditingInfo?
Link copied to clipboard
abstract fun getMoveToRefactoringFileSuggestions(fileName: String, positionOrRange: Double, preferences: UserPreferences?, triggerReason: RefactorTriggerReason = definedExternally, kind: String = definedExternally): LanguageServiceGetMoveToRefactoringFileSuggestionsResult
abstract fun getMoveToRefactoringFileSuggestions(fileName: String, positionOrRange: TextRange, preferences: UserPreferences?, triggerReason: RefactorTriggerReason = definedExternally, kind: String = definedExternally): LanguageServiceGetMoveToRefactoringFileSuggestionsResult
Link copied to clipboard
abstract fun getNameOrDottedNameSpan(fileName: String, startPos: Double, endPos: Double): TextSpan?
Link copied to clipboard
abstract fun getNavigateToItems(searchValue: String, maxResultCount: Double = definedExternally, fileName: String = definedExternally, excludeDtsFiles: Boolean = definedExternally, excludeLibFiles: Boolean = definedExternally): ReadonlyArray<NavigateToItem>
Link copied to clipboard
Link copied to clipboard
abstract fun getNavigationTree(fileName: String): NavigationTree
Link copied to clipboard
Link copied to clipboard
abstract fun getProgram(): Program?
Link copied to clipboard
abstract fun getQuickInfoAtPosition(fileName: String, position: Double): 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 fun getReferencesAtPosition(fileName: String, position: Double): ReadonlyArray<ReferenceEntry>?
Link copied to clipboard
abstract fun getRenameInfo(fileName: String, position: Double, options: RenameInfoOptions = definedExternally): RenameInfo
abstract fun getRenameInfo(fileName: String, position: Double, preferences: UserPreferences): RenameInfo
Link copied to clipboard
Link copied to clipboard

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 fun getSignatureHelpItems(fileName: String, position: Double, options: SignatureHelpItemsOptions?): SignatureHelpItems?
Link copied to clipboard
abstract fun getSmartSelectionRange(fileName: String, position: Double): SelectionRange
Link copied to clipboard
abstract 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 fun getSupportedCodeFixes(fileName: String = definedExternally): ReadonlyArray<String>
Link copied to clipboard

Gets errors indicating invalid syntax in a file.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract fun isValidBraceCompletionAtPosition(fileName: String, position: Double, openingBrace: Double): Boolean
Link copied to clipboard
Link copied to clipboard
abstract fun prepareCallHierarchy(fileName: String, position: Double): Any?
Link copied to clipboard
abstract fun provideInlayHints(fileName: String, span: TextSpan, preferences: UserPreferences?): ReadonlyArray<InlayHint>
Link copied to clipboard
abstract fun toggleLineComment(fileName: String, textRange: TextRange): ReadonlyArray<TextChange>
Link copied to clipboard
abstract fun toggleMultilineComment(fileName: String, textRange: TextRange): ReadonlyArray<TextChange>
Link copied to clipboard
abstract fun uncommentSelection(fileName: String, textRange: TextRange): ReadonlyArray<TextChange>