@servicenow/sdk - v4.4.1
    Preparing search index...

    Interface LanguageService

    interface LanguageService {
        applyCodeActionCommand(
            action: InstallPackageAction,
            formatSettings?: tsc.FormatCodeSettings,
        ): Promise<ApplyCodeActionCommandResult>;
        applyCodeActionCommand(
            action: InstallPackageAction[],
            formatSettings?: tsc.FormatCodeSettings,
        ): Promise<ApplyCodeActionCommandResult[]>;
        applyCodeActionCommand(
            action: InstallPackageAction | InstallPackageAction[],
            formatSettings?: tsc.FormatCodeSettings,
        ): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
        applyCodeActionCommand(
            fileName: string,
            action: InstallPackageAction,
        ): Promise<ApplyCodeActionCommandResult>;
        applyCodeActionCommand(
            fileName: string,
            action: InstallPackageAction[],
        ): Promise<ApplyCodeActionCommandResult[]>;
        applyCodeActionCommand(
            fileName: string,
            action: InstallPackageAction | InstallPackageAction[],
        ): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
        cleanupSemanticCache(): void;
        commentSelection(
            fileName: string,
            textRange: tsc.TextRange,
        ): tsc.TextChange[];
        dispose(): void;
        findReferences(
            fileName: string,
            position: number,
        ): tsc.ReferencedSymbol[] | undefined;
        findRenameLocations(
            fileName: string,
            position: number,
            findInStrings: boolean,
            findInComments: boolean,
            preferences: tsc.UserPreferences,
        ): readonly tsc.RenameLocation[] | undefined;
        findRenameLocations(
            fileName: string,
            position: number,
            findInStrings: boolean,
            findInComments: boolean,
            providePrefixAndSuffixTextForRename?: boolean,
        ): readonly tsc.RenameLocation[] | undefined;
        getApplicableRefactors(
            fileName: string,
            positionOrRange: number | tsc.TextRange,
            preferences: tsc.UserPreferences | undefined,
            triggerReason?: tsc.RefactorTriggerReason,
            kind?: string,
            includeInteractiveActions?: boolean,
        ): tsc.ApplicableRefactorInfo[];
        getBraceMatchingAtPosition(
            fileName: string,
            position: number,
        ): tsc.TextSpan[];
        getBreakpointStatementAtPosition(
            fileName: string,
            position: number,
        ): tsc.TextSpan | undefined;
        getCodeFixesAtPosition(
            fileName: string,
            start: number,
            end: number,
            errorCodes: readonly number[],
            formatOptions: tsc.FormatCodeSettings,
            preferences: tsc.UserPreferences,
        ): readonly tsc.CodeFixAction[];
        getCombinedCodeFix(
            scope: CombinedCodeFixScope,
            fixId: {},
            formatOptions: tsc.FormatCodeSettings,
            preferences: tsc.UserPreferences,
        ): tsc.CombinedCodeActions;
        getCompilerOptionsDiagnostics(): tsc.Diagnostic[];
        getCompletionEntryDetails(
            fileName: string,
            position: number,
            entryName: string,
            formatOptions: tsc.FormatCodeSettings | FormatCodeOptions | undefined,
            source: string | undefined,
            preferences: tsc.UserPreferences | undefined,
            data: CompletionEntryData | undefined,
        ): tsc.CompletionEntryDetails | undefined;
        getCompletionEntrySymbol(
            fileName: string,
            position: number,
            name: string,
            source: string | undefined,
        ): tsc.Symbol | undefined;
        getCompletionsAtPosition(
            fileName: string,
            position: number,
            options: GetCompletionsAtPositionOptions | undefined,
            formattingSettings?: tsc.FormatCodeSettings,
        ): WithMetadata<tsc.CompletionInfo> | undefined;
        getDefinitionAndBoundSpan(
            fileName: string,
            position: number,
        ): tsc.DefinitionInfoAndBoundSpan | undefined;
        getDefinitionAtPosition(
            fileName: string,
            position: number,
        ): readonly tsc.DefinitionInfo[] | undefined;
        getDocCommentTemplateAtPosition(
            fileName: string,
            position: number,
            options?: DocCommentTemplateOptions,
            formatOptions?: tsc.FormatCodeSettings,
        ): TextInsertion | undefined;
        getDocumentHighlights(
            fileName: string,
            position: number,
            filesToSearch: string[],
        ): DocumentHighlights[] | undefined;
        getEditsForFileRename(
            oldFilePath: string,
            newFilePath: string,
            formatOptions: tsc.FormatCodeSettings,
            preferences: tsc.UserPreferences | undefined,
        ): readonly tsc.FileTextChanges[];
        getEditsForRefactor(
            fileName: string,
            formatOptions: tsc.FormatCodeSettings,
            positionOrRange: number | tsc.TextRange,
            refactorName: string,
            actionName: string,
            preferences: tsc.UserPreferences | undefined,
            interactiveRefactorArguments?: InteractiveRefactorArguments,
        ): tsc.RefactorEditInfo | undefined;
        getEmitOutput(
            fileName: string,
            emitOnlyDtsFiles?: boolean,
            forceDtsEmit?: boolean,
        ): tsc.EmitOutput;
        getEncodedSemanticClassifications(
            fileName: string,
            span: tsc.TextSpan,
            format?: SemanticClassificationFormat,
        ): Classifications;
        getEncodedSyntacticClassifications(
            fileName: string,
            span: tsc.TextSpan,
        ): Classifications;
        getFileReferences(fileName: string): tsc.ReferenceEntry[];
        getFormattingEditsAfterKeystroke(
            fileName: string,
            position: number,
            key: string,
            options: tsc.FormatCodeSettings | FormatCodeOptions,
        ): tsc.TextChange[];
        getFormattingEditsForDocument(
            fileName: string,
            options: tsc.FormatCodeSettings | FormatCodeOptions,
        ): tsc.TextChange[];
        getFormattingEditsForRange(
            fileName: string,
            start: number,
            end: number,
            options: tsc.FormatCodeSettings | FormatCodeOptions,
        ): tsc.TextChange[];
        getImplementationAtPosition(
            fileName: string,
            position: number,
        ): readonly tsc.ImplementationLocation[] | undefined;
        getIndentationAtPosition(
            fileName: string,
            position: number,
            options: tsc.EditorSettings | EditorOptions,
        ): number;
        getJsxClosingTagAtPosition(
            fileName: string,
            position: number,
        ): JsxClosingTagInfo | undefined;
        getLinkedEditingRangeAtPosition(
            fileName: string,
            position: number,
        ): LinkedEditingInfo | undefined;
        getMoveToRefactoringFileSuggestions(
            fileName: string,
            positionOrRange: number | tsc.TextRange,
            preferences: tsc.UserPreferences | undefined,
            triggerReason?: tsc.RefactorTriggerReason,
            kind?: string,
        ): { files: string[]; newFileName: string };
        getNameOrDottedNameSpan(
            fileName: string,
            startPos: number,
            endPos: number,
        ): tsc.TextSpan | undefined;
        getNavigateToItems(
            searchValue: string,
            maxResultCount?: number,
            fileName?: string,
            excludeDtsFiles?: boolean,
            excludeLibFiles?: boolean,
        ): NavigateToItem[];
        getNavigationBarItems(fileName: string): tsc.NavigationBarItem[];
        getNavigationTree(fileName: string): tsc.NavigationTree;
        getOutliningSpans(fileName: string): tsc.OutliningSpan[];
        getPasteEdits(
            args: PasteEditsArgs,
            formatOptions: tsc.FormatCodeSettings,
        ): PasteEdits;
        getProgram(): tsc.Program | undefined;
        getQuickInfoAtPosition(
            fileName: string,
            position: number,
        ): QuickInfo | undefined;
        getReferencesAtPosition(
            fileName: string,
            position: number,
        ): tsc.ReferenceEntry[] | undefined;
        getRenameInfo(
            fileName: string,
            position: number,
            preferences: tsc.UserPreferences,
        ): tsc.RenameInfo;
        getRenameInfo(
            fileName: string,
            position: number,
            options?: RenameInfoOptions,
        ): tsc.RenameInfo;
        getSemanticClassifications(
            fileName: string,
            span: tsc.TextSpan,
        ): ClassifiedSpan[];
        getSemanticClassifications(
            fileName: string,
            span: tsc.TextSpan,
            format: SemanticClassificationFormat,
        ): ClassifiedSpan[] | ClassifiedSpan2020[];
        getSemanticDiagnostics(fileName: string): tsc.Diagnostic[];
        getSignatureHelpItems(
            fileName: string,
            position: number,
            options: SignatureHelpItemsOptions | undefined,
        ): tsc.SignatureHelpItems | undefined;
        getSmartSelectionRange(
            fileName: string,
            position: number,
        ): tsc.SelectionRange;
        getSpanOfEnclosingComment(
            fileName: string,
            position: number,
            onlyMultiLine: boolean,
        ): tsc.TextSpan | undefined;
        getSuggestionDiagnostics(fileName: string): tsc.DiagnosticWithLocation[];
        getSupportedCodeFixes(fileName?: string): readonly string[];
        getSyntacticClassifications(
            fileName: string,
            span: tsc.TextSpan,
        ): ClassifiedSpan[];
        getSyntacticClassifications(
            fileName: string,
            span: tsc.TextSpan,
            format: SemanticClassificationFormat,
        ): ClassifiedSpan[] | ClassifiedSpan2020[];
        getSyntacticDiagnostics(fileName: string): tsc.DiagnosticWithLocation[];
        getTodoComments(
            fileName: string,
            descriptors: TodoCommentDescriptor[],
        ): TodoComment[];
        getTypeDefinitionAtPosition(
            fileName: string,
            position: number,
        ): readonly tsc.DefinitionInfo[] | undefined;
        isValidBraceCompletionAtPosition(
            fileName: string,
            position: number,
            openingBrace: number,
        ): boolean;
        organizeImports(
            args: OrganizeImportsArgs,
            formatOptions: tsc.FormatCodeSettings,
            preferences: tsc.UserPreferences | undefined,
        ): readonly tsc.FileTextChanges[];
        prepareCallHierarchy(
            fileName: string,
            position: number,
        ): tsc.CallHierarchyItem | tsc.CallHierarchyItem[] | undefined;
        provideCallHierarchyIncomingCalls(
            fileName: string,
            position: number,
        ): tsc.CallHierarchyIncomingCall[];
        provideCallHierarchyOutgoingCalls(
            fileName: string,
            position: number,
        ): tsc.CallHierarchyOutgoingCall[];
        provideInlayHints(
            fileName: string,
            span: tsc.TextSpan,
            preferences: tsc.UserPreferences | undefined,
        ): InlayHint[];
        toggleLineComment(
            fileName: string,
            textRange: tsc.TextRange,
        ): tsc.TextChange[];
        toggleMultilineComment(
            fileName: string,
            textRange: tsc.TextRange,
        ): tsc.TextChange[];
        toLineColumnOffset?(fileName: string, position: number): LineAndCharacter;
        uncommentSelection(
            fileName: string,
            textRange: tsc.TextRange,
        ): tsc.TextChange[];
    }
    Index

    Methods

    applyCodeActionCommand cleanupSemanticCache commentSelection dispose findReferences findRenameLocations getApplicableRefactors getBraceMatchingAtPosition getBreakpointStatementAtPosition getCodeFixesAtPosition getCombinedCodeFix getCompilerOptionsDiagnostics getCompletionEntryDetails getCompletionEntrySymbol getCompletionsAtPosition getDefinitionAndBoundSpan getDefinitionAtPosition getDocCommentTemplateAtPosition getDocumentHighlights getEditsForFileRename getEditsForRefactor getEmitOutput getEncodedSemanticClassifications getEncodedSyntacticClassifications getFileReferences getFormattingEditsAfterKeystroke getFormattingEditsForDocument getFormattingEditsForRange getImplementationAtPosition getIndentationAtPosition getJsxClosingTagAtPosition getLinkedEditingRangeAtPosition getMoveToRefactoringFileSuggestions getNameOrDottedNameSpan getNavigateToItems getNavigationBarItems getNavigationTree getOutliningSpans getPasteEdits getProgram getQuickInfoAtPosition getReferencesAtPosition getRenameInfo getSemanticClassifications getSemanticDiagnostics getSignatureHelpItems getSmartSelectionRange getSpanOfEnclosingComment getSuggestionDiagnostics getSupportedCodeFixes getSyntacticClassifications getSyntacticDiagnostics getTodoComments getTypeDefinitionAtPosition isValidBraceCompletionAtPosition organizeImports prepareCallHierarchy provideCallHierarchyIncomingCalls provideCallHierarchyOutgoingCalls provideInlayHints toggleLineComment toggleMultilineComment toLineColumnOffset? uncommentSelection

    Methods

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

      Returns void

    • Parameters

      Returns tsc.TextChange[]

    • Returns void

    • Parameters

      • fileName: string
      • position: number

      Returns tsc.ReferencedSymbol[] | undefined

    • Parameters

      • fileName: string
      • position: number
      • findInStrings: boolean
      • findInComments: boolean
      • preferences: tsc.UserPreferences

      Returns readonly tsc.RenameLocation[] | undefined

    • Parameters

      • fileName: string
      • position: number
      • findInStrings: boolean
      • findInComments: boolean
      • OptionalprovidePrefixAndSuffixTextForRename: boolean

      Returns readonly tsc.RenameLocation[] | undefined

      Pass providePrefixAndSuffixTextForRename as part of a UserPreferences parameter.

    • Parameters

      • fileName: string
      • positionOrRange: number | tsc.TextRange
      • preferences: tsc.UserPreferences | undefined
      • OptionaltriggerReason: tsc.RefactorTriggerReason
      • Optionalkind: string
      • OptionalincludeInteractiveActions: boolean

        Include refactor actions that require additional arguments to be passed when calling getEditsForRefactor. When true, clients should inspect the isInteractive property of each returned RefactorActionInfo and ensure they are able to collect the appropriate arguments for any interactive action before offering it.

      Returns tsc.ApplicableRefactorInfo[]

    • Parameters

      • fileName: string
      • position: number

      Returns tsc.TextSpan[]

    • Parameters

      • fileName: string
      • position: number

      Returns tsc.TextSpan | undefined

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

      Returns tsc.Diagnostic[]

    • 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: tsc.FormatCodeSettings | FormatCodeOptions | undefined

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

      • source: string | undefined

        source property from the completion entry

      • preferences: tsc.UserPreferences | undefined

        User settings, can be undefined for backwards compatibility

      • data: CompletionEntryData | undefined

        data property from the completion entry

      Returns tsc.CompletionEntryDetails | undefined

    • Parameters

      • fileName: string
      • position: number
      • name: string
      • source: string | undefined

      Returns tsc.Symbol | undefined

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

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

      • OptionalformattingSettings: tsc.FormatCodeSettings

        settings needed for calling formatting functions.

      Returns WithMetadata<tsc.CompletionInfo> | undefined

    • Parameters

      • fileName: string
      • position: number

      Returns tsc.DefinitionInfoAndBoundSpan | undefined

    • Parameters

      • fileName: string
      • position: number

      Returns readonly tsc.DefinitionInfo[] | undefined

    • Parameters

      • fileName: string
      • position: number
      • filesToSearch: string[]

      Returns DocumentHighlights[] | undefined

    • Parameters

      • fileName: string
      • OptionalemitOnlyDtsFiles: boolean
      • OptionalforceDtsEmit: boolean

      Returns tsc.EmitOutput

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

    • Encoded as triples of [start, length, ClassificationType].

      Parameters

      Returns Classifications

    • Parameters

      • fileName: string

      Returns tsc.ReferenceEntry[]

    • Parameters

      • fileName: string
      • position: number

      Returns readonly tsc.ImplementationLocation[] | undefined

    • Parameters

      Returns number

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

    • Parameters

      • fileName: string
      • position: number

      Returns LinkedEditingInfo | undefined

    • Parameters

      Returns { files: string[]; newFileName: string }

    • Parameters

      • fileName: string
      • startPos: number
      • endPos: number

      Returns tsc.TextSpan | undefined

    • Parameters

      • searchValue: string
      • OptionalmaxResultCount: number
      • OptionalfileName: string
      • OptionalexcludeDtsFiles: boolean
      • OptionalexcludeLibFiles: boolean

      Returns NavigateToItem[]

    • Parameters

      • fileName: string

      Returns tsc.NavigationBarItem[]

    • Parameters

      • fileName: string

      Returns tsc.NavigationTree

    • Parameters

      • fileName: string

      Returns tsc.OutliningSpan[]

    • Returns tsc.Program | undefined

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

    • Parameters

      • fileName: string
      • position: number

      Returns tsc.ReferenceEntry[] | undefined

    • Parameters

      Returns tsc.RenameInfo

    • Parameters

      Returns tsc.RenameInfo

      Use the signature with UserPreferences instead.

    • 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 tsc.Diagnostic[]

    • Parameters

      • fileName: string
      • position: number

      Returns tsc.SelectionRange

    • Parameters

      • fileName: string
      • position: number
      • onlyMultiLine: boolean

      Returns tsc.TextSpan | undefined

    • 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 tsc.DiagnosticWithLocation[]

    • Parameters

      • OptionalfileName: string

      Returns readonly string[]

    • 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 tsc.DiagnosticWithLocation[]

    • Parameters

      • fileName: string
      • position: number

      Returns readonly tsc.DefinitionInfo[] | undefined

    • Parameters

      • fileName: string
      • position: number
      • openingBrace: number

      Returns boolean

    • Parameters

      • fileName: string
      • position: number

      Returns tsc.CallHierarchyIncomingCall[]

    • Parameters

      • fileName: string
      • position: number

      Returns tsc.CallHierarchyOutgoingCall[]

    • Parameters

      Returns tsc.TextChange[]

    • Parameters

      Returns tsc.TextChange[]

    • Parameters

      • fileName: string
      • position: number

      Returns LineAndCharacter

    • Parameters

      Returns tsc.TextChange[]