UNPKG

typescript

Version:

TypeScript is a language for application scale JavaScript development

1,176 lines (1,172 loc) • 585 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 { type ActionSet = "action::set"; type ActionInvalidate = "action::invalidate"; type ActionPackageInstalled = "action::packageInstalled"; type EventTypesRegistry = "event::typesRegistry"; type EventBeginInstallTypes = "event::beginInstallTypes"; type EventEndInstallTypes = "event::endInstallTypes"; type EventInitializationFailed = "event::initializationFailed"; type ActionWatchTypingLocations = "action::watchTypingLocations"; interface TypingInstallerResponse { readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed | ActionWatchTypingLocations; } interface TypingInstallerRequestWithProjectName { readonly projectName: string; } interface DiscoverTypings extends TypingInstallerRequestWithProjectName { readonly fileNames: string[]; readonly projectRootPath: Path; readonly compilerOptions: CompilerOptions; readonly typeAcquisition: TypeAcquisition; readonly unresolvedImports: SortedReadonlyArray<string>; readonly cachePath?: string; readonly kind: "discover"; } interface CloseProject extends TypingInstallerRequestWithProjectName { readonly kind: "closeProject"; } interface TypesRegistryRequest { readonly kind: "typesRegistry"; } interface InstallPackageRequest extends TypingInstallerRequestWithProjectName { readonly kind: "installPackage"; readonly fileName: Path; readonly packageName: string; readonly projectRootPath: Path; } interface PackageInstalledResponse extends ProjectResponse { readonly kind: ActionPackageInstalled; readonly success: boolean; readonly message: string; } interface InitializationFailedResponse extends TypingInstallerResponse { readonly kind: EventInitializationFailed; readonly message: string; readonly stack?: string; } interface ProjectResponse extends TypingInstallerResponse { readonly projectName: string; } interface InvalidateCachedTypings extends ProjectResponse { readonly kind: ActionInvalidate; } interface InstallTypes extends ProjectResponse { readonly kind: EventBeginInstallTypes | EventEndInstallTypes; readonly eventId: number; readonly typingsInstallerVersion: string; readonly packagesToInstall: readonly string[]; } interface BeginInstallTypes extends InstallTypes { readonly kind: EventBeginInstallTypes; } interface EndInstallTypes extends InstallTypes { readonly kind: EventEndInstallTypes; readonly installSuccess: boolean; } interface InstallTypingHost extends JsTyping.TypingResolutionHost { useCaseSensitiveFileNames: boolean; writeFile(path: string, content: string): void; createDirectory(path: string): void; getCurrentDirectory?(): string; } interface SetTypings extends ProjectResponse { readonly typeAcquisition: TypeAcquisition; readonly compilerOptions: CompilerOptions; readonly typings: string[]; readonly unresolvedImports: SortedReadonlyArray<string>; readonly kind: ActionSet; } interface WatchTypingLocations extends ProjectResponse { /** if files is undefined, retain same set of watchers */ readonly files: readonly string[] | undefined; readonly kind: ActionWatchTypingLocations; } namespace protocol { 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", OrganizeImports = "organizeImports", GetEditsForFileRename = "getEditsForFileRename", ConfigurePlugin = "configurePlugin", SelectionRange = "selectionRange", ToggleLineComment = "toggleLineComment", ToggleMultilineComment = "toggleMultilineComment", CommentSelection = "commentSelection", UncommentSelection = "uncommentSelection", PrepareCallHierarchy = "prepareCallHierarchy", ProvideCallHierarchyIncomingCalls = "provideCallHierarchyIncomingCalls", ProvideCallHierarchyOutgoingCalls = "provideCallHierarchyOutgoingCalls", ProvideInlayHints = "provideInlayHints" } /** * A TypeScript Server message */ interface Message { /** * Sequence number of the message */ seq: number; /** * One of "request", "response", or "event" */ type: "request" | "response" | "event"; } /** * Client-initiated request message */ 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 */ interface ReloadProjectsRequest extends Message { command: CommandTypes.ReloadProjects; } /** * Server-initiated event message */ interface Event extends Message { type: "event"; /** * Name of event */ event: string; /** * Event-specific information */ body?: any; } /** * Response by server to client request message. */ 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; } 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; } /** * Arguments for FileRequest messages. */ interface FileRequestArgs { /** * The file for the request (absolute pathname required). */ file: string; projectFileName?: string; } interface StatusRequest extends Request { command: CommandTypes.Status; } interface StatusResponseBody { /** * The TypeScript version (`ts.version`). */ version: string; } /** * Response to StatusRequest */ interface StatusResponse extends Response { body: StatusResponseBody; } /** * Requests a JS Doc comment template for a given position */ interface DocCommentTemplateRequest extends FileLocationRequest { command: CommandTypes.DocCommentTemplate; } /** * Response to DocCommentTemplateRequest */ interface DocCommandTemplateResponse extends Response { body?: TextInsertion; } /** * A request to get TODO comments from the file */ interface TodoCommentRequest extends FileRequest { command: CommandTypes.TodoComments; arguments: TodoCommentRequestArgs; } /** * Arguments for TodoCommentRequest request. */ interface TodoCommentRequestArgs extends FileRequestArgs { /** * Array of target TodoCommentDescriptors that describes TODO comments to be found */ descriptors: TodoCommentDescriptor[]; } /** * Response for TodoCommentRequest request. */ interface TodoCommentsResponse extends Response { body?: TodoComment[]; } /** * A request to determine if the caret is inside a comment. */ interface SpanOfEnclosingCommentRequest extends FileLocationRequest { command: CommandTypes.GetSpanOfEnclosingComment; arguments: SpanOfEnclosingCommentRequestArgs; } 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. */ interface OutliningSpansRequest extends FileRequest { command: CommandTypes.GetOutliningSpans; } interface OutliningSpan { /** The span of the document to actually collapse. */ textSpan: TextSpan; /** The span of the document to display when the user hovers over the collapsed span. */ hintSpan: TextSpan; /** The text to display in the editor for the collapsed region. */ bannerText: string; /** * Whether or not this region should be automatically collapsed when * the 'Collapse to Definitions' command is invoked. */ autoCollapse: boolean; /** * Classification of the contents of the span */ kind: OutliningSpanKind; } /** * Response to OutliningSpansRequest request. */ interface OutliningSpansResponse extends Response { body?: OutliningSpan[]; } /** * A request to get indentation for a location in file */ interface IndentationRequest extends FileLocationRequest { command: CommandTypes.Indentation; arguments: IndentationRequestArgs; } /** * Response for IndentationRequest request. */ interface IndentationResponse extends Response { body?: IndentationResult; } /** * Indentation result representing where indentation should be placed */ 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. */ 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. */ interface ProjectInfoRequestArgs extends FileRequestArgs { /** * Indicate if the file name list of the project is needed */ needFileNameList: boolean; } /** * A request to get the project information of the current file. */ interface ProjectInfoRequest extends Request { command: CommandTypes.ProjectInfo; arguments: ProjectInfoRequestArgs; } /** * A request to retrieve compiler options diagnostics for a project */ interface CompilerOptionsDiagnosticsRequest extends Request { arguments: CompilerOptionsDiagnosticsRequestArgs; } /** * Arguments for CompilerOptionsDiagnosticsRequest request. */ interface CompilerOptionsDiagnosticsRequestArgs { /** * Name of the project to retrieve compiler options diagnostics. */ projectFileName: string; } /** * Response message body for "projectInfo" request */ 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; } /** * 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. */ 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 */ interface ProjectInfoResponse extends Response { body?: ProjectInfo; } /** * Request whose sole parameter is a file name. */ 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. */ 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; } type FileLocationOrRangeRequestArgs = FileLocationRequestArgs | FileRangeRequestArgs; /** * Request refactorings at a given position or selection area. */ interface GetApplicableRefactorsRequest extends Request { command: CommandTypes.GetApplicableRefactors; arguments: GetApplicableRefactorsRequestArgs; } 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; }; type RefactorTriggerReason = "implicit" | "invoked"; /** * Response is a list of available refactorings. * Each refactoring exposes one or more "Actions"; a user selects one action to invoke a refactoring */ interface GetApplicableRefactorsResponse extends Response { body?: ApplicableRefactorInfo[]; } /** * Request refactorings at a given position or selection area to move to an existing file. */ interface GetMoveToRefactoringFileSuggestionsRequest extends Request { command: CommandTypes.GetMoveToRefactoringFileSuggestions; arguments: GetMoveToRefactoringFileSuggestionsRequestArgs; } 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 */ interface GetMoveToRefactoringFileSuggestions extends Response { body: { newFileName: string; files: string[]; }; } /** * A set of one or more available refactoring actions, grouped under a parent refactoring. */ interface ApplicableRefactorInfo { /** * The programmatic name of the refactoring */ name: string; /** * A description of this refactoring category to show to the user. * If the refactoring gets inlined (see below), this text will not be visible. */ description: string; /** * Inlineable refactorings can have their actions hoisted out to the top level * of a context menu. Non-inlineanable refactorings should always be shown inside * their parent grouping. * * If not specified, this value is assumed to be 'true' */ inlineable?: boolean; actions: RefactorActionInfo[]; } /** * Represents a single refactoring action - for example, the "Extract Method..." refactor might * offer several actions, each corresponding to a surround class or closure to extract into. */ interface RefactorActionInfo { /** * The programmatic name of the refactoring action */ name: string; /** * A description of this refactoring action to show to the user. * If the parent refactoring is inlined away, this will be the only text shown, * so this description should make sense by itself if the parent is inlineable=true */ description: string; /** * A message to show to the user if the refactoring cannot be applied in * the current context. */ notApplicableReason?: string; /** * The hierarchical dotted name of the refactor action. */ kind?: string; /** * Indicates that the action requires additional arguments to be passed * when calling 'GetEditsForRefactor'. */ isInteractive?: boolean; } 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. */ type GetEditsForRefactorRequestArgs = FileLocationOrRangeRequestArgs & { refactor: string; action: string; interactiveRefactorArguments?: InteractiveRefactorArguments; }; interface GetEditsForRefactorResponse extends Response { body?: RefactorEditInfo; } 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 */ interface OrganizeImportsRequest extends Request { command: CommandTypes.OrganizeImports; arguments: OrganizeImportsRequestArgs; } type OrganizeImportsScope = GetCombinedCodeFixScope; enum OrganizeImportsMode { All = "All", SortAndCombine = "SortAndCombine", RemoveUnused = "RemoveUnused" } interface OrganizeImportsRequestArgs { scope: OrganizeImportsScope; /** @deprecated Use `mode` instead */ skipDestructiveCodeActions?: boolean; mode?: OrganizeImportsMode; } interface OrganizeImportsResponse extends Response { body: readonly FileCodeEdits[]; } interface GetEditsForFileRenameRequest extends Request { command: CommandTypes.GetEditsForFileRename; arguments: GetEditsForFileRenameRequestArgs; } /** Note: Paths may also be directories. */ interface GetEditsForFileRenameRequestArgs { readonly oldFilePath: string; readonly newFilePath: string; } interface GetEditsForFileRenameResponse extends Response { body: readonly FileCodeEdits[]; } /** * Request for the available codefixes at a specific position. */ interface CodeFixRequest extends Request { command: CommandTypes.GetCodeFixes; arguments: CodeFixRequestArgs; } interface GetCombinedCodeFixRequest extends Request { command: CommandTypes.GetCombinedCodeFix; arguments: GetCombinedCodeFixRequestArgs; } interface GetCombinedCodeFixResponse extends Response { body: CombinedCodeActions; } interface ApplyCodeActionCommandRequest extends Request { command: CommandTypes.ApplyCodeActionCommand; arguments: ApplyCodeActionCommandRequestArgs; } interface ApplyCodeActionCommandResponse extends Response { } interface FileRangeRequestArgs extends FileRequestArgs { /** * The line number for the request (1-based). */ startLine: number; /** * The character offset (on the line) for the request (1-based). */ startOffset: number; /** * The line number for the request (1-based). */ endLine: number; /** * The character offset (on the line) for the request (1-based). */ endOffset: number; } /** * Instances of this interface specify errorcodes on a specific location in a sourcefile. */ interface CodeFixRequestArgs extends FileRangeRequestArgs { /** * Errorcodes we want to get the fixes for. */ errorCodes: readonly number[]; } interface GetCombinedCodeFixRequestArgs { scope: GetCombinedCodeFixScope; fixId: {}; } interface GetCombinedCodeFixScope { type: "file"; args: FileRequestArgs; } interface ApplyCodeActionCommandRequestArgs { /** May also be an array of commands. */ command: {}; } /** * Response for GetCodeFixes request. */ interface GetCodeFixesResponse extends Response { body?: CodeAction[]; } /** * A request whose arguments specify a file location (file, line, col). */ interface FileLocationRequest extends FileRequest { arguments: FileLocationRequestArgs; } /** * A request to get codes of supported code fixes. */ interface GetSupportedCodeFixesRequest extends Request { command: CommandTypes.GetSupportedCodeFixes; arguments?: Partial<FileRequestArgs>; } /** * A response for GetSupportedCodeFixesRequest request. */ 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 */ interface EncodedSemanticClassificationsRequest extends FileRequest { arguments: EncodedSemanticClassificationsRequestArgs; } /** * Arguments for EncodedSemanticClassificationsRequest request. */ 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 */ interface EncodedSemanticClassificationsResponse extends Response { body?: EncodedSemanticClassificationsResponseBody; } /** * Implementation response message. Gives series of text spans depending on the format ar. */ interface EncodedSemanticClassificationsResponseBody { endOfLineState: EndOfLineState; spans: number[]; } /** * Arguments in document highlight request; include: filesToSearch, file, * line, offset. */ 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. */ interface DefinitionRequest extends FileLocationRequest { command: CommandTypes.Definition; } interface DefinitionAndBoundSpanRequest extends FileLocationRequest { readonly command: CommandTypes.DefinitionAndBoundSpan; } interface FindSourceDefinitionRequest extends FileLocationRequest { readonly command: CommandTypes.FindSourceDefinition; } 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. */ 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. */ interface ImplementationRequest extends FileLocationRequest { command: CommandTypes.Implementation; } /** * Location in source code expressed as (one-based) line and (one-based) column offset. */ interface Location { line: number; offset: number; } /** * Object found in response messages defining a span of text in source code. */ 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. */ interface FileSpan extends TextSpan { /** * File containing text span. */ file: string; } 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[]; } interface TextSpanWithContext extends TextSpan { contextStart?: Location; contextEnd?: Location; } interface FileSpanWithContext extends FileSpan, TextSpanWithContext { } interface DefinitionInfo extends FileSpanWithContext { /** * When true, the file may or may not exist. */ unverified?: boolean; } interface DefinitionInfoAndBoundSpan { definitions: readonly DefinitionInfo[]; textSpan: TextSpan; } /** * Definition response message. Gives text range for definition. */ interface DefinitionResponse extends Response { body?: DefinitionInfo[]; } interface DefinitionInfoAndBoundSpanResponse extends Response { body?: DefinitionInfoAndBoundSpan; } /** @deprecated Use `DefinitionInfoAndBoundSpanResponse` instead. */ type DefinitionInfoAndBoundSpanReponse = DefinitionInfoAndBoundSpanResponse; /** * Definition response message. Gives text range for definition. */ interface TypeDefinitionResponse extends Response { body?: FileSpanWithContext[]; } /** * Implementation response message. Gives text range for implementations. */ interface ImplementationResponse extends Response { body?: FileSpanWithContext[]; } /** * Request to get brace completion for a location in the file. */ interface BraceCompletionRequest extends FileLocationRequest { command: CommandTypes.BraceCompletion; arguments: BraceCompletionRequestArgs; } /** * Argument for BraceCompletionRequest request. */ interface BraceCompletionRequestArgs extends FileLocationRequestArgs { /** * Kind of opening brace */ openingBrace: string; } interface JsxClosingTagRequest extends FileLocationRequest { readonly command: CommandTypes.JsxClosingTag; readonly arguments: JsxClosingTagRequestArgs; } interface JsxClosingTagRequestArgs extends FileLocationRequestArgs { } interface JsxClosingTagResponse extends Response { readonly body: TextInsertion; } interface LinkedEditingRangeRequest extends FileLocationRequest { readonly command: CommandTypes.LinkedEditingRange; } interface LinkedEditingRangesBody { ranges: TextSpan[]; wordPattern?: string; } 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. */ 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. */ interface HighlightSpan extends TextSpanWithContext { kind: HighlightSpanKind; } /** * Represents a set of highligh spans for a give name */ interface DocumentHighlightsItem { /** * File containing highlight spans. */ file: string; /** * Spans to highlight in file. */ highlightSpans: HighlightSpan[]; } /** * Response for a DocumentHighlightsRequest request. */ 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. */ interface ReferencesRequest extends FileLocationRequest { command: CommandTypes.References; } 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. */ 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. */ interface ReferencesResponse extends Response { body?: ReferencesResponseBody; } interface FileReferencesRequest extends FileRequest { command: CommandTypes.FileReferences; } interface FileReferencesResponseBody { /** * The file locations referencing the symbol. */ refs: readonly ReferencesResponseItem[]; /** * The name of the symbol. */ symbolName: string; } interface FileReferencesResponse extends Response { body?: FileReferencesResponseBody; } /** * Argument for RenameRequest request. */ 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. */ interface RenameRequest extends FileLocationRequest { command: CommandTypes.Rename; arguments: RenameRequestArgs; } /** * Information about the item to be renamed. */ type RenameInfo = RenameInfoSuccess | RenameInfoFailure; interface RenameInfoSuccess { /** * True if item can be renamed. */ canRename: true; /** * File or directory to rename. * If set, `getEditsForFileRename` should be called instead of `findRenameLocations`. */ fileToRename?: string; /** * Display name of the item to be renamed. */ displayName: string; /** * Full display name of item to be renamed. */ fullDisplayName: string; /** * The items's kind (such as 'className' or 'parameterName' or plain 'text'). */ kind: ScriptElementKind; /** * Optional modifiers for the kind (such as 'public'). */ kindModifiers: string; /** Span of text to rename. */ triggerSpan: TextSpan; } interface RenameInfoFailure { canRename: false; /** * Error message if item can not be renamed. */ localizedErrorMessage: string; } /** * A group of text spans, all in 'file'. */ interface SpanGroup { /** The file to which the spans apply */ file: string; /** The text spans in this group */ locs: RenameTextSpan[]; } interface RenameTextSpan extends TextSpanWithContext { readonly prefixText?: string; readonly suffixText?: string; } 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. */ 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. */ 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 */ interface ExternalProject { /** * Project name */ projectFileName: string; /** * List of root files in project */ rootFiles: ExternalFile[]; /**