Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface LanguageService

Hierarchy

  • LanguageService

Index

Methods

applyCodeActionCommand

cleanupSemanticCache

  • cleanupSemanticCache(): void

commentSelection

dispose

  • dispose(): void

findReferences

findRenameLocations

  • findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): readonly RenameLocation[]
  • Parameters

    • fileName: string
    • position: number
    • findInStrings: boolean
    • findInComments: boolean
    • Optional providePrefixAndSuffixTextForRename: boolean

    Returns readonly RenameLocation[]

getApplicableRefactors

getBraceMatchingAtPosition

  • getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]

getBreakpointStatementAtPosition

  • getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan

getCodeFixesAtPosition

getCombinedCodeFix

getCompilerOptionsDiagnostics

getCompletionEntryDetails

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

    Parameters

    • fileName: string

      The path to the file

    • position: number

      A zero based index of the character where you want the entries

    • entryName: string

      The name from an existing completion which came from getCompletionsAtPosition

    • formatOptions: FormatCodeSettings | FormatCodeOptions

      How should code samples in the completions be formatted, can be undefined for backwards compatibility

    • source: string

      Source code for the current file, can be undefined for backwards compatibility

    • preferences: UserPreferences

      User settings, can be undefined for backwards compatibility

    Returns CompletionEntryDetails

getCompletionEntrySymbol

  • getCompletionEntrySymbol(fileName: string, position: number, name: string, source: string): Symbol

getCompletionsAtPosition

  • Gets completion entries at a particular position in a file.

    Parameters

    • fileName: string

      The path to the file

    • position: number

      A zero-based index of the character where you want the entries

    • options: GetCompletionsAtPositionOptions

      An object describing how the request was triggered and what kinds of code actions can be returned with the completions.

    Returns WithMetadata<CompletionInfo>

getDefinitionAndBoundSpan

getDefinitionAtPosition

  • getDefinitionAtPosition(fileName: string, position: number): readonly DefinitionInfo[]

getDocCommentTemplateAtPosition

  • getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion

getDocumentHighlights

  • getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[]

getEditsForFileRename

getEditsForRefactor

getEmitOutput

  • getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean, forceDtsEmit?: boolean): EmitOutput

getEncodedSemanticClassifications

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

    Parameters

    Returns Classifications

    a number array encoded as triples of [start, length, ClassificationType, ...].

getEncodedSyntacticClassifications

getFileReferences

getFormattingEditsAfterKeystroke

getFormattingEditsForDocument

getFormattingEditsForRange

getImplementationAtPosition

getIndentationAtPosition

getJsxClosingTagAtPosition

  • 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.

    Parameters

    • fileName: string
    • position: number

    Returns JsxClosingTagInfo

getNameOrDottedNameSpan

  • getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan

getNavigateToItems

  • getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string, excludeDtsFiles?: boolean): NavigateToItem[]

getNavigationBarItems

getNavigationTree

getOccurrencesAtPosition

  • getOccurrencesAtPosition(fileName: string, position: number): readonly ReferenceEntry[]

getOutliningSpans

getProgram

getQuickInfoAtPosition

  • getQuickInfoAtPosition(fileName: string, position: number): 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.

    Parameters

    • fileName: string

      The path to the file

    • position: number

      A zero-based index of the character where you want the quick info

    Returns QuickInfo

getReferencesAtPosition

  • getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]

getRenameInfo

getSemanticClassifications

getSemanticDiagnostics

  • getSemanticDiagnostics(fileName: string): 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.

    Unlike the other get*Diagnostics functions, these diagnostics can potentially not include a reference to a source file. Specifically, the first time this is called, it will return global diagnostics with no associated location.

    To contrast the differences between semantic and syntactic diagnostics, consider the sentence: "The sun is green." is syntactically correct; those are real English words with correct sentence structure. However, it is semantically invalid, because it is not true.

    Parameters

    • fileName: string

      A path to the file you want semantic diagnostics for

    Returns Diagnostic[]

getSignatureHelpItems

getSmartSelectionRange

  • getSmartSelectionRange(fileName: string, position: number): SelectionRange

getSpanOfEnclosingComment

  • getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan

getSuggestionDiagnostics

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

    Parameters

    • fileName: string

      A path to the file you want semantic diagnostics for

    Returns DiagnosticWithLocation[]

getSyntacticClassifications

getSyntacticDiagnostics

  • Gets errors indicating invalid syntax in a file.

    In English, "this cdeo have, erorrs" is syntactically invalid because it has typos, grammatical errors, and misplaced punctuation. Likewise, examples of syntax errors in TypeScript are missing parentheses in an if statement, mismatched curly braces, and using a reserved keyword as a variable name.

    These diagnostics are inexpensive to compute and don't require knowledge of other files. Note that a non-empty result increases the likelihood of false positives from getSemanticDiagnostics.

    While these represent the majority of syntax-related diagnostics, there are some that require the type system, which will be present in getSemanticDiagnostics.

    Parameters

    • fileName: string

      A path to the file you want syntactic diagnostics for

    Returns DiagnosticWithLocation[]

getTodoComments

getTypeDefinitionAtPosition

  • getTypeDefinitionAtPosition(fileName: string, position: number): readonly DefinitionInfo[]

isValidBraceCompletionAtPosition

  • isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean

organizeImports

prepareCallHierarchy

provideCallHierarchyIncomingCalls

provideCallHierarchyOutgoingCalls

Optional toLineColumnOffset

toggleLineComment

toggleMultilineComment

uncommentSelection

Generated using TypeDoc