UNPKG

typescript

Version:

TypeScript is a language for application scale JavaScript development

1,138 lines (1,135 loc) • 586 kB
/*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ declare namespace ts { namespace server { namespace protocol { export import ApplicableRefactorInfo = ts.ApplicableRefactorInfo; export import ClassificationType = ts.ClassificationType; export import CompletionsTriggerCharacter = ts.CompletionsTriggerCharacter; export import CompletionTriggerKind = ts.CompletionTriggerKind; export import InlayHintKind = ts.InlayHintKind; export import OrganizeImportsMode = ts.OrganizeImportsMode; export import RefactorActionInfo = ts.RefactorActionInfo; export import RefactorTriggerReason = ts.RefactorTriggerReason; export import RenameInfoFailure = ts.RenameInfoFailure; export import SemicolonPreference = ts.SemicolonPreference; export import SignatureHelpCharacterTypedReason = ts.SignatureHelpCharacterTypedReason; export import SignatureHelpInvokedReason = ts.SignatureHelpInvokedReason; export import SignatureHelpParameter = ts.SignatureHelpParameter; export import SignatureHelpRetriggerCharacter = ts.SignatureHelpRetriggerCharacter; export import SignatureHelpRetriggeredReason = ts.SignatureHelpRetriggeredReason; export import SignatureHelpTriggerCharacter = ts.SignatureHelpTriggerCharacter; export import SignatureHelpTriggerReason = ts.SignatureHelpTriggerReason; export import SymbolDisplayPart = ts.SymbolDisplayPart; export import UserPreferences = ts.UserPreferences; type ChangePropertyTypes< T, Substitutions extends { [K in keyof T]?: any; }, > = { [K in keyof T]: K extends keyof Substitutions ? Substitutions[K] : T[K]; }; type ChangeStringIndexSignature<T, NewStringIndexSignatureType> = { [K in keyof T]: string extends K ? NewStringIndexSignatureType : T[K]; }; export enum CommandTypes { JsxClosingTag = "jsxClosingTag", LinkedEditingRange = "linkedEditingRange", Brace = "brace", BraceCompletion = "braceCompletion", GetSpanOfEnclosingComment = "getSpanOfEnclosingComment", Change = "change", Close = "close", /** @deprecated Prefer CompletionInfo -- see comment on CompletionsResponse */ Completions = "completions", CompletionInfo = "completionInfo", CompletionDetails = "completionEntryDetails", CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList", CompileOnSaveEmitFile = "compileOnSaveEmitFile", Configure = "configure", Definition = "definition", DefinitionAndBoundSpan = "definitionAndBoundSpan", Implementation = "implementation", Exit = "exit", FileReferences = "fileReferences", Format = "format", Formatonkey = "formatonkey", Geterr = "geterr", GeterrForProject = "geterrForProject", SemanticDiagnosticsSync = "semanticDiagnosticsSync", SyntacticDiagnosticsSync = "syntacticDiagnosticsSync", SuggestionDiagnosticsSync = "suggestionDiagnosticsSync", NavBar = "navbar", Navto = "navto", NavTree = "navtree", NavTreeFull = "navtree-full", DocumentHighlights = "documentHighlights", Open = "open", Quickinfo = "quickinfo", References = "references", Reload = "reload", Rename = "rename", Saveto = "saveto", SignatureHelp = "signatureHelp", FindSourceDefinition = "findSourceDefinition", Status = "status", TypeDefinition = "typeDefinition", ProjectInfo = "projectInfo", ReloadProjects = "reloadProjects", Unknown = "unknown", OpenExternalProject = "openExternalProject", OpenExternalProjects = "openExternalProjects", CloseExternalProject = "closeExternalProject", UpdateOpen = "updateOpen", GetOutliningSpans = "getOutliningSpans", TodoComments = "todoComments", Indentation = "indentation", DocCommentTemplate = "docCommentTemplate", CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects", GetCodeFixes = "getCodeFixes", GetCombinedCodeFix = "getCombinedCodeFix", ApplyCodeActionCommand = "applyCodeActionCommand", GetSupportedCodeFixes = "getSupportedCodeFixes", GetApplicableRefactors = "getApplicableRefactors", GetEditsForRefactor = "getEditsForRefactor", GetMoveToRefactoringFileSuggestions = "getMoveToRefactoringFileSuggestions", PreparePasteEdits = "preparePasteEdits", GetPasteEdits = "getPasteEdits", OrganizeImports = "organizeImports", GetEditsForFileRename = "getEditsForFileRename", ConfigurePlugin = "configurePlugin", SelectionRange = "selectionRange", ToggleLineComment = "toggleLineComment", ToggleMultilineComment = "toggleMultilineComment", CommentSelection = "commentSelection", UncommentSelection = "uncommentSelection", PrepareCallHierarchy = "prepareCallHierarchy", ProvideCallHierarchyIncomingCalls = "provideCallHierarchyIncomingCalls", ProvideCallHierarchyOutgoingCalls = "provideCallHierarchyOutgoingCalls", ProvideInlayHints = "provideInlayHints", WatchChange = "watchChange", MapCode = "mapCode", } /** * A TypeScript Server message */ export interface Message { /** * Sequence number of the message */ seq: number; /** * One of "request", "response", or "event" */ type: "request" | "response" | "event"; } /** * Client-initiated request message */ export interface Request extends Message { type: "request"; /** * The command to execute */ command: string; /** * Object containing arguments for the command */ arguments?: any; } /** * Request to reload the project structure for all the opened files */ export interface ReloadProjectsRequest extends Request { command: CommandTypes.ReloadProjects; } /** * Server-initiated event message */ export interface Event extends Message { type: "event"; /** * Name of event */ event: string; /** * Event-specific information */ body?: any; } /** * Response by server to client request message. */ export interface Response extends Message { type: "response"; /** * Sequence number of the request message. */ request_seq: number; /** * Outcome of the request. */ success: boolean; /** * The command requested. */ command: string; /** * If success === false, this should always be provided. * Otherwise, may (or may not) contain a success message. */ message?: string; /** * Contains message body if success === true. */ body?: any; /** * Contains extra information that plugin can include to be passed on */ metadata?: unknown; /** * Exposes information about the performance of this request-response pair. */ performanceData?: PerformanceData; } export interface PerformanceData { /** * Time spent updating the program graph, in milliseconds. */ updateGraphDurationMs?: number; /** * The time spent creating or updating the auto-import program, in milliseconds. */ createAutoImportProviderProgramDurationMs?: number; /** * The time spent computing diagnostics, in milliseconds. */ diagnosticsDuration?: FileDiagnosticPerformanceData[]; } /** * Time spent computing each kind of diagnostics, in milliseconds. */ export type DiagnosticPerformanceData = { [Kind in DiagnosticEventKind]?: number; }; export interface FileDiagnosticPerformanceData extends DiagnosticPerformanceData { /** * The file for which the performance data is reported. */ file: string; } /** * Arguments for FileRequest messages. */ export interface FileRequestArgs { /** * The file for the request (absolute pathname required). */ file: string; projectFileName?: string; } export interface StatusRequest extends Request { command: CommandTypes.Status; } export interface StatusResponseBody { /** * The TypeScript version (`ts.version`). */ version: string; } /** * Response to StatusRequest */ export interface StatusResponse extends Response { body: StatusResponseBody; } /** * Requests a JS Doc comment template for a given position */ export interface DocCommentTemplateRequest extends FileLocationRequest { command: CommandTypes.DocCommentTemplate; } /** * Response to DocCommentTemplateRequest */ export interface DocCommandTemplateResponse extends Response { body?: TextInsertion; } /** * A request to get TODO comments from the file */ export interface TodoCommentRequest extends FileRequest { command: CommandTypes.TodoComments; arguments: TodoCommentRequestArgs; } /** * Arguments for TodoCommentRequest request. */ export interface TodoCommentRequestArgs extends FileRequestArgs { /** * Array of target TodoCommentDescriptors that describes TODO comments to be found */ descriptors: TodoCommentDescriptor[]; } /** * Response for TodoCommentRequest request. */ export interface TodoCommentsResponse extends Response { body?: TodoComment[]; } /** * A request to determine if the caret is inside a comment. */ export interface SpanOfEnclosingCommentRequest extends FileLocationRequest { command: CommandTypes.GetSpanOfEnclosingComment; arguments: SpanOfEnclosingCommentRequestArgs; } export interface SpanOfEnclosingCommentRequestArgs extends FileLocationRequestArgs { /** * Requires that the enclosing span be a multi-line comment, or else the request returns undefined. */ onlyMultiLine: boolean; } /** * Request to obtain outlining spans in file. */ export interface OutliningSpansRequest extends FileRequest { command: CommandTypes.GetOutliningSpans; } export type OutliningSpan = ChangePropertyTypes<ts.OutliningSpan, { textSpan: TextSpan; hintSpan: TextSpan; }>; /** * Response to OutliningSpansRequest request. */ export interface OutliningSpansResponse extends Response { body?: OutliningSpan[]; } /** * A request to get indentation for a location in file */ export interface IndentationRequest extends FileLocationRequest { command: CommandTypes.Indentation; arguments: IndentationRequestArgs; } /** * Response for IndentationRequest request. */ export interface IndentationResponse extends Response { body?: IndentationResult; } /** * Indentation result representing where indentation should be placed */ export interface IndentationResult { /** * The base position in the document that the indent should be relative to */ position: number; /** * The number of columns the indent should be at relative to the position's column. */ indentation: number; } /** * Arguments for IndentationRequest request. */ export interface IndentationRequestArgs extends FileLocationRequestArgs { /** * An optional set of settings to be used when computing indentation. * If argument is omitted - then it will use settings for file that were previously set via 'configure' request or global settings. */ options?: EditorSettings; } /** * Arguments for ProjectInfoRequest request. */ export interface ProjectInfoRequestArgs extends FileRequestArgs { /** * Indicate if the file name list of the project is needed */ needFileNameList: boolean; /** * if true returns details about default configured project calculation */ needDefaultConfiguredProjectInfo?: boolean; } /** * A request to get the project information of the current file. */ export interface ProjectInfoRequest extends Request { command: CommandTypes.ProjectInfo; arguments: ProjectInfoRequestArgs; } /** * A request to retrieve compiler options diagnostics for a project */ export interface CompilerOptionsDiagnosticsRequest extends Request { arguments: CompilerOptionsDiagnosticsRequestArgs; } /** * Arguments for CompilerOptionsDiagnosticsRequest request. */ export interface CompilerOptionsDiagnosticsRequestArgs { /** * Name of the project to retrieve compiler options diagnostics. */ projectFileName: string; } /** * Details about the default project for the file if tsconfig file is found */ export interface DefaultConfiguredProjectInfo { /** List of config files looked and did not match because file was not part of root file names */ notMatchedByConfig?: readonly string[]; /** List of projects which were loaded but file was not part of the project or is file from referenced project */ notInProject?: readonly string[]; /** Configured project used as default */ defaultProject?: string; } /** * Response message body for "projectInfo" request */ export interface ProjectInfo { /** * For configured project, this is the normalized path of the 'tsconfig.json' file * For inferred project, this is undefined */ configFileName: string; /** * The list of normalized file name in the project, including 'lib.d.ts' */ fileNames?: string[]; /** * Indicates if the project has a active language service instance */ languageServiceDisabled?: boolean; /** * Information about default project */ configuredProjectInfo?: DefaultConfiguredProjectInfo; } /** * Represents diagnostic info that includes location of diagnostic in two forms * - start position and length of the error span * - startLocation and endLocation - a pair of Location objects that store start/end line and offset of the error span. */ export interface DiagnosticWithLinePosition { message: string; start: number; length: number; startLocation: Location; endLocation: Location; category: string; code: number; /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */ reportsUnnecessary?: {}; reportsDeprecated?: {}; relatedInformation?: DiagnosticRelatedInformation[]; } /** * Response message for "projectInfo" request */ export interface ProjectInfoResponse extends Response { body?: ProjectInfo; } /** * Request whose sole parameter is a file name. */ export interface FileRequest extends Request { arguments: FileRequestArgs; } /** * Instances of this interface specify a location in a source file: * (file, line, character offset), where line and character offset are 1-based. */ export interface FileLocationRequestArgs extends FileRequestArgs { /** * The line number for the request (1-based). */ line: number; /** * The character offset (on the line) for the request (1-based). */ offset: number; } export type FileLocationOrRangeRequestArgs = FileLocationRequestArgs | FileRangeRequestArgs; /** * Request refactorings at a given position or selection area. */ export interface GetApplicableRefactorsRequest extends Request { command: CommandTypes.GetApplicableRefactors; arguments: GetApplicableRefactorsRequestArgs; } export type GetApplicableRefactorsRequestArgs = FileLocationOrRangeRequestArgs & { triggerReason?: RefactorTriggerReason; kind?: string; /** * 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 refactor before offering it. */ includeInteractiveActions?: boolean; }; /** * Response is a list of available refactorings. * Each refactoring exposes one or more "Actions"; a user selects one action to invoke a refactoring */ export interface GetApplicableRefactorsResponse extends Response { body?: ApplicableRefactorInfo[]; } /** * Request refactorings at a given position or selection area to move to an existing file. */ export interface GetMoveToRefactoringFileSuggestionsRequest extends Request { command: CommandTypes.GetMoveToRefactoringFileSuggestions; arguments: GetMoveToRefactoringFileSuggestionsRequestArgs; } export type GetMoveToRefactoringFileSuggestionsRequestArgs = FileLocationOrRangeRequestArgs & { kind?: string; }; /** * Response is a list of available files. * Each refactoring exposes one or more "Actions"; a user selects one action to invoke a refactoring */ export interface GetMoveToRefactoringFileSuggestions extends Response { body: { newFileName: string; files: string[]; }; } /** * Request to check if `pasteEdits` should be provided for a given location post copying text from that location. */ export interface PreparePasteEditsRequest extends FileRequest { command: CommandTypes.PreparePasteEdits; arguments: PreparePasteEditsRequestArgs; } export interface PreparePasteEditsRequestArgs extends FileRequestArgs { copiedTextSpan: TextSpan[]; } export interface PreparePasteEditsResponse extends Response { body: boolean; } /** * Request refactorings at a given position post pasting text from some other location. */ export interface GetPasteEditsRequest extends Request { command: CommandTypes.GetPasteEdits; arguments: GetPasteEditsRequestArgs; } export interface GetPasteEditsRequestArgs extends FileRequestArgs { /** The text that gets pasted in a file. */ pastedText: string[]; /** Locations of where the `pastedText` gets added in a file. If the length of the `pastedText` and `pastedLocations` are not the same, * then the `pastedText` is combined into one and added at all the `pastedLocations`. */ pasteLocations: TextSpan[]; /** The source location of each `pastedText`. If present, the length of `spans` must be equal to the length of `pastedText`. */ copiedFrom?: { file: string; spans: TextSpan[]; }; } export interface GetPasteEditsResponse extends Response { body: PasteEditsAction; } export interface PasteEditsAction { edits: FileCodeEdits[]; fixId?: {}; } export interface GetEditsForRefactorRequest extends Request { command: CommandTypes.GetEditsForRefactor; arguments: GetEditsForRefactorRequestArgs; } /** * Request the edits that a particular refactoring action produces. * Callers must specify the name of the refactor and the name of the action. */ export type GetEditsForRefactorRequestArgs = FileLocationOrRangeRequestArgs & { refactor: string; action: string; interactiveRefactorArguments?: InteractiveRefactorArguments; }; export interface GetEditsForRefactorResponse extends Response { body?: RefactorEditInfo; } export interface RefactorEditInfo { edits: FileCodeEdits[]; /** * An optional location where the editor should start a rename operation once * the refactoring edits have been applied */ renameLocation?: Location; renameFilename?: string; notApplicableReason?: string; } /** * Organize imports by: * 1) Removing unused imports * 2) Coalescing imports from the same module * 3) Sorting imports */ export interface OrganizeImportsRequest extends Request { command: CommandTypes.OrganizeImports; arguments: OrganizeImportsRequestArgs; } export type OrganizeImportsScope = GetCombinedCodeFixScope; export interface OrganizeImportsRequestArgs { scope: OrganizeImportsScope; /** @deprecated Use `mode` instead */ skipDestructiveCodeActions?: boolean; mode?: OrganizeImportsMode; } export interface OrganizeImportsResponse extends Response { body: readonly FileCodeEdits[]; } export interface GetEditsForFileRenameRequest extends Request { command: CommandTypes.GetEditsForFileRename; arguments: GetEditsForFileRenameRequestArgs; } /** Note: Paths may also be directories. */ export interface GetEditsForFileRenameRequestArgs { readonly oldFilePath: string; readonly newFilePath: string; } export interface GetEditsForFileRenameResponse extends Response { body: readonly FileCodeEdits[]; } /** * Request for the available codefixes at a specific position. */ export interface CodeFixRequest extends Request { command: CommandTypes.GetCodeFixes; arguments: CodeFixRequestArgs; } export interface GetCombinedCodeFixRequest extends Request { command: CommandTypes.GetCombinedCodeFix; arguments: GetCombinedCodeFixRequestArgs; } export interface GetCombinedCodeFixResponse extends Response { body: CombinedCodeActions; } export interface ApplyCodeActionCommandRequest extends Request { command: CommandTypes.ApplyCodeActionCommand; arguments: ApplyCodeActionCommandRequestArgs; } export interface ApplyCodeActionCommandResponse extends Response { } export interface FileRangeRequestArgs extends FileRequestArgs, FileRange { } /** * Instances of this interface specify errorcodes on a specific location in a sourcefile. */ export interface CodeFixRequestArgs extends FileRangeRequestArgs { /** * Errorcodes we want to get the fixes for. */ errorCodes: readonly number[]; } export interface GetCombinedCodeFixRequestArgs { scope: GetCombinedCodeFixScope; fixId: {}; } export interface GetCombinedCodeFixScope { type: "file"; args: FileRequestArgs; } export interface ApplyCodeActionCommandRequestArgs { /** May also be an array of commands. */ command: {}; } /** * Response for GetCodeFixes request. */ export interface GetCodeFixesResponse extends Response { body?: CodeAction[]; } /** * A request whose arguments specify a file location (file, line, col). */ export interface FileLocationRequest extends FileRequest { arguments: FileLocationRequestArgs; } /** * A request to get codes of supported code fixes. */ export interface GetSupportedCodeFixesRequest extends Request { command: CommandTypes.GetSupportedCodeFixes; arguments?: Partial<FileRequestArgs>; } /** * A response for GetSupportedCodeFixesRequest request. */ export interface GetSupportedCodeFixesResponse extends Response { /** * List of error codes supported by the server. */ body?: string[]; } /** * A request to get encoded semantic classifications for a span in the file */ export interface EncodedSemanticClassificationsRequest extends FileRequest { arguments: EncodedSemanticClassificationsRequestArgs; } /** * Arguments for EncodedSemanticClassificationsRequest request. */ export interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs { /** * Start position of the span. */ start: number; /** * Length of the span. */ length: number; /** * Optional parameter for the semantic highlighting response, if absent it * defaults to "original". */ format?: "original" | "2020"; } /** The response for a EncodedSemanticClassificationsRequest */ export interface EncodedSemanticClassificationsResponse extends Response { body?: EncodedSemanticClassificationsResponseBody; } /** * Implementation response message. Gives series of text spans depending on the format ar. */ export interface EncodedSemanticClassificationsResponseBody { endOfLineState: EndOfLineState; spans: number[]; } /** * Arguments in document highlight request; include: filesToSearch, file, * line, offset. */ export interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs { /** * List of files to search for document highlights. */ filesToSearch: string[]; } /** * Go to definition request; value of command field is * "definition". Return response giving the file locations that * define the symbol found in file at location line, col. */ export interface DefinitionRequest extends FileLocationRequest { command: CommandTypes.Definition; } export interface DefinitionAndBoundSpanRequest extends FileLocationRequest { readonly command: CommandTypes.DefinitionAndBoundSpan; } export interface FindSourceDefinitionRequest extends FileLocationRequest { readonly command: CommandTypes.FindSourceDefinition; } export interface DefinitionAndBoundSpanResponse extends Response { readonly body: DefinitionInfoAndBoundSpan; } /** * Go to type request; value of command field is * "typeDefinition". Return response giving the file locations that * define the type for the symbol found in file at location line, col. */ export interface TypeDefinitionRequest extends FileLocationRequest { command: CommandTypes.TypeDefinition; } /** * Go to implementation request; value of command field is * "implementation". Return response giving the file locations that * implement the symbol found in file at location line, col. */ export interface ImplementationRequest extends FileLocationRequest { command: CommandTypes.Implementation; } /** * Location in source code expressed as (one-based) line and (one-based) column offset. */ export interface Location { line: number; offset: number; } /** * Object found in response messages defining a span of text in source code. */ export interface TextSpan { /** * First character of the definition. */ start: Location; /** * One character past last character of the definition. */ end: Location; } /** * Object found in response messages defining a span of text in a specific source file. */ export interface FileSpan extends TextSpan { /** * File containing text span. */ file: string; } export interface JSDocTagInfo { /** Name of the JSDoc tag */ name: string; /** * Comment text after the JSDoc tag -- the text after the tag name until the next tag or end of comment * Display parts when UserPreferences.displayPartsForJSDoc is true, flattened to string otherwise. */ text?: string | SymbolDisplayPart[]; } export interface TextSpanWithContext extends TextSpan { contextStart?: Location; contextEnd?: Location; } export interface FileSpanWithContext extends FileSpan, TextSpanWithContext { } export interface DefinitionInfo extends FileSpanWithContext { /** * When true, the file may or may not exist. */ unverified?: boolean; } export interface DefinitionInfoAndBoundSpan { definitions: readonly DefinitionInfo[]; textSpan: TextSpan; } /** * Definition response message. Gives text range for definition. */ export interface DefinitionResponse extends Response { body?: DefinitionInfo[]; } export interface DefinitionInfoAndBoundSpanResponse extends Response { body?: DefinitionInfoAndBoundSpan; } /** @deprecated Use `DefinitionInfoAndBoundSpanResponse` instead. */ export type DefinitionInfoAndBoundSpanReponse = DefinitionInfoAndBoundSpanResponse; /** * Definition response message. Gives text range for definition. */ export interface TypeDefinitionResponse extends Response { body?: FileSpanWithContext[]; } /** * Implementation response message. Gives text range for implementations. */ export interface ImplementationResponse extends Response { body?: FileSpanWithContext[]; } /** * Request to get brace completion for a location in the file. */ export interface BraceCompletionRequest extends FileLocationRequest { command: CommandTypes.BraceCompletion; arguments: BraceCompletionRequestArgs; } /** * Argument for BraceCompletionRequest request. */ export interface BraceCompletionRequestArgs extends FileLocationRequestArgs { /** * Kind of opening brace */ openingBrace: string; } export interface JsxClosingTagRequest extends FileLocationRequest { readonly command: CommandTypes.JsxClosingTag; readonly arguments: JsxClosingTagRequestArgs; } export interface JsxClosingTagRequestArgs extends FileLocationRequestArgs { } export interface JsxClosingTagResponse extends Response { readonly body: TextInsertion; } export interface LinkedEditingRangeRequest extends FileLocationRequest { readonly command: CommandTypes.LinkedEditingRange; } export interface LinkedEditingRangesBody { ranges: TextSpan[]; wordPattern?: string; } export interface LinkedEditingRangeResponse extends Response { readonly body: LinkedEditingRangesBody; } /** * Get document highlights request; value of command field is * "documentHighlights". Return response giving spans that are relevant * in the file at a given line and column. */ export interface DocumentHighlightsRequest extends FileLocationRequest { command: CommandTypes.DocumentHighlights; arguments: DocumentHighlightsRequestArgs; } /** * Span augmented with extra information that denotes the kind of the highlighting to be used for span. */ export interface HighlightSpan extends TextSpanWithContext { kind: HighlightSpanKind; } /** * Represents a set of highligh spans for a give name */ export interface DocumentHighlightsItem { /** * File containing highlight spans. */ file: string; /** * Spans to highlight in file. */ highlightSpans: HighlightSpan[]; } /** * Response for a DocumentHighlightsRequest request. */ export interface DocumentHighlightsResponse extends Response { body?: DocumentHighlightsItem[]; } /** * Find references request; value of command field is * "references". Return response giving the file locations that * reference the symbol found in file at location line, col. */ export interface ReferencesRequest extends FileLocationRequest { command: CommandTypes.References; } export interface ReferencesResponseItem extends FileSpanWithContext { /** * Text of line containing the reference. Including this * with the response avoids latency of editor loading files * to show text of reference line (the server already has loaded the referencing files). * * If {@link UserPreferences.disableLineTextInReferences} is enabled, the property won't be filled */ lineText?: string; /** * True if reference is a write location, false otherwise. */ isWriteAccess: boolean; /** * Present only if the search was triggered from a declaration. * True indicates that the references refers to the same symbol * (i.e. has the same meaning) as the declaration that began the * search. */ isDefinition?: boolean; } /** * The body of a "references" response message. */ export interface ReferencesResponseBody { /** * The file locations referencing the symbol. */ refs: readonly ReferencesResponseItem[]; /** * The name of the symbol. */ symbolName: string; /** * The start character offset of the symbol (on the line provided by the references request). */ symbolStartOffset: number; /** * The full display name of the symbol. */ symbolDisplayString: string; } /** * Response to "references" request. */ export interface ReferencesResponse extends Response { body?: ReferencesResponseBody; } export interface FileReferencesRequest extends FileRequest { command: CommandTypes.FileReferences; } export interface FileReferencesResponseBody { /** * The file locations referencing the symbol. */ refs: readonly ReferencesResponseItem[]; /** * The name of the symbol. */ symbolName: string; } export interface FileReferencesResponse extends Response { body?: FileReferencesResponseBody; } /** * Argument for RenameRequest request. */ export interface RenameRequestArgs extends FileLocationRequestArgs { /** * Should text at specified location be found/changed in comments? */ findInComments?: boolean; /** * Should text at specified location be found/changed in strings? */ findInStrings?: boolean; } /** * Rename request; value of command field is "rename". Return * response giving the file locations that reference the symbol * found in file at location line, col. Also return full display * name of the symbol so that client can print it unambiguously. */ export interface RenameRequest extends FileLocationRequest { command: CommandTypes.Rename; arguments: RenameRequestArgs; } /** * Information about the item to be renamed. */ export type RenameInfo = RenameInfoSuccess | RenameInfoFailure; export type RenameInfoSuccess = ChangePropertyTypes<ts.RenameInfoSuccess, { triggerSpan: TextSpan; }>; /** * A group of text spans, all in 'file'. */ export interface SpanGroup { /** The file to which the spans apply */ file: string; /** The text spans in this group */ locs: RenameTextSpan[]; } export interface RenameTextSpan extends TextSpanWithContext { readonly prefixText?: string; readonly suffixText?: string; } export interface RenameResponseBody { /** * Information about the item to be renamed. */ info: RenameInfo; /** * An array of span groups (one per file) that refer to the item to be renamed. */ locs: readonly SpanGroup[]; } /** * Rename response message. */ export interface RenameResponse extends Response { body?: RenameResponseBody; } /** * Represents a file in external project. * External project is project whose set of files, compilation options and open\close state * is maintained by the client (i.e. if all this data come from .csproj file in Visual Studio). * External project will exist even if all files in it are closed and should be closed explicitly. * If external project includes one or more tsconfig.json/jsconfig.json files then tsserver will * create configured project for every config file but will maintain a link that these projects were created * as a result of opening external project so they should be removed once external project is closed. */ export interface ExternalFile { /** * Name of file file */ fileName: string; /** * Script kind of the file */ scriptKind?: ScriptKindName | ScriptKind; /** * Whether file has mixed content (i.e. .cshtml file that combines html markup with C#/JavaScript) */ hasMixedContent?: boolean; /** * Content of the file */ content?: string; } /** * Represent an external project */ export interface ExternalProject { /** * Project name */ projectFileName: string; /** * List of root files in project */ rootFiles: ExternalFile[]; /** * Compiler options for the project */ options: ExternalProjectCompilerOptions; /** * Explicitly specified type acquisition for the project */ typeAcquisition?: TypeAcquisition; } export interface CompileOnSaveMixin { /** * If compile on save is enabled for the project */ compileOnSave?: boolean; } /** * For external projects, some of the project settings are sent together with * compiler settings. */ export type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin & WatchOptions; export interface FileWithProjectReferenceRedirectInfo { /** * Name of file */ fileName: string; /** * True if the file is primarily included in a referenced project */ isSourceOfProjectReferenceRedirect: boolean; } /** * Represents a set of changes that happen in project */ export interface ProjectChanges { /** * List of added files */ added: string[] | FileWithProjectReferenceRedirectInfo[]; /** * List of removed files */ removed: string[] | FileWithProjectReferenceRedirectInfo[]; /** * List of updated files */ updated: string[] | FileWithProjectReferenceRedirectInfo[]; /** * List of files that have had their project reference redirect status updated * Only provided when the synchronizeProjectList request has includeProjectReferenceRedirectInfo set to true */ updatedRedirects?: FileWithProjectReferenceRedirectInfo[]; } /** * Information found in a configure request. */ export interface ConfigureRequestArguments { /** * Information about the host, for example 'Emacs 24.4'