2 * Declaration module describing the TypeScript Server protocol
4 declare namespace ts.server.protocol {
5 const enum CommandTypes {
6 JsxClosingTag = "jsxClosingTag",
8 BraceCompletion = "braceCompletion",
9 GetSpanOfEnclosingComment = "getSpanOfEnclosingComment",
12 /** @deprecated Prefer CompletionInfo -- see comment on CompletionsResponse */
13 Completions = "completions",
14 CompletionInfo = "completionInfo",
15 CompletionDetails = "completionEntryDetails",
16 CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList",
17 CompileOnSaveEmitFile = "compileOnSaveEmitFile",
18 Configure = "configure",
19 Definition = "definition",
20 DefinitionAndBoundSpan = "definitionAndBoundSpan",
21 Implementation = "implementation",
24 Formatonkey = "formatonkey",
26 GeterrForProject = "geterrForProject",
27 SemanticDiagnosticsSync = "semanticDiagnosticsSync",
28 SyntacticDiagnosticsSync = "syntacticDiagnosticsSync",
29 SuggestionDiagnosticsSync = "suggestionDiagnosticsSync",
33 NavTreeFull = "navtree-full",
35 Occurrences = "occurrences",
36 DocumentHighlights = "documentHighlights",
38 Quickinfo = "quickinfo",
39 References = "references",
43 SignatureHelp = "signatureHelp",
45 TypeDefinition = "typeDefinition",
46 ProjectInfo = "projectInfo",
47 ReloadProjects = "reloadProjects",
49 OpenExternalProject = "openExternalProject",
50 OpenExternalProjects = "openExternalProjects",
51 CloseExternalProject = "closeExternalProject",
52 UpdateOpen = "updateOpen",
53 GetOutliningSpans = "getOutliningSpans",
54 TodoComments = "todoComments",
55 Indentation = "indentation",
56 DocCommentTemplate = "docCommentTemplate",
57 CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects",
58 GetCodeFixes = "getCodeFixes",
59 GetCombinedCodeFix = "getCombinedCodeFix",
60 ApplyCodeActionCommand = "applyCodeActionCommand",
61 GetSupportedCodeFixes = "getSupportedCodeFixes",
62 GetApplicableRefactors = "getApplicableRefactors",
63 GetEditsForRefactor = "getEditsForRefactor",
64 OrganizeImports = "organizeImports",
65 GetEditsForFileRename = "getEditsForFileRename",
66 ConfigurePlugin = "configurePlugin",
67 SelectionRange = "selectionRange",
68 PrepareCallHierarchy = "prepareCallHierarchy",
69 ProvideCallHierarchyIncomingCalls = "provideCallHierarchyIncomingCalls",
70 ProvideCallHierarchyOutgoingCalls = "provideCallHierarchyOutgoingCalls"
73 * A TypeScript Server message
77 * Sequence number of the message
81 * One of "request", "response", or "event"
83 type: "request" | "response" | "event";
86 * Client-initiated request message
88 interface Request extends Message {
91 * The command to execute
95 * Object containing arguments for the command
100 * Request to reload the project structure for all the opened files
102 interface ReloadProjectsRequest extends Message {
103 command: CommandTypes.ReloadProjects;
106 * Server-initiated event message
108 interface Event extends Message {
115 * Event-specific information
120 * Response by server to client request message.
122 interface Response extends Message {
125 * Sequence number of the request message.
129 * Outcome of the request.
133 * The command requested.
137 * If success === false, this should always be provided.
138 * Otherwise, may (or may not) contain a success message.
142 * Contains message body if success === true.
146 * Contains extra information that plugin can include to be passed on
150 * Exposes information about the performance of this request-response pair.
152 performanceData?: PerformanceData;
154 interface PerformanceData {
156 * Time spent updating the program graph, in milliseconds.
158 updateGraphDurationMs?: number;
161 * Arguments for FileRequest messages.
163 interface FileRequestArgs {
165 * The file for the request (absolute pathname required).
168 projectFileName?: string;
170 interface StatusRequest extends Request {
171 command: CommandTypes.Status;
173 interface StatusResponseBody {
175 * The TypeScript version (`ts.version`).
180 * Response to StatusRequest
182 interface StatusResponse extends Response {
183 body: StatusResponseBody;
186 * Requests a JS Doc comment template for a given position
188 interface DocCommentTemplateRequest extends FileLocationRequest {
189 command: CommandTypes.DocCommentTemplate;
192 * Response to DocCommentTemplateRequest
194 interface DocCommandTemplateResponse extends Response {
195 body?: TextInsertion;
198 * A request to get TODO comments from the file
200 interface TodoCommentRequest extends FileRequest {
201 command: CommandTypes.TodoComments;
202 arguments: TodoCommentRequestArgs;
205 * Arguments for TodoCommentRequest request.
207 interface TodoCommentRequestArgs extends FileRequestArgs {
209 * Array of target TodoCommentDescriptors that describes TODO comments to be found
211 descriptors: TodoCommentDescriptor[];
214 * Response for TodoCommentRequest request.
216 interface TodoCommentsResponse extends Response {
217 body?: TodoComment[];
220 * A request to determine if the caret is inside a comment.
222 interface SpanOfEnclosingCommentRequest extends FileLocationRequest {
223 command: CommandTypes.GetSpanOfEnclosingComment;
224 arguments: SpanOfEnclosingCommentRequestArgs;
226 interface SpanOfEnclosingCommentRequestArgs extends FileLocationRequestArgs {
228 * Requires that the enclosing span be a multi-line comment, or else the request returns undefined.
230 onlyMultiLine: boolean;
233 * Request to obtain outlining spans in file.
235 interface OutliningSpansRequest extends FileRequest {
236 command: CommandTypes.GetOutliningSpans;
238 interface OutliningSpan {
239 /** The span of the document to actually collapse. */
241 /** The span of the document to display when the user hovers over the collapsed span. */
243 /** The text to display in the editor for the collapsed region. */
246 * Whether or not this region should be automatically collapsed when
247 * the 'Collapse to Definitions' command is invoked.
249 autoCollapse: boolean;
251 * Classification of the contents of the span
253 kind: OutliningSpanKind;
256 * Response to OutliningSpansRequest request.
258 interface OutliningSpansResponse extends Response {
259 body?: OutliningSpan[];
262 * A request to get indentation for a location in file
264 interface IndentationRequest extends FileLocationRequest {
265 command: CommandTypes.Indentation;
266 arguments: IndentationRequestArgs;
269 * Response for IndentationRequest request.
271 interface IndentationResponse extends Response {
272 body?: IndentationResult;
275 * Indentation result representing where indentation should be placed
277 interface IndentationResult {
279 * The base position in the document that the indent should be relative to
283 * The number of columns the indent should be at relative to the position's column.
288 * Arguments for IndentationRequest request.
290 interface IndentationRequestArgs extends FileLocationRequestArgs {
292 * An optional set of settings to be used when computing indentation.
293 * If argument is omitted - then it will use settings for file that were previously set via 'configure' request or global settings.
295 options?: EditorSettings;
298 * Arguments for ProjectInfoRequest request.
300 interface ProjectInfoRequestArgs extends FileRequestArgs {
302 * Indicate if the file name list of the project is needed
304 needFileNameList: boolean;
307 * A request to get the project information of the current file.
309 interface ProjectInfoRequest extends Request {
310 command: CommandTypes.ProjectInfo;
311 arguments: ProjectInfoRequestArgs;
314 * A request to retrieve compiler options diagnostics for a project
316 interface CompilerOptionsDiagnosticsRequest extends Request {
317 arguments: CompilerOptionsDiagnosticsRequestArgs;
320 * Arguments for CompilerOptionsDiagnosticsRequest request.
322 interface CompilerOptionsDiagnosticsRequestArgs {
324 * Name of the project to retrieve compiler options diagnostics.
326 projectFileName: string;
329 * Response message body for "projectInfo" request
331 interface ProjectInfo {
333 * For configured project, this is the normalized path of the 'tsconfig.json' file
334 * For inferred project, this is undefined
336 configFileName: string;
338 * The list of normalized file name in the project, including 'lib.d.ts'
340 fileNames?: string[];
342 * Indicates if the project has a active language service instance
344 languageServiceDisabled?: boolean;
347 * Represents diagnostic info that includes location of diagnostic in two forms
348 * - start position and length of the error span
349 * - startLocation and endLocation - a pair of Location objects that store start/end line and offset of the error span.
351 interface DiagnosticWithLinePosition {
355 startLocation: Location;
356 endLocation: Location;
359 /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */
360 reportsUnnecessary?: {};
361 relatedInformation?: DiagnosticRelatedInformation[];
364 * Response message for "projectInfo" request
366 interface ProjectInfoResponse extends Response {
370 * Request whose sole parameter is a file name.
372 interface FileRequest extends Request {
373 arguments: FileRequestArgs;
376 * Instances of this interface specify a location in a source file:
377 * (file, line, character offset), where line and character offset are 1-based.
379 interface FileLocationRequestArgs extends FileRequestArgs {
381 * The line number for the request (1-based).
385 * The character offset (on the line) for the request (1-based).
389 type FileLocationOrRangeRequestArgs = FileLocationRequestArgs | FileRangeRequestArgs;
391 * Request refactorings at a given position or selection area.
393 interface GetApplicableRefactorsRequest extends Request {
394 command: CommandTypes.GetApplicableRefactors;
395 arguments: GetApplicableRefactorsRequestArgs;
397 type GetApplicableRefactorsRequestArgs = FileLocationOrRangeRequestArgs;
399 * Response is a list of available refactorings.
400 * Each refactoring exposes one or more "Actions"; a user selects one action to invoke a refactoring
402 interface GetApplicableRefactorsResponse extends Response {
403 body?: ApplicableRefactorInfo[];
406 * A set of one or more available refactoring actions, grouped under a parent refactoring.
408 interface ApplicableRefactorInfo {
410 * The programmatic name of the refactoring
414 * A description of this refactoring category to show to the user.
415 * If the refactoring gets inlined (see below), this text will not be visible.
419 * Inlineable refactorings can have their actions hoisted out to the top level
420 * of a context menu. Non-inlineanable refactorings should always be shown inside
421 * their parent grouping.
423 * If not specified, this value is assumed to be 'true'
425 inlineable?: boolean;
426 actions: RefactorActionInfo[];
429 * Represents a single refactoring action - for example, the "Extract Method..." refactor might
430 * offer several actions, each corresponding to a surround class or closure to extract into.
432 interface RefactorActionInfo {
434 * The programmatic name of the refactoring action
438 * A description of this refactoring action to show to the user.
439 * If the parent refactoring is inlined away, this will be the only text shown,
440 * so this description should make sense by itself if the parent is inlineable=true
444 interface GetEditsForRefactorRequest extends Request {
445 command: CommandTypes.GetEditsForRefactor;
446 arguments: GetEditsForRefactorRequestArgs;
449 * Request the edits that a particular refactoring action produces.
450 * Callers must specify the name of the refactor and the name of the action.
452 type GetEditsForRefactorRequestArgs = FileLocationOrRangeRequestArgs & {
456 interface GetEditsForRefactorResponse extends Response {
457 body?: RefactorEditInfo;
459 interface RefactorEditInfo {
460 edits: FileCodeEdits[];
462 * An optional location where the editor should start a rename operation once
463 * the refactoring edits have been applied
465 renameLocation?: Location;
466 renameFilename?: string;
469 * Organize imports by:
470 * 1) Removing unused imports
471 * 2) Coalescing imports from the same module
474 interface OrganizeImportsRequest extends Request {
475 command: CommandTypes.OrganizeImports;
476 arguments: OrganizeImportsRequestArgs;
478 type OrganizeImportsScope = GetCombinedCodeFixScope;
479 interface OrganizeImportsRequestArgs {
480 scope: OrganizeImportsScope;
482 interface OrganizeImportsResponse extends Response {
483 body: readonly FileCodeEdits[];
485 interface GetEditsForFileRenameRequest extends Request {
486 command: CommandTypes.GetEditsForFileRename;
487 arguments: GetEditsForFileRenameRequestArgs;
489 /** Note: Paths may also be directories. */
490 interface GetEditsForFileRenameRequestArgs {
491 readonly oldFilePath: string;
492 readonly newFilePath: string;
494 interface GetEditsForFileRenameResponse extends Response {
495 body: readonly FileCodeEdits[];
498 * Request for the available codefixes at a specific position.
500 interface CodeFixRequest extends Request {
501 command: CommandTypes.GetCodeFixes;
502 arguments: CodeFixRequestArgs;
504 interface GetCombinedCodeFixRequest extends Request {
505 command: CommandTypes.GetCombinedCodeFix;
506 arguments: GetCombinedCodeFixRequestArgs;
508 interface GetCombinedCodeFixResponse extends Response {
509 body: CombinedCodeActions;
511 interface ApplyCodeActionCommandRequest extends Request {
512 command: CommandTypes.ApplyCodeActionCommand;
513 arguments: ApplyCodeActionCommandRequestArgs;
515 interface ApplyCodeActionCommandResponse extends Response {
517 interface FileRangeRequestArgs extends FileRequestArgs {
519 * The line number for the request (1-based).
523 * The character offset (on the line) for the request (1-based).
527 * The line number for the request (1-based).
531 * The character offset (on the line) for the request (1-based).
536 * Instances of this interface specify errorcodes on a specific location in a sourcefile.
538 interface CodeFixRequestArgs extends FileRangeRequestArgs {
540 * Errorcodes we want to get the fixes for.
542 errorCodes: readonly number[];
544 interface GetCombinedCodeFixRequestArgs {
545 scope: GetCombinedCodeFixScope;
548 interface GetCombinedCodeFixScope {
550 args: FileRequestArgs;
552 interface ApplyCodeActionCommandRequestArgs {
553 /** May also be an array of commands. */
557 * Response for GetCodeFixes request.
559 interface GetCodeFixesResponse extends Response {
563 * A request whose arguments specify a file location (file, line, col).
565 interface FileLocationRequest extends FileRequest {
566 arguments: FileLocationRequestArgs;
569 * A request to get codes of supported code fixes.
571 interface GetSupportedCodeFixesRequest extends Request {
572 command: CommandTypes.GetSupportedCodeFixes;
575 * A response for GetSupportedCodeFixesRequest request.
577 interface GetSupportedCodeFixesResponse extends Response {
579 * List of error codes supported by the server.
584 * Arguments in document highlight request; include: filesToSearch, file,
587 interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs {
589 * List of files to search for document highlights.
591 filesToSearch: string[];
594 * Go to definition request; value of command field is
595 * "definition". Return response giving the file locations that
596 * define the symbol found in file at location line, col.
598 interface DefinitionRequest extends FileLocationRequest {
599 command: CommandTypes.Definition;
601 interface DefinitionAndBoundSpanRequest extends FileLocationRequest {
602 readonly command: CommandTypes.DefinitionAndBoundSpan;
604 interface DefinitionAndBoundSpanResponse extends Response {
605 readonly body: DefinitionInfoAndBoundSpan;
608 * Go to type request; value of command field is
609 * "typeDefinition". Return response giving the file locations that
610 * define the type for the symbol found in file at location line, col.
612 interface TypeDefinitionRequest extends FileLocationRequest {
613 command: CommandTypes.TypeDefinition;
616 * Go to implementation request; value of command field is
617 * "implementation". Return response giving the file locations that
618 * implement the symbol found in file at location line, col.
620 interface ImplementationRequest extends FileLocationRequest {
621 command: CommandTypes.Implementation;
624 * Location in source code expressed as (one-based) line and (one-based) column offset.
631 * Object found in response messages defining a span of text in source code.
635 * First character of the definition.
639 * One character past last character of the definition.
644 * Object found in response messages defining a span of text in a specific source file.
646 interface FileSpan extends TextSpan {
648 * File containing text span.
652 interface TextSpanWithContext extends TextSpan {
653 contextStart?: Location;
654 contextEnd?: Location;
656 interface FileSpanWithContext extends FileSpan, TextSpanWithContext {
658 interface DefinitionInfoAndBoundSpan {
659 definitions: readonly FileSpanWithContext[];
663 * Definition response message. Gives text range for definition.
665 interface DefinitionResponse extends Response {
666 body?: FileSpanWithContext[];
668 interface DefinitionInfoAndBoundSpanResponse extends Response {
669 body?: DefinitionInfoAndBoundSpan;
671 /** @deprecated Use `DefinitionInfoAndBoundSpanResponse` instead. */
672 type DefinitionInfoAndBoundSpanReponse = DefinitionInfoAndBoundSpanResponse;
674 * Definition response message. Gives text range for definition.
676 interface TypeDefinitionResponse extends Response {
677 body?: FileSpanWithContext[];
680 * Implementation response message. Gives text range for implementations.
682 interface ImplementationResponse extends Response {
683 body?: FileSpanWithContext[];
686 * Request to get brace completion for a location in the file.
688 interface BraceCompletionRequest extends FileLocationRequest {
689 command: CommandTypes.BraceCompletion;
690 arguments: BraceCompletionRequestArgs;
693 * Argument for BraceCompletionRequest request.
695 interface BraceCompletionRequestArgs extends FileLocationRequestArgs {
697 * Kind of opening brace
699 openingBrace: string;
701 interface JsxClosingTagRequest extends FileLocationRequest {
702 readonly command: CommandTypes.JsxClosingTag;
703 readonly arguments: JsxClosingTagRequestArgs;
705 interface JsxClosingTagRequestArgs extends FileLocationRequestArgs {
707 interface JsxClosingTagResponse extends Response {
708 readonly body: TextInsertion;
712 * Get occurrences request; value of command field is
713 * "occurrences". Return response giving spans that are relevant
714 * in the file at a given line and column.
716 interface OccurrencesRequest extends FileLocationRequest {
717 command: CommandTypes.Occurrences;
720 interface OccurrencesResponseItem extends FileSpanWithContext {
722 * True if the occurrence is a write location, false otherwise.
724 isWriteAccess: boolean;
726 * True if the occurrence is in a string, undefined otherwise;
731 interface OccurrencesResponse extends Response {
732 body?: OccurrencesResponseItem[];
735 * Get document highlights request; value of command field is
736 * "documentHighlights". Return response giving spans that are relevant
737 * in the file at a given line and column.
739 interface DocumentHighlightsRequest extends FileLocationRequest {
740 command: CommandTypes.DocumentHighlights;
741 arguments: DocumentHighlightsRequestArgs;
744 * Span augmented with extra information that denotes the kind of the highlighting to be used for span.
746 interface HighlightSpan extends TextSpanWithContext {
747 kind: HighlightSpanKind;
750 * Represents a set of highligh spans for a give name
752 interface DocumentHighlightsItem {
754 * File containing highlight spans.
758 * Spans to highlight in file.
760 highlightSpans: HighlightSpan[];
763 * Response for a DocumentHighlightsRequest request.
765 interface DocumentHighlightsResponse extends Response {
766 body?: DocumentHighlightsItem[];
769 * Find references request; value of command field is
770 * "references". Return response giving the file locations that
771 * reference the symbol found in file at location line, col.
773 interface ReferencesRequest extends FileLocationRequest {
774 command: CommandTypes.References;
776 interface ReferencesResponseItem extends FileSpanWithContext {
777 /** Text of line containing the reference. Including this
778 * with the response avoids latency of editor loading files
779 * to show text of reference line (the server already has
780 * loaded the referencing files).
784 * True if reference is a write location, false otherwise.
786 isWriteAccess: boolean;
788 * True if reference is a definition, false otherwise.
790 isDefinition: boolean;
793 * The body of a "references" response message.
795 interface ReferencesResponseBody {
797 * The file locations referencing the symbol.
799 refs: readonly ReferencesResponseItem[];
801 * The name of the symbol.
805 * The start character offset of the symbol (on the line provided by the references request).
807 symbolStartOffset: number;
809 * The full display name of the symbol.
811 symbolDisplayString: string;
814 * Response to "references" request.
816 interface ReferencesResponse extends Response {
817 body?: ReferencesResponseBody;
820 * Argument for RenameRequest request.
822 interface RenameRequestArgs extends FileLocationRequestArgs {
824 * Should text at specified location be found/changed in comments?
826 findInComments?: boolean;
828 * Should text at specified location be found/changed in strings?
830 findInStrings?: boolean;
833 * Rename request; value of command field is "rename". Return
834 * response giving the file locations that reference the symbol
835 * found in file at location line, col. Also return full display
836 * name of the symbol so that client can print it unambiguously.
838 interface RenameRequest extends FileLocationRequest {
839 command: CommandTypes.Rename;
840 arguments: RenameRequestArgs;
843 * Information about the item to be renamed.
845 type RenameInfo = RenameInfoSuccess | RenameInfoFailure;
846 interface RenameInfoSuccess {
848 * True if item can be renamed.
852 * File or directory to rename.
853 * If set, `getEditsForFileRename` should be called instead of `findRenameLocations`.
855 fileToRename?: string;
857 * Display name of the item to be renamed.
861 * Full display name of item to be renamed.
863 fullDisplayName: string;
865 * The items's kind (such as 'className' or 'parameterName' or plain 'text').
867 kind: ScriptElementKind;
869 * Optional modifiers for the kind (such as 'public').
871 kindModifiers: string;
872 /** Span of text to rename. */
873 triggerSpan: TextSpan;
875 interface RenameInfoFailure {
878 * Error message if item can not be renamed.
880 localizedErrorMessage: string;
883 * A group of text spans, all in 'file'.
885 interface SpanGroup {
886 /** The file to which the spans apply */
888 /** The text spans in this group */
889 locs: RenameTextSpan[];
891 interface RenameTextSpan extends TextSpanWithContext {
892 readonly prefixText?: string;
893 readonly suffixText?: string;
895 interface RenameResponseBody {
897 * Information about the item to be renamed.
901 * An array of span groups (one per file) that refer to the item to be renamed.
903 locs: readonly SpanGroup[];
906 * Rename response message.
908 interface RenameResponse extends Response {
909 body?: RenameResponseBody;
912 * Represents a file in external project.
913 * External project is project whose set of files, compilation options and open\close state
914 * is maintained by the client (i.e. if all this data come from .csproj file in Visual Studio).
915 * External project will exist even if all files in it are closed and should be closed explicitly.
916 * If external project includes one or more tsconfig.json/jsconfig.json files then tsserver will
917 * create configured project for every config file but will maintain a link that these projects were created
918 * as a result of opening external project so they should be removed once external project is closed.
920 interface ExternalFile {
926 * Script kind of the file
928 scriptKind?: ScriptKindName | ts.ScriptKind;
930 * Whether file has mixed content (i.e. .cshtml file that combines html markup with C#/JavaScript)
932 hasMixedContent?: boolean;
934 * Content of the file
939 * Represent an external project
941 interface ExternalProject {
945 projectFileName: string;
947 * List of root files in project
949 rootFiles: ExternalFile[];
951 * Compiler options for the project
953 options: ExternalProjectCompilerOptions;
955 * @deprecated typingOptions. Use typeAcquisition instead
957 typingOptions?: TypeAcquisition;
959 * Explicitly specified type acquisition for the project
961 typeAcquisition?: TypeAcquisition;
963 interface CompileOnSaveMixin {
965 * If compile on save is enabled for the project
967 compileOnSave?: boolean;
970 * For external projects, some of the project settings are sent together with
973 type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin & WatchOptions;
974 interface FileWithProjectReferenceRedirectInfo {
980 * True if the file is primarily included in a referenced project
982 isSourceOfProjectReferenceRedirect: boolean;
985 * Represents a set of changes that happen in project
987 interface ProjectChanges {
989 * List of added files
991 added: string[] | FileWithProjectReferenceRedirectInfo[];
993 * List of removed files
995 removed: string[] | FileWithProjectReferenceRedirectInfo[];
997 * List of updated files
999 updated: string[] | FileWithProjectReferenceRedirectInfo[];
1001 * List of files that have had their project reference redirect status updated
1002 * Only provided when the synchronizeProjectList request has includeProjectReferenceRedirectInfo set to true
1004 updatedRedirects?: FileWithProjectReferenceRedirectInfo[];
1007 * Information found in a configure request.
1009 interface ConfigureRequestArguments {
1011 * Information about the host, for example 'Emacs 24.4' or
1012 * 'Sublime Text version 3075'
1016 * If present, tab settings apply only to this file.
1020 * The format options to use during formatting and other code editing features.
1022 formatOptions?: FormatCodeSettings;
1023 preferences?: UserPreferences;
1025 * The host's additional supported .js file extensions
1027 extraFileExtensions?: FileExtensionInfo[];
1028 watchOptions?: WatchOptions;
1030 const enum WatchFileKind {
1031 FixedPollingInterval = "FixedPollingInterval",
1032 PriorityPollingInterval = "PriorityPollingInterval",
1033 DynamicPriorityPolling = "DynamicPriorityPolling",
1034 UseFsEvents = "UseFsEvents",
1035 UseFsEventsOnParentDirectory = "UseFsEventsOnParentDirectory"
1037 const enum WatchDirectoryKind {
1038 UseFsEvents = "UseFsEvents",
1039 FixedPollingInterval = "FixedPollingInterval",
1040 DynamicPriorityPolling = "DynamicPriorityPolling"
1042 const enum PollingWatchKind {
1043 FixedInterval = "FixedInterval",
1044 PriorityInterval = "PriorityInterval",
1045 DynamicPriority = "DynamicPriority"
1047 interface WatchOptions {
1048 watchFile?: WatchFileKind | ts.WatchFileKind;
1049 watchDirectory?: WatchDirectoryKind | ts.WatchDirectoryKind;
1050 fallbackPolling?: PollingWatchKind | ts.PollingWatchKind;
1051 synchronousWatchDirectory?: boolean;
1052 [option: string]: CompilerOptionsValue | undefined;
1055 * Configure request; value of command field is "configure". Specifies
1056 * host information, such as host type, tab size, and indent size.
1058 interface ConfigureRequest extends Request {
1059 command: CommandTypes.Configure;
1060 arguments: ConfigureRequestArguments;
1063 * Response to "configure" request. This is just an acknowledgement, so
1064 * no body field is required.
1066 interface ConfigureResponse extends Response {
1068 interface ConfigurePluginRequestArguments {
1072 interface ConfigurePluginRequest extends Request {
1073 command: CommandTypes.ConfigurePlugin;
1074 arguments: ConfigurePluginRequestArguments;
1076 interface ConfigurePluginResponse extends Response {
1078 interface SelectionRangeRequest extends FileRequest {
1079 command: CommandTypes.SelectionRange;
1080 arguments: SelectionRangeRequestArgs;
1082 interface SelectionRangeRequestArgs extends FileRequestArgs {
1083 locations: Location[];
1085 interface SelectionRangeResponse extends Response {
1086 body?: SelectionRange[];
1088 interface SelectionRange {
1090 parent?: SelectionRange;
1093 * Information found in an "open" request.
1095 interface OpenRequestArgs extends FileRequestArgs {
1097 * Used when a version of the file content is known to be more up to date than the one on disk.
1098 * Then the known content will be used upon opening instead of the disk copy
1100 fileContent?: string;
1102 * Used to specify the script kind of the file explicitly. It could be one of the following:
1103 * "TS", "JS", "TSX", "JSX"
1105 scriptKindName?: ScriptKindName;
1107 * Used to limit the searching for project config file. If given the searching will stop at this
1108 * root path; otherwise it will go all the way up to the dist root path.
1110 projectRootPath?: string;
1112 type ScriptKindName = "TS" | "JS" | "TSX" | "JSX";
1114 * Open request; value of command field is "open". Notify the
1115 * server that the client has file open. The server will not
1116 * monitor the filesystem for changes in this file and will assume
1117 * that the client is updating the server (using the change and/or
1118 * reload messages) when the file changes. Server does not currently
1119 * send a response to an open request.
1121 interface OpenRequest extends Request {
1122 command: CommandTypes.Open;
1123 arguments: OpenRequestArgs;
1126 * Request to open or update external project
1128 interface OpenExternalProjectRequest extends Request {
1129 command: CommandTypes.OpenExternalProject;
1130 arguments: OpenExternalProjectArgs;
1133 * Arguments to OpenExternalProjectRequest request
1135 type OpenExternalProjectArgs = ExternalProject;
1137 * Request to open multiple external projects
1139 interface OpenExternalProjectsRequest extends Request {
1140 command: CommandTypes.OpenExternalProjects;
1141 arguments: OpenExternalProjectsArgs;
1144 * Arguments to OpenExternalProjectsRequest
1146 interface OpenExternalProjectsArgs {
1148 * List of external projects to open or update
1150 projects: ExternalProject[];
1153 * Response to OpenExternalProjectRequest request. This is just an acknowledgement, so
1154 * no body field is required.
1156 interface OpenExternalProjectResponse extends Response {
1159 * Response to OpenExternalProjectsRequest request. This is just an acknowledgement, so
1160 * no body field is required.
1162 interface OpenExternalProjectsResponse extends Response {
1165 * Request to close external project.
1167 interface CloseExternalProjectRequest extends Request {
1168 command: CommandTypes.CloseExternalProject;
1169 arguments: CloseExternalProjectRequestArgs;
1172 * Arguments to CloseExternalProjectRequest request
1174 interface CloseExternalProjectRequestArgs {
1176 * Name of the project to close
1178 projectFileName: string;
1181 * Response to CloseExternalProjectRequest request. This is just an acknowledgement, so
1182 * no body field is required.
1184 interface CloseExternalProjectResponse extends Response {
1187 * Request to synchronize list of open files with the client
1189 interface UpdateOpenRequest extends Request {
1190 command: CommandTypes.UpdateOpen;
1191 arguments: UpdateOpenRequestArgs;
1194 * Arguments to UpdateOpenRequest
1196 interface UpdateOpenRequestArgs {
1198 * List of newly open files
1200 openFiles?: OpenRequestArgs[];
1202 * List of open files files that were changes
1204 changedFiles?: FileCodeEdits[];
1206 * List of files that were closed
1208 closedFiles?: string[];
1211 * Request to set compiler options for inferred projects.
1212 * External projects are opened / closed explicitly.
1213 * Configured projects are opened when user opens loose file that has 'tsconfig.json' or 'jsconfig.json' anywhere in one of containing folders.
1214 * This configuration file will be used to obtain a list of files and configuration settings for the project.
1215 * Inferred projects are created when user opens a loose file that is not the part of external project
1216 * or configured project and will contain only open file and transitive closure of referenced files if 'useOneInferredProject' is false,
1217 * or all open loose files and its transitive closure of referenced files if 'useOneInferredProject' is true.
1219 interface SetCompilerOptionsForInferredProjectsRequest extends Request {
1220 command: CommandTypes.CompilerOptionsForInferredProjects;
1221 arguments: SetCompilerOptionsForInferredProjectsArgs;
1224 * Argument for SetCompilerOptionsForInferredProjectsRequest request.
1226 interface SetCompilerOptionsForInferredProjectsArgs {
1228 * Compiler options to be used with inferred projects.
1230 options: ExternalProjectCompilerOptions;
1232 * Specifies the project root path used to scope compiler options.
1233 * It is an error to provide this property if the server has not been started with
1234 * `useInferredProjectPerProjectRoot` enabled.
1236 projectRootPath?: string;
1239 * Response to SetCompilerOptionsForInferredProjectsResponse request. This is just an acknowledgement, so
1240 * no body field is required.
1242 interface SetCompilerOptionsForInferredProjectsResponse extends Response {
1245 * Exit request; value of command field is "exit". Ask the server process
1248 interface ExitRequest extends Request {
1249 command: CommandTypes.Exit;
1252 * Close request; value of command field is "close". Notify the
1253 * server that the client has closed a previously open file. If
1254 * file is still referenced by open files, the server will resume
1255 * monitoring the filesystem for changes to file. Server does not
1256 * currently send a response to a close request.
1258 interface CloseRequest extends FileRequest {
1259 command: CommandTypes.Close;
1262 * Request to obtain the list of files that should be regenerated if target file is recompiled.
1263 * NOTE: this us query-only operation and does not generate any output on disk.
1265 interface CompileOnSaveAffectedFileListRequest extends FileRequest {
1266 command: CommandTypes.CompileOnSaveAffectedFileList;
1269 * Contains a list of files that should be regenerated in a project
1271 interface CompileOnSaveAffectedFileListSingleProject {
1275 projectFileName: string;
1277 * List of files names that should be recompiled
1279 fileNames: string[];
1281 * true if project uses outFile or out compiler option
1283 projectUsesOutFile: boolean;
1286 * Response for CompileOnSaveAffectedFileListRequest request;
1288 interface CompileOnSaveAffectedFileListResponse extends Response {
1289 body: CompileOnSaveAffectedFileListSingleProject[];
1292 * Request to recompile the file. All generated outputs (.js, .d.ts or .js.map files) is written on disk.
1294 interface CompileOnSaveEmitFileRequest extends FileRequest {
1295 command: CommandTypes.CompileOnSaveEmitFile;
1296 arguments: CompileOnSaveEmitFileRequestArgs;
1299 * Arguments for CompileOnSaveEmitFileRequest
1301 interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs {
1303 * if true - then file should be recompiled even if it does not have any changes.
1306 includeLinePosition?: boolean;
1307 /** if true - return response as object with emitSkipped and diagnostics */
1308 richResponse?: boolean;
1310 interface CompileOnSaveEmitFileResponse extends Response {
1311 body: boolean | EmitResult;
1313 interface EmitResult {
1314 emitSkipped: boolean;
1315 diagnostics: Diagnostic[] | DiagnosticWithLinePosition[];
1318 * Quickinfo request; value of command field is
1319 * "quickinfo". Return response giving a quick type and
1320 * documentation string for the symbol found in file at location
1323 interface QuickInfoRequest extends FileLocationRequest {
1324 command: CommandTypes.Quickinfo;
1327 * Body of QuickInfoResponse.
1329 interface QuickInfoResponseBody {
1331 * The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
1333 kind: ScriptElementKind;
1335 * Optional modifiers for the kind (such as 'public').
1337 kindModifiers: string;
1339 * Starting file location of symbol.
1343 * One past last character of symbol.
1347 * Type and kind of symbol.
1349 displayString: string;
1351 * Documentation associated with symbol.
1353 documentation: string;
1355 * JSDoc tags associated with symbol.
1357 tags: JSDocTagInfo[];
1360 * Quickinfo response message.
1362 interface QuickInfoResponse extends Response {
1363 body?: QuickInfoResponseBody;
1366 * Arguments for format messages.
1368 interface FormatRequestArgs extends FileLocationRequestArgs {
1370 * Last line of range for which to format text in file.
1374 * Character offset on last line of range for which to format text in file.
1378 * Format options to be used.
1380 options?: FormatCodeSettings;
1383 * Format request; value of command field is "format". Return
1384 * response giving zero or more edit instructions. The edit
1385 * instructions will be sorted in file order. Applying the edit
1386 * instructions in reverse to file will result in correctly
1389 interface FormatRequest extends FileLocationRequest {
1390 command: CommandTypes.Format;
1391 arguments: FormatRequestArgs;
1394 * Object found in response messages defining an editing
1395 * instruction for a span of text in source code. The effect of
1396 * this instruction is to replace the text starting at start and
1397 * ending one character before end with newText. For an insertion,
1398 * the text span is empty. For a deletion, newText is empty.
1400 interface CodeEdit {
1402 * First character of the text span to edit.
1406 * One character past last character of the text span to edit.
1410 * Replace the span defined above with this string (may be
1411 * the empty string).
1415 interface FileCodeEdits {
1417 textChanges: CodeEdit[];
1419 interface CodeFixResponse extends Response {
1420 /** The code actions that are available */
1421 body?: CodeFixAction[];
1423 interface CodeAction {
1424 /** Description of the code action to display in the UI of the editor */
1425 description: string;
1426 /** Text changes to apply to each file as part of the code action */
1427 changes: FileCodeEdits[];
1428 /** A command is an opaque object that should be passed to `ApplyCodeActionCommandRequestArgs` without modification. */
1431 interface CombinedCodeActions {
1432 changes: readonly FileCodeEdits[];
1433 commands?: readonly {}[];
1435 interface CodeFixAction extends CodeAction {
1436 /** Short name to identify the fix, for use by telemetry. */
1439 * If present, one may call 'getCombinedCodeFix' with this fixId.
1440 * This may be omitted to indicate that the code fix can't be applied in a group.
1443 /** Should be present if and only if 'fixId' is. */
1444 fixAllDescription?: string;
1447 * Format and format on key response message.
1449 interface FormatResponse extends Response {
1453 * Arguments for format on key messages.
1455 interface FormatOnKeyRequestArgs extends FileLocationRequestArgs {
1457 * Key pressed (';', '\n', or '}').
1460 options?: FormatCodeSettings;
1463 * Format on key request; value of command field is
1464 * "formatonkey". Given file location and key typed (as string),
1465 * return response giving zero or more edit instructions. The
1466 * edit instructions will be sorted in file order. Applying the
1467 * edit instructions in reverse to file will result in correctly
1470 interface FormatOnKeyRequest extends FileLocationRequest {
1471 command: CommandTypes.Formatonkey;
1472 arguments: FormatOnKeyRequestArgs;
1474 type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#";
1476 * Arguments for completions messages.
1478 interface CompletionsRequestArgs extends FileLocationRequestArgs {
1480 * Optional prefix to apply to possible completions.
1484 * Character that was responsible for triggering completion.
1485 * Should be `undefined` if a user manually requested completion.
1487 triggerCharacter?: CompletionsTriggerCharacter;
1489 * @deprecated Use UserPreferences.includeCompletionsForModuleExports
1491 includeExternalModuleExports?: boolean;
1493 * @deprecated Use UserPreferences.includeCompletionsWithInsertText
1495 includeInsertTextCompletions?: boolean;
1498 * Completions request; value of command field is "completions".
1499 * Given a file location (file, line, col) and a prefix (which may
1500 * be the empty string), return the possible completions that
1501 * begin with prefix.
1503 interface CompletionsRequest extends FileLocationRequest {
1504 command: CommandTypes.Completions | CommandTypes.CompletionInfo;
1505 arguments: CompletionsRequestArgs;
1508 * Arguments for completion details request.
1510 interface CompletionDetailsRequestArgs extends FileLocationRequestArgs {
1512 * Names of one or more entries for which to obtain details.
1514 entryNames: (string | CompletionEntryIdentifier)[];
1516 interface CompletionEntryIdentifier {
1521 * Completion entry details request; value of command field is
1522 * "completionEntryDetails". Given a file location (file, line,
1523 * col) and an array of completion entry names return more
1524 * detailed information for each completion entry.
1526 interface CompletionDetailsRequest extends FileLocationRequest {
1527 command: CommandTypes.CompletionDetails;
1528 arguments: CompletionDetailsRequestArgs;
1531 * Part of a symbol description.
1533 interface SymbolDisplayPart {
1535 * Text of an item describing the symbol.
1539 * The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
1544 * An item found in a completion response.
1546 interface CompletionEntry {
1548 * The symbol's name.
1552 * The symbol's kind (such as 'className' or 'parameterName').
1554 kind: ScriptElementKind;
1556 * Optional modifiers for the kind (such as 'public').
1558 kindModifiers?: string;
1560 * A string that is used for comparing completion items so that they can be ordered. This
1561 * is often the same as the name but may be different in certain circumstances.
1565 * Text to insert instead of `name`.
1566 * This is used to support bracketed completions; If `name` might be "a-b" but `insertText` would be `["a-b"]`,
1567 * coupled with `replacementSpan` to replace a dotted access with a bracket access.
1569 insertText?: string;
1571 * An optional span that indicates the text to be replaced by this completion item.
1572 * If present, this span should be used instead of the default one.
1573 * It will be set if the required span differs from the one generated by the default replacement behavior.
1575 replacementSpan?: TextSpan;
1577 * Indicates whether commiting this completion entry will require additional code actions to be
1578 * made to avoid errors. The CompletionEntryDetails will have these actions.
1582 * Identifier (not necessarily human-readable) identifying where this completion came from.
1586 * If true, this completion should be highlighted as recommended. There will only be one of these.
1587 * This will be set when we know the user should write an expression with a certain type and that type is an enum or constructable class.
1588 * Then either that enum/class or a namespace containing it will be the recommended symbol.
1590 isRecommended?: true;
1592 * If true, this completion was generated from traversing the name table of an unchecked JS file,
1593 * and therefore may not be accurate.
1595 isFromUncheckedFile?: true;
1598 * Additional completion entry details, available on demand
1600 interface CompletionEntryDetails {
1602 * The symbol's name.
1606 * The symbol's kind (such as 'className' or 'parameterName').
1608 kind: ScriptElementKind;
1610 * Optional modifiers for the kind (such as 'public').
1612 kindModifiers: string;
1614 * Display parts of the symbol (similar to quick info).
1616 displayParts: SymbolDisplayPart[];
1618 * Documentation strings for the symbol.
1620 documentation?: SymbolDisplayPart[];
1622 * JSDoc tags for the symbol.
1624 tags?: JSDocTagInfo[];
1626 * The associated code actions for this entry
1628 codeActions?: CodeAction[];
1630 * Human-readable description of the `source` from the CompletionEntry.
1632 source?: SymbolDisplayPart[];
1634 /** @deprecated Prefer CompletionInfoResponse, which supports several top-level fields in addition to the array of entries. */
1635 interface CompletionsResponse extends Response {
1636 body?: CompletionEntry[];
1638 interface CompletionInfoResponse extends Response {
1639 body?: CompletionInfo;
1641 interface CompletionInfo {
1642 readonly isGlobalCompletion: boolean;
1643 readonly isMemberCompletion: boolean;
1644 readonly isNewIdentifierLocation: boolean;
1645 readonly entries: readonly CompletionEntry[];
1647 interface CompletionDetailsResponse extends Response {
1648 body?: CompletionEntryDetails[];
1651 * Signature help information for a single parameter
1653 interface SignatureHelpParameter {
1655 * The parameter's name
1659 * Documentation of the parameter.
1661 documentation: SymbolDisplayPart[];
1663 * Display parts of the parameter.
1665 displayParts: SymbolDisplayPart[];
1667 * Whether the parameter is optional or not.
1669 isOptional: boolean;
1672 * Represents a single signature to show in signature help.
1674 interface SignatureHelpItem {
1676 * Whether the signature accepts a variable number of arguments.
1678 isVariadic: boolean;
1680 * The prefix display parts.
1682 prefixDisplayParts: SymbolDisplayPart[];
1684 * The suffix display parts.
1686 suffixDisplayParts: SymbolDisplayPart[];
1688 * The separator display parts.
1690 separatorDisplayParts: SymbolDisplayPart[];
1692 * The signature helps items for the parameters.
1694 parameters: SignatureHelpParameter[];
1696 * The signature's documentation
1698 documentation: SymbolDisplayPart[];
1700 * The signature's JSDoc tags
1702 tags: JSDocTagInfo[];
1705 * Signature help items found in the response of a signature help request.
1707 interface SignatureHelpItems {
1709 * The signature help items.
1711 items: SignatureHelpItem[];
1713 * The span for which signature help should appear on a signature
1715 applicableSpan: TextSpan;
1717 * The item selected in the set of available help items.
1719 selectedItemIndex: number;
1721 * The argument selected in the set of parameters.
1723 argumentIndex: number;
1725 * The argument count
1727 argumentCount: number;
1729 type SignatureHelpTriggerCharacter = "," | "(" | "<";
1730 type SignatureHelpRetriggerCharacter = SignatureHelpTriggerCharacter | ")";
1732 * Arguments of a signature help request.
1734 interface SignatureHelpRequestArgs extends FileLocationRequestArgs {
1736 * Reason why signature help was invoked.
1737 * See each individual possible
1739 triggerReason?: SignatureHelpTriggerReason;
1741 type SignatureHelpTriggerReason = SignatureHelpInvokedReason | SignatureHelpCharacterTypedReason | SignatureHelpRetriggeredReason;
1743 * Signals that the user manually requested signature help.
1744 * The language service will unconditionally attempt to provide a result.
1746 interface SignatureHelpInvokedReason {
1748 triggerCharacter?: undefined;
1751 * Signals that the signature help request came from a user typing a character.
1752 * Depending on the character and the syntactic context, the request may or may not be served a result.
1754 interface SignatureHelpCharacterTypedReason {
1755 kind: "characterTyped";
1757 * Character that was responsible for triggering signature help.
1759 triggerCharacter: SignatureHelpTriggerCharacter;
1762 * Signals that this signature help request came from typing a character or moving the cursor.
1763 * This should only occur if a signature help session was already active and the editor needs to see if it should adjust.
1764 * The language service will unconditionally attempt to provide a result.
1765 * `triggerCharacter` can be `undefined` for a retrigger caused by a cursor move.
1767 interface SignatureHelpRetriggeredReason {
1770 * Character that was responsible for triggering signature help.
1772 triggerCharacter?: SignatureHelpRetriggerCharacter;
1775 * Signature help request; value of command field is "signatureHelp".
1776 * Given a file location (file, line, col), return the signature
1779 interface SignatureHelpRequest extends FileLocationRequest {
1780 command: CommandTypes.SignatureHelp;
1781 arguments: SignatureHelpRequestArgs;
1784 * Response object for a SignatureHelpRequest.
1786 interface SignatureHelpResponse extends Response {
1787 body?: SignatureHelpItems;
1790 * Synchronous request for semantic diagnostics of one file.
1792 interface SemanticDiagnosticsSyncRequest extends FileRequest {
1793 command: CommandTypes.SemanticDiagnosticsSync;
1794 arguments: SemanticDiagnosticsSyncRequestArgs;
1796 interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs {
1797 includeLinePosition?: boolean;
1800 * Response object for synchronous sematic diagnostics request.
1802 interface SemanticDiagnosticsSyncResponse extends Response {
1803 body?: Diagnostic[] | DiagnosticWithLinePosition[];
1805 interface SuggestionDiagnosticsSyncRequest extends FileRequest {
1806 command: CommandTypes.SuggestionDiagnosticsSync;
1807 arguments: SuggestionDiagnosticsSyncRequestArgs;
1809 type SuggestionDiagnosticsSyncRequestArgs = SemanticDiagnosticsSyncRequestArgs;
1810 type SuggestionDiagnosticsSyncResponse = SemanticDiagnosticsSyncResponse;
1812 * Synchronous request for syntactic diagnostics of one file.
1814 interface SyntacticDiagnosticsSyncRequest extends FileRequest {
1815 command: CommandTypes.SyntacticDiagnosticsSync;
1816 arguments: SyntacticDiagnosticsSyncRequestArgs;
1818 interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs {
1819 includeLinePosition?: boolean;
1822 * Response object for synchronous syntactic diagnostics request.
1824 interface SyntacticDiagnosticsSyncResponse extends Response {
1825 body?: Diagnostic[] | DiagnosticWithLinePosition[];
1828 * Arguments for GeterrForProject request.
1830 interface GeterrForProjectRequestArgs {
1832 * the file requesting project error list
1836 * Delay in milliseconds to wait before starting to compute
1837 * errors for the files in the file list
1842 * GeterrForProjectRequest request; value of command field is
1843 * "geterrForProject". It works similarly with 'Geterr', only
1844 * it request for every file in this project.
1846 interface GeterrForProjectRequest extends Request {
1847 command: CommandTypes.GeterrForProject;
1848 arguments: GeterrForProjectRequestArgs;
1851 * Arguments for geterr messages.
1853 interface GeterrRequestArgs {
1855 * List of file names for which to compute compiler errors.
1856 * The files will be checked in list order.
1860 * Delay in milliseconds to wait before starting to compute
1861 * errors for the files in the file list
1866 * Geterr request; value of command field is "geterr". Wait for
1867 * delay milliseconds and then, if during the wait no change or
1868 * reload messages have arrived for the first file in the files
1869 * list, get the syntactic errors for the file, field requests,
1870 * and then get the semantic errors for the file. Repeat with a
1871 * smaller delay for each subsequent file on the files list. Best
1872 * practice for an editor is to send a file list containing each
1873 * file that is currently visible, in most-recently-used order.
1875 interface GeterrRequest extends Request {
1876 command: CommandTypes.Geterr;
1877 arguments: GeterrRequestArgs;
1879 type RequestCompletedEventName = "requestCompleted";
1881 * Event that is sent when server have finished processing request with specified id.
1883 interface RequestCompletedEvent extends Event {
1884 event: RequestCompletedEventName;
1885 body: RequestCompletedEventBody;
1887 interface RequestCompletedEventBody {
1888 request_seq: number;
1891 * Item of diagnostic information found in a DiagnosticEvent message.
1893 interface Diagnostic {
1895 * Starting file location at which text applies.
1899 * The last file location at which the text applies.
1903 * Text of diagnostic message.
1907 * The category of the diagnostic message, e.g. "error", "warning", or "suggestion".
1910 reportsUnnecessary?: {};
1912 * Any related spans the diagnostic may have, such as other locations relevant to an error, such as declarartion sites
1914 relatedInformation?: DiagnosticRelatedInformation[];
1916 * The error code of the diagnostic message.
1920 * The name of the plugin reporting the message.
1924 interface DiagnosticWithFileName extends Diagnostic {
1926 * Name of the file the diagnostic is in
1931 * Represents additional spans returned with a diagnostic which are relevant to it
1933 interface DiagnosticRelatedInformation {
1935 * The category of the related information message, e.g. "error", "warning", or "suggestion".
1939 * The code used ot identify the related information
1943 * Text of related or additional information.
1947 * Associated location
1951 interface DiagnosticEventBody {
1953 * The file for which diagnostic information is reported.
1957 * An array of diagnostic information items.
1959 diagnostics: Diagnostic[];
1961 type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag";
1963 * Event message for DiagnosticEventKind event types.
1964 * These events provide syntactic and semantic errors for a file.
1966 interface DiagnosticEvent extends Event {
1967 body?: DiagnosticEventBody;
1968 event: DiagnosticEventKind;
1970 interface ConfigFileDiagnosticEventBody {
1972 * The file which trigged the searching and error-checking of the config file
1974 triggerFile: string;
1976 * The name of the found config file.
1980 * An arry of diagnostic information items for the found config file.
1982 diagnostics: DiagnosticWithFileName[];
1985 * Event message for "configFileDiag" event type.
1986 * This event provides errors for a found config file.
1988 interface ConfigFileDiagnosticEvent extends Event {
1989 body?: ConfigFileDiagnosticEventBody;
1990 event: "configFileDiag";
1992 type ProjectLanguageServiceStateEventName = "projectLanguageServiceState";
1993 interface ProjectLanguageServiceStateEvent extends Event {
1994 event: ProjectLanguageServiceStateEventName;
1995 body?: ProjectLanguageServiceStateEventBody;
1997 interface ProjectLanguageServiceStateEventBody {
1999 * Project name that has changes in the state of language service.
2000 * For configured projects this will be the config file path.
2001 * For external projects this will be the name of the projects specified when project was open.
2002 * For inferred projects this event is not raised.
2004 projectName: string;
2006 * True if language service state switched from disabled to enabled
2007 * and false otherwise.
2009 languageServiceEnabled: boolean;
2011 type ProjectsUpdatedInBackgroundEventName = "projectsUpdatedInBackground";
2012 interface ProjectsUpdatedInBackgroundEvent extends Event {
2013 event: ProjectsUpdatedInBackgroundEventName;
2014 body: ProjectsUpdatedInBackgroundEventBody;
2016 interface ProjectsUpdatedInBackgroundEventBody {
2018 * Current set of open files
2020 openFiles: string[];
2022 type ProjectLoadingStartEventName = "projectLoadingStart";
2023 interface ProjectLoadingStartEvent extends Event {
2024 event: ProjectLoadingStartEventName;
2025 body: ProjectLoadingStartEventBody;
2027 interface ProjectLoadingStartEventBody {
2028 /** name of the project */
2029 projectName: string;
2030 /** reason for loading */
2033 type ProjectLoadingFinishEventName = "projectLoadingFinish";
2034 interface ProjectLoadingFinishEvent extends Event {
2035 event: ProjectLoadingFinishEventName;
2036 body: ProjectLoadingFinishEventBody;
2038 interface ProjectLoadingFinishEventBody {
2039 /** name of the project */
2040 projectName: string;
2042 type SurveyReadyEventName = "surveyReady";
2043 interface SurveyReadyEvent extends Event {
2044 event: SurveyReadyEventName;
2045 body: SurveyReadyEventBody;
2047 interface SurveyReadyEventBody {
2048 /** Name of the survey. This is an internal machine- and programmer-friendly name */
2051 type LargeFileReferencedEventName = "largeFileReferenced";
2052 interface LargeFileReferencedEvent extends Event {
2053 event: LargeFileReferencedEventName;
2054 body: LargeFileReferencedEventBody;
2056 interface LargeFileReferencedEventBody {
2058 * name of the large file being loaded
2066 * max file size allowed on the server
2068 maxFileSize: number;
2071 * Arguments for reload request.
2073 interface ReloadRequestArgs extends FileRequestArgs {
2075 * Name of temporary file from which to reload file
2076 * contents. May be same as file.
2081 * Reload request message; value of command field is "reload".
2082 * Reload contents of file with name given by the 'file' argument
2083 * from temporary file with name given by the 'tmpfile' argument.
2084 * The two names can be identical.
2086 interface ReloadRequest extends FileRequest {
2087 command: CommandTypes.Reload;
2088 arguments: ReloadRequestArgs;
2091 * Response to "reload" request. This is just an acknowledgement, so
2092 * no body field is required.
2094 interface ReloadResponse extends Response {
2097 * Arguments for saveto request.
2099 interface SavetoRequestArgs extends FileRequestArgs {
2101 * Name of temporary file into which to save server's view of
2107 * Saveto request message; value of command field is "saveto".
2108 * For debugging purposes, save to a temporaryfile (named by
2109 * argument 'tmpfile') the contents of file named by argument
2110 * 'file'. The server does not currently send a response to a
2113 interface SavetoRequest extends FileRequest {
2114 command: CommandTypes.Saveto;
2115 arguments: SavetoRequestArgs;
2118 * Arguments for navto request message.
2120 interface NavtoRequestArgs {
2122 * Search term to navigate to from current location; term can
2123 * be '.*' or an identifier prefix.
2125 searchValue: string;
2127 * Optional limit on the number of items to return.
2129 maxResultCount?: number;
2131 * The file for the request (absolute pathname required).
2135 * Optional flag to indicate we want results for just the current file
2136 * or the entire project.
2138 currentFileOnly?: boolean;
2139 projectFileName?: string;
2142 * Navto request message; value of command field is "navto".
2143 * Return list of objects giving file locations and symbols that
2144 * match the search term given in argument 'searchTerm'. The
2145 * context for the search is given by the named file.
2147 interface NavtoRequest extends Request {
2148 command: CommandTypes.Navto;
2149 arguments: NavtoRequestArgs;
2152 * An item found in a navto response.
2154 interface NavtoItem extends FileSpan {
2156 * The symbol's name.
2160 * The symbol's kind (such as 'className' or 'parameterName').
2162 kind: ScriptElementKind;
2164 * exact, substring, or prefix.
2168 * If this was a case sensitive or insensitive match.
2170 isCaseSensitive: boolean;
2172 * Optional modifiers for the kind (such as 'public').
2174 kindModifiers?: string;
2176 * Name of symbol's container symbol (if any); for example,
2177 * the class name if symbol is a class member.
2179 containerName?: string;
2181 * Kind of symbol's container symbol (if any).
2183 containerKind?: ScriptElementKind;
2186 * Navto response message. Body is an array of navto items. Each
2187 * item gives a symbol that matched the search term.
2189 interface NavtoResponse extends Response {
2193 * Arguments for change request message.
2195 interface ChangeRequestArgs extends FormatRequestArgs {
2197 * Optional string to insert at location (file, line, offset).
2199 insertString?: string;
2202 * Change request message; value of command field is "change".
2203 * Update the server's view of the file named by argument 'file'.
2204 * Server does not currently send a response to a change request.
2206 interface ChangeRequest extends FileLocationRequest {
2207 command: CommandTypes.Change;
2208 arguments: ChangeRequestArgs;
2211 * Response to "brace" request.
2213 interface BraceResponse extends Response {
2217 * Brace matching request; value of command field is "brace".
2218 * Return response giving the file locations of matching braces
2219 * found in file at location line, offset.
2221 interface BraceRequest extends FileLocationRequest {
2222 command: CommandTypes.Brace;
2225 * NavBar items request; value of command field is "navbar".
2226 * Return response giving the list of navigation bar entries
2227 * extracted from the requested file.
2229 interface NavBarRequest extends FileRequest {
2230 command: CommandTypes.NavBar;
2233 * NavTree request; value of command field is "navtree".
2234 * Return response giving the navigation tree of the requested file.
2236 interface NavTreeRequest extends FileRequest {
2237 command: CommandTypes.NavTree;
2239 interface NavigationBarItem {
2241 * The item's display text.
2245 * The symbol's kind (such as 'className' or 'parameterName').
2247 kind: ScriptElementKind;
2249 * Optional modifiers for the kind (such as 'public').
2251 kindModifiers?: string;
2253 * The definition locations of the item.
2257 * Optional children.
2259 childItems?: NavigationBarItem[];
2261 * Number of levels deep this item should appear.
2265 /** protocol.NavigationTree is identical to ts.NavigationTree, except using protocol.TextSpan instead of ts.TextSpan */
2266 interface NavigationTree {
2268 kind: ScriptElementKind;
2269 kindModifiers: string;
2271 nameSpan: TextSpan | undefined;
2272 childItems?: NavigationTree[];
2274 type TelemetryEventName = "telemetry";
2275 interface TelemetryEvent extends Event {
2276 event: TelemetryEventName;
2277 body: TelemetryEventBody;
2279 interface TelemetryEventBody {
2280 telemetryEventName: string;
2283 type TypesInstallerInitializationFailedEventName = "typesInstallerInitializationFailed";
2284 interface TypesInstallerInitializationFailedEvent extends Event {
2285 event: TypesInstallerInitializationFailedEventName;
2286 body: TypesInstallerInitializationFailedEventBody;
2288 interface TypesInstallerInitializationFailedEventBody {
2291 type TypingsInstalledTelemetryEventName = "typingsInstalled";
2292 interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody {
2293 telemetryEventName: TypingsInstalledTelemetryEventName;
2294 payload: TypingsInstalledTelemetryEventPayload;
2296 interface TypingsInstalledTelemetryEventPayload {
2298 * Comma separated list of installed typing packages
2300 installedPackages: string;
2302 * true if install request succeeded, otherwise - false
2304 installSuccess: boolean;
2306 * version of typings installer
2308 typingsInstallerVersion: string;
2310 type BeginInstallTypesEventName = "beginInstallTypes";
2311 type EndInstallTypesEventName = "endInstallTypes";
2312 interface BeginInstallTypesEvent extends Event {
2313 event: BeginInstallTypesEventName;
2314 body: BeginInstallTypesEventBody;
2316 interface EndInstallTypesEvent extends Event {
2317 event: EndInstallTypesEventName;
2318 body: EndInstallTypesEventBody;
2320 interface InstallTypesEventBody {
2322 * correlation id to match begin and end events
2326 * list of packages to install
2328 packages: readonly string[];
2330 interface BeginInstallTypesEventBody extends InstallTypesEventBody {
2332 interface EndInstallTypesEventBody extends InstallTypesEventBody {
2334 * true if installation succeeded, otherwise false
2338 interface NavBarResponse extends Response {
2339 body?: NavigationBarItem[];
2341 interface NavTreeResponse extends Response {
2342 body?: NavigationTree;
2344 interface CallHierarchyItem {
2346 kind: ScriptElementKind;
2349 selectionSpan: TextSpan;
2351 interface CallHierarchyIncomingCall {
2352 from: CallHierarchyItem;
2353 fromSpans: TextSpan[];
2355 interface CallHierarchyOutgoingCall {
2356 to: CallHierarchyItem;
2357 fromSpans: TextSpan[];
2359 interface PrepareCallHierarchyRequest extends FileLocationRequest {
2360 command: CommandTypes.PrepareCallHierarchy;
2362 interface PrepareCallHierarchyResponse extends Response {
2363 readonly body: CallHierarchyItem | CallHierarchyItem[];
2365 interface ProvideCallHierarchyIncomingCallsRequest extends FileLocationRequest {
2366 command: CommandTypes.ProvideCallHierarchyIncomingCalls;
2368 interface ProvideCallHierarchyIncomingCallsResponse extends Response {
2369 readonly body: CallHierarchyIncomingCall[];
2371 interface ProvideCallHierarchyOutgoingCallsRequest extends FileLocationRequest {
2372 command: CommandTypes.ProvideCallHierarchyOutgoingCalls;
2374 interface ProvideCallHierarchyOutgoingCallsResponse extends Response {
2375 readonly body: CallHierarchyOutgoingCall[];
2377 const enum IndentStyle {
2382 enum SemicolonPreference {
2387 interface EditorSettings {
2388 baseIndentSize?: number;
2389 indentSize?: number;
2391 newLineCharacter?: string;
2392 convertTabsToSpaces?: boolean;
2393 indentStyle?: IndentStyle | ts.IndentStyle;
2394 trimTrailingWhitespace?: boolean;
2396 interface FormatCodeSettings extends EditorSettings {
2397 insertSpaceAfterCommaDelimiter?: boolean;
2398 insertSpaceAfterSemicolonInForStatements?: boolean;
2399 insertSpaceBeforeAndAfterBinaryOperators?: boolean;
2400 insertSpaceAfterConstructor?: boolean;
2401 insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
2402 insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
2403 insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
2404 insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
2405 insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
2406 insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
2407 insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
2408 insertSpaceAfterTypeAssertion?: boolean;
2409 insertSpaceBeforeFunctionParenthesis?: boolean;
2410 placeOpenBraceOnNewLineForFunctions?: boolean;
2411 placeOpenBraceOnNewLineForControlBlocks?: boolean;
2412 insertSpaceBeforeTypeAnnotation?: boolean;
2413 semicolons?: SemicolonPreference;
2415 interface UserPreferences {
2416 readonly disableSuggestions?: boolean;
2417 readonly quotePreference?: "auto" | "double" | "single";
2419 * If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
2420 * This affects lone identifier completions but not completions on the right hand side of `obj.`.
2422 readonly includeCompletionsForModuleExports?: boolean;
2424 * If enabled, the completion list will include completions with invalid identifier names.
2425 * For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`.
2427 readonly includeCompletionsWithInsertText?: boolean;
2429 * Unless this option is `false`, or `includeCompletionsWithInsertText` is not enabled,
2430 * member completion lists triggered with `.` will include entries on potentially-null and potentially-undefined
2431 * values, with insertion text to replace preceding `.` tokens with `?.`.
2433 readonly includeAutomaticOptionalChainCompletions?: boolean;
2434 readonly importModuleSpecifierPreference?: "auto" | "relative" | "non-relative";
2435 /** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
2436 readonly importModuleSpecifierEnding?: "auto" | "minimal" | "index" | "js";
2437 readonly allowTextChangesInNewFiles?: boolean;
2438 readonly lazyConfiguredProjectsFromExternalProject?: boolean;
2439 readonly providePrefixAndSuffixTextForRename?: boolean;
2440 readonly allowRenameOfImportPath?: boolean;
2442 interface CompilerOptions {
2444 allowSyntheticDefaultImports?: boolean;
2445 allowUnreachableCode?: boolean;
2446 allowUnusedLabels?: boolean;
2447 alwaysStrict?: boolean;
2451 declaration?: boolean;
2452 declarationDir?: string;
2453 disableSizeLimit?: boolean;
2454 downlevelIteration?: boolean;
2456 emitDecoratorMetadata?: boolean;
2457 experimentalDecorators?: boolean;
2458 forceConsistentCasingInFileNames?: boolean;
2459 importHelpers?: boolean;
2460 inlineSourceMap?: boolean;
2461 inlineSources?: boolean;
2462 isolatedModules?: boolean;
2463 jsx?: JsxEmit | ts.JsxEmit;
2467 maxNodeModuleJsDepth?: number;
2468 module?: ModuleKind | ts.ModuleKind;
2469 moduleResolution?: ModuleResolutionKind | ts.ModuleResolutionKind;
2470 newLine?: NewLineKind | ts.NewLineKind;
2472 noEmitHelpers?: boolean;
2473 noEmitOnError?: boolean;
2474 noErrorTruncation?: boolean;
2475 noFallthroughCasesInSwitch?: boolean;
2476 noImplicitAny?: boolean;
2477 noImplicitReturns?: boolean;
2478 noImplicitThis?: boolean;
2479 noUnusedLocals?: boolean;
2480 noUnusedParameters?: boolean;
2481 noImplicitUseStrict?: boolean;
2483 noResolve?: boolean;
2487 paths?: MapLike<string[]>;
2488 plugins?: PluginImport[];
2489 preserveConstEnums?: boolean;
2490 preserveSymlinks?: boolean;
2492 reactNamespace?: string;
2493 removeComments?: boolean;
2494 references?: ProjectReference[];
2496 rootDirs?: string[];
2497 skipLibCheck?: boolean;
2498 skipDefaultLibCheck?: boolean;
2499 sourceMap?: boolean;
2500 sourceRoot?: string;
2502 strictNullChecks?: boolean;
2503 suppressExcessPropertyErrors?: boolean;
2504 suppressImplicitAnyIndexErrors?: boolean;
2505 useDefineForClassFields?: boolean;
2506 target?: ScriptTarget | ts.ScriptTarget;
2507 traceResolution?: boolean;
2508 resolveJsonModule?: boolean;
2510 /** Paths used to used to compute primary types search locations */
2511 typeRoots?: string[];
2512 [option: string]: CompilerOptionsValue | undefined;
2514 const enum JsxEmit {
2516 Preserve = "Preserve",
2517 ReactNative = "ReactNative",
2520 const enum ModuleKind {
2522 CommonJS = "CommonJS",
2530 const enum ModuleResolutionKind {
2531 Classic = "Classic",
2534 const enum NewLineKind {
2538 const enum ScriptTarget {
2551 declare namespace ts.server.protocol {
2553 interface TextInsertion {
2555 /** The position in newText the caret should point to after the insertion. */
2556 caretOffset: number;
2559 interface TodoCommentDescriptor {
2564 interface TodoComment {
2565 descriptor: TodoCommentDescriptor;
2570 enum OutliningSpanKind {
2571 /** Single or multi-line comments */
2572 Comment = "comment",
2573 /** Sections marked by '// #region' and '// #endregion' comments */
2575 /** Declarations and expressions */
2577 /** Contiguous blocks of import declarations */
2581 enum HighlightSpanKind {
2583 definition = "definition",
2584 reference = "reference",
2585 writtenReference = "writtenReference"
2588 enum ScriptElementKind {
2590 warning = "warning",
2591 /** predefined type (void) or keyword (class) */
2592 keyword = "keyword",
2593 /** top level script node */
2594 scriptElement = "script",
2595 /** module foo {} */
2596 moduleElement = "module",
2598 classElement = "class",
2599 /** var x = class X {} */
2600 localClassElement = "local class",
2601 /** interface Y {} */
2602 interfaceElement = "interface",
2604 typeElement = "type",
2606 enumElement = "enum",
2607 enumMemberElement = "enum member",
2609 * Inside module and script only
2612 variableElement = "var",
2613 /** Inside function */
2614 localVariableElement = "local var",
2616 * Inside module and script only
2619 functionElement = "function",
2620 /** Inside function */
2621 localFunctionElement = "local function",
2622 /** class X { [public|private]* foo() {} } */
2623 memberFunctionElement = "method",
2624 /** class X { [public|private]* [get|set] foo:number; } */
2625 memberGetAccessorElement = "getter",
2626 memberSetAccessorElement = "setter",
2628 * class X { [public|private]* foo:number; }
2629 * interface Y { foo:number; }
2631 memberVariableElement = "property",
2632 /** class X { constructor() { } } */
2633 constructorImplementationElement = "constructor",
2634 /** interface Y { ():number; } */
2635 callSignatureElement = "call",
2636 /** interface Y { []:number; } */
2637 indexSignatureElement = "index",
2638 /** interface Y { new():Y; } */
2639 constructSignatureElement = "construct",
2640 /** function foo(*Y*: string) */
2641 parameterElement = "parameter",
2642 typeParameterElement = "type parameter",
2643 primitiveType = "primitive type",
2646 constElement = "const",
2648 directory = "directory",
2649 externalModuleName = "external module name",
2651 * <JsxTagName attribute1 attribute2={0} />
2653 jsxAttribute = "JSX attribute",
2654 /** String literal */
2658 export interface TypeAcquisition {
2660 * @deprecated typingOptions.enableAutoDiscovery
2661 * Use typeAcquisition.enable instead.
2663 enableAutoDiscovery?: boolean;
2667 [option: string]: string[] | boolean | undefined;
2670 export interface FileExtensionInfo {
2672 isMixedContent: boolean;
2673 scriptKind?: ScriptKind;
2676 export type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]> | PluginImport[] | ProjectReference[] | null | undefined;
2678 interface JSDocTagInfo {
2684 * Type of objects whose values are all of the same type.
2685 * The `in` and `for-in` operators can *not* be safely used,
2686 * since `Object.prototype` may be modified by outside code.
2688 interface MapLike<T> {
2692 export interface PluginImport {
2696 export interface ProjectReference {
2697 /** A normalized path on disk */
2699 /** The path as the user originally wrote it */
2700 originalPath?: string;
2701 /** True if the output of this reference should be prepended to the output of this project. Only valid for --outFile compilations */
2703 /** True if it is intended that this reference form a circularity */
2707 declare namespace ts {
2708 // these types are empty stubs for types from services and should not be used directly
2709 export type ScriptKind = never;
2710 export type WatchFileKind = never;
2711 export type WatchDirectoryKind = never;
2712 export type PollingWatchKind = never;
2713 export type IndentStyle = never;
2714 export type JsxEmit = never;
2715 export type ModuleKind = never;
2716 export type ModuleResolutionKind = never;
2717 export type NewLineKind = never;
2718 export type ScriptTarget = never;
2720 import protocol = ts.server.protocol;
2722 export as namespace protocol;