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 ToggleLineComment = "toggleLineComment",
69 ToggleMultilineComment = "toggleMultilineComment",
70 CommentSelection = "commentSelection",
71 UncommentSelection = "uncommentSelection",
72 PrepareCallHierarchy = "prepareCallHierarchy",
73 ProvideCallHierarchyIncomingCalls = "provideCallHierarchyIncomingCalls",
74 ProvideCallHierarchyOutgoingCalls = "provideCallHierarchyOutgoingCalls"
77 * A TypeScript Server message
81 * Sequence number of the message
85 * One of "request", "response", or "event"
87 type: "request" | "response" | "event";
90 * Client-initiated request message
92 interface Request extends Message {
95 * The command to execute
99 * Object containing arguments for the command
104 * Request to reload the project structure for all the opened files
106 interface ReloadProjectsRequest extends Message {
107 command: CommandTypes.ReloadProjects;
110 * Server-initiated event message
112 interface Event extends Message {
119 * Event-specific information
124 * Response by server to client request message.
126 interface Response extends Message {
129 * Sequence number of the request message.
133 * Outcome of the request.
137 * The command requested.
141 * If success === false, this should always be provided.
142 * Otherwise, may (or may not) contain a success message.
146 * Contains message body if success === true.
150 * Contains extra information that plugin can include to be passed on
154 * Exposes information about the performance of this request-response pair.
156 performanceData?: PerformanceData;
158 interface PerformanceData {
160 * Time spent updating the program graph, in milliseconds.
162 updateGraphDurationMs?: number;
164 * The time spent creating or updating the auto-import program, in milliseconds.
166 createAutoImportProviderProgramDurationMs?: number;
169 * Arguments for FileRequest messages.
171 interface FileRequestArgs {
173 * The file for the request (absolute pathname required).
176 projectFileName?: string;
178 interface StatusRequest extends Request {
179 command: CommandTypes.Status;
181 interface StatusResponseBody {
183 * The TypeScript version (`ts.version`).
188 * Response to StatusRequest
190 interface StatusResponse extends Response {
191 body: StatusResponseBody;
194 * Requests a JS Doc comment template for a given position
196 interface DocCommentTemplateRequest extends FileLocationRequest {
197 command: CommandTypes.DocCommentTemplate;
200 * Response to DocCommentTemplateRequest
202 interface DocCommandTemplateResponse extends Response {
203 body?: TextInsertion;
206 * A request to get TODO comments from the file
208 interface TodoCommentRequest extends FileRequest {
209 command: CommandTypes.TodoComments;
210 arguments: TodoCommentRequestArgs;
213 * Arguments for TodoCommentRequest request.
215 interface TodoCommentRequestArgs extends FileRequestArgs {
217 * Array of target TodoCommentDescriptors that describes TODO comments to be found
219 descriptors: TodoCommentDescriptor[];
222 * Response for TodoCommentRequest request.
224 interface TodoCommentsResponse extends Response {
225 body?: TodoComment[];
228 * A request to determine if the caret is inside a comment.
230 interface SpanOfEnclosingCommentRequest extends FileLocationRequest {
231 command: CommandTypes.GetSpanOfEnclosingComment;
232 arguments: SpanOfEnclosingCommentRequestArgs;
234 interface SpanOfEnclosingCommentRequestArgs extends FileLocationRequestArgs {
236 * Requires that the enclosing span be a multi-line comment, or else the request returns undefined.
238 onlyMultiLine: boolean;
241 * Request to obtain outlining spans in file.
243 interface OutliningSpansRequest extends FileRequest {
244 command: CommandTypes.GetOutliningSpans;
246 interface OutliningSpan {
247 /** The span of the document to actually collapse. */
249 /** The span of the document to display when the user hovers over the collapsed span. */
251 /** The text to display in the editor for the collapsed region. */
254 * Whether or not this region should be automatically collapsed when
255 * the 'Collapse to Definitions' command is invoked.
257 autoCollapse: boolean;
259 * Classification of the contents of the span
261 kind: OutliningSpanKind;
264 * Response to OutliningSpansRequest request.
266 interface OutliningSpansResponse extends Response {
267 body?: OutliningSpan[];
270 * A request to get indentation for a location in file
272 interface IndentationRequest extends FileLocationRequest {
273 command: CommandTypes.Indentation;
274 arguments: IndentationRequestArgs;
277 * Response for IndentationRequest request.
279 interface IndentationResponse extends Response {
280 body?: IndentationResult;
283 * Indentation result representing where indentation should be placed
285 interface IndentationResult {
287 * The base position in the document that the indent should be relative to
291 * The number of columns the indent should be at relative to the position's column.
296 * Arguments for IndentationRequest request.
298 interface IndentationRequestArgs extends FileLocationRequestArgs {
300 * An optional set of settings to be used when computing indentation.
301 * If argument is omitted - then it will use settings for file that were previously set via 'configure' request or global settings.
303 options?: EditorSettings;
306 * Arguments for ProjectInfoRequest request.
308 interface ProjectInfoRequestArgs extends FileRequestArgs {
310 * Indicate if the file name list of the project is needed
312 needFileNameList: boolean;
315 * A request to get the project information of the current file.
317 interface ProjectInfoRequest extends Request {
318 command: CommandTypes.ProjectInfo;
319 arguments: ProjectInfoRequestArgs;
322 * A request to retrieve compiler options diagnostics for a project
324 interface CompilerOptionsDiagnosticsRequest extends Request {
325 arguments: CompilerOptionsDiagnosticsRequestArgs;
328 * Arguments for CompilerOptionsDiagnosticsRequest request.
330 interface CompilerOptionsDiagnosticsRequestArgs {
332 * Name of the project to retrieve compiler options diagnostics.
334 projectFileName: string;
337 * Response message body for "projectInfo" request
339 interface ProjectInfo {
341 * For configured project, this is the normalized path of the 'tsconfig.json' file
342 * For inferred project, this is undefined
344 configFileName: string;
346 * The list of normalized file name in the project, including 'lib.d.ts'
348 fileNames?: string[];
350 * Indicates if the project has a active language service instance
352 languageServiceDisabled?: boolean;
355 * Represents diagnostic info that includes location of diagnostic in two forms
356 * - start position and length of the error span
357 * - startLocation and endLocation - a pair of Location objects that store start/end line and offset of the error span.
359 interface DiagnosticWithLinePosition {
363 startLocation: Location;
364 endLocation: Location;
367 /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */
368 reportsUnnecessary?: {};
369 reportsDeprecated?: {};
370 relatedInformation?: DiagnosticRelatedInformation[];
373 * Response message for "projectInfo" request
375 interface ProjectInfoResponse extends Response {
379 * Request whose sole parameter is a file name.
381 interface FileRequest extends Request {
382 arguments: FileRequestArgs;
385 * Instances of this interface specify a location in a source file:
386 * (file, line, character offset), where line and character offset are 1-based.
388 interface FileLocationRequestArgs extends FileRequestArgs {
390 * The line number for the request (1-based).
394 * The character offset (on the line) for the request (1-based).
398 type FileLocationOrRangeRequestArgs = FileLocationRequestArgs | FileRangeRequestArgs;
400 * Request refactorings at a given position or selection area.
402 interface GetApplicableRefactorsRequest extends Request {
403 command: CommandTypes.GetApplicableRefactors;
404 arguments: GetApplicableRefactorsRequestArgs;
406 type GetApplicableRefactorsRequestArgs = FileLocationOrRangeRequestArgs & {
407 triggerReason?: RefactorTriggerReason;
409 type RefactorTriggerReason = "implicit" | "invoked";
411 * Response is a list of available refactorings.
412 * Each refactoring exposes one or more "Actions"; a user selects one action to invoke a refactoring
414 interface GetApplicableRefactorsResponse extends Response {
415 body?: ApplicableRefactorInfo[];
418 * A set of one or more available refactoring actions, grouped under a parent refactoring.
420 interface ApplicableRefactorInfo {
422 * The programmatic name of the refactoring
426 * A description of this refactoring category to show to the user.
427 * If the refactoring gets inlined (see below), this text will not be visible.
431 * Inlineable refactorings can have their actions hoisted out to the top level
432 * of a context menu. Non-inlineanable refactorings should always be shown inside
433 * their parent grouping.
435 * If not specified, this value is assumed to be 'true'
437 inlineable?: boolean;
438 actions: RefactorActionInfo[];
441 * Represents a single refactoring action - for example, the "Extract Method..." refactor might
442 * offer several actions, each corresponding to a surround class or closure to extract into.
444 interface RefactorActionInfo {
446 * The programmatic name of the refactoring action
450 * A description of this refactoring action to show to the user.
451 * If the parent refactoring is inlined away, this will be the only text shown,
452 * so this description should make sense by itself if the parent is inlineable=true
456 * A message to show to the user if the refactoring cannot be applied in
457 * the current context.
459 notApplicableReason?: string;
461 interface GetEditsForRefactorRequest extends Request {
462 command: CommandTypes.GetEditsForRefactor;
463 arguments: GetEditsForRefactorRequestArgs;
466 * Request the edits that a particular refactoring action produces.
467 * Callers must specify the name of the refactor and the name of the action.
469 type GetEditsForRefactorRequestArgs = FileLocationOrRangeRequestArgs & {
473 interface GetEditsForRefactorResponse extends Response {
474 body?: RefactorEditInfo;
476 interface RefactorEditInfo {
477 edits: FileCodeEdits[];
479 * An optional location where the editor should start a rename operation once
480 * the refactoring edits have been applied
482 renameLocation?: Location;
483 renameFilename?: string;
486 * Organize imports by:
487 * 1) Removing unused imports
488 * 2) Coalescing imports from the same module
491 interface OrganizeImportsRequest extends Request {
492 command: CommandTypes.OrganizeImports;
493 arguments: OrganizeImportsRequestArgs;
495 type OrganizeImportsScope = GetCombinedCodeFixScope;
496 interface OrganizeImportsRequestArgs {
497 scope: OrganizeImportsScope;
499 interface OrganizeImportsResponse extends Response {
500 body: readonly FileCodeEdits[];
502 interface GetEditsForFileRenameRequest extends Request {
503 command: CommandTypes.GetEditsForFileRename;
504 arguments: GetEditsForFileRenameRequestArgs;
506 /** Note: Paths may also be directories. */
507 interface GetEditsForFileRenameRequestArgs {
508 readonly oldFilePath: string;
509 readonly newFilePath: string;
511 interface GetEditsForFileRenameResponse extends Response {
512 body: readonly FileCodeEdits[];
515 * Request for the available codefixes at a specific position.
517 interface CodeFixRequest extends Request {
518 command: CommandTypes.GetCodeFixes;
519 arguments: CodeFixRequestArgs;
521 interface GetCombinedCodeFixRequest extends Request {
522 command: CommandTypes.GetCombinedCodeFix;
523 arguments: GetCombinedCodeFixRequestArgs;
525 interface GetCombinedCodeFixResponse extends Response {
526 body: CombinedCodeActions;
528 interface ApplyCodeActionCommandRequest extends Request {
529 command: CommandTypes.ApplyCodeActionCommand;
530 arguments: ApplyCodeActionCommandRequestArgs;
532 interface ApplyCodeActionCommandResponse extends Response {
534 interface FileRangeRequestArgs extends FileRequestArgs {
536 * The line number for the request (1-based).
540 * The character offset (on the line) for the request (1-based).
544 * The line number for the request (1-based).
548 * The character offset (on the line) for the request (1-based).
553 * Instances of this interface specify errorcodes on a specific location in a sourcefile.
555 interface CodeFixRequestArgs extends FileRangeRequestArgs {
557 * Errorcodes we want to get the fixes for.
559 errorCodes: readonly number[];
561 interface GetCombinedCodeFixRequestArgs {
562 scope: GetCombinedCodeFixScope;
565 interface GetCombinedCodeFixScope {
567 args: FileRequestArgs;
569 interface ApplyCodeActionCommandRequestArgs {
570 /** May also be an array of commands. */
574 * Response for GetCodeFixes request.
576 interface GetCodeFixesResponse extends Response {
580 * A request whose arguments specify a file location (file, line, col).
582 interface FileLocationRequest extends FileRequest {
583 arguments: FileLocationRequestArgs;
586 * A request to get codes of supported code fixes.
588 interface GetSupportedCodeFixesRequest extends Request {
589 command: CommandTypes.GetSupportedCodeFixes;
592 * A response for GetSupportedCodeFixesRequest request.
594 interface GetSupportedCodeFixesResponse extends Response {
596 * List of error codes supported by the server.
601 * Arguments in document highlight request; include: filesToSearch, file,
604 interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs {
606 * List of files to search for document highlights.
608 filesToSearch: string[];
611 * Go to definition request; value of command field is
612 * "definition". Return response giving the file locations that
613 * define the symbol found in file at location line, col.
615 interface DefinitionRequest extends FileLocationRequest {
616 command: CommandTypes.Definition;
618 interface DefinitionAndBoundSpanRequest extends FileLocationRequest {
619 readonly command: CommandTypes.DefinitionAndBoundSpan;
621 interface DefinitionAndBoundSpanResponse extends Response {
622 readonly body: DefinitionInfoAndBoundSpan;
625 * Go to type request; value of command field is
626 * "typeDefinition". Return response giving the file locations that
627 * define the type for the symbol found in file at location line, col.
629 interface TypeDefinitionRequest extends FileLocationRequest {
630 command: CommandTypes.TypeDefinition;
633 * Go to implementation request; value of command field is
634 * "implementation". Return response giving the file locations that
635 * implement the symbol found in file at location line, col.
637 interface ImplementationRequest extends FileLocationRequest {
638 command: CommandTypes.Implementation;
641 * Location in source code expressed as (one-based) line and (one-based) column offset.
648 * Object found in response messages defining a span of text in source code.
652 * First character of the definition.
656 * One character past last character of the definition.
661 * Object found in response messages defining a span of text in a specific source file.
663 interface FileSpan extends TextSpan {
665 * File containing text span.
669 interface TextSpanWithContext extends TextSpan {
670 contextStart?: Location;
671 contextEnd?: Location;
673 interface FileSpanWithContext extends FileSpan, TextSpanWithContext {
675 interface DefinitionInfoAndBoundSpan {
676 definitions: readonly FileSpanWithContext[];
680 * Definition response message. Gives text range for definition.
682 interface DefinitionResponse extends Response {
683 body?: FileSpanWithContext[];
685 interface DefinitionInfoAndBoundSpanResponse extends Response {
686 body?: DefinitionInfoAndBoundSpan;
688 /** @deprecated Use `DefinitionInfoAndBoundSpanResponse` instead. */
689 type DefinitionInfoAndBoundSpanReponse = DefinitionInfoAndBoundSpanResponse;
691 * Definition response message. Gives text range for definition.
693 interface TypeDefinitionResponse extends Response {
694 body?: FileSpanWithContext[];
697 * Implementation response message. Gives text range for implementations.
699 interface ImplementationResponse extends Response {
700 body?: FileSpanWithContext[];
703 * Request to get brace completion for a location in the file.
705 interface BraceCompletionRequest extends FileLocationRequest {
706 command: CommandTypes.BraceCompletion;
707 arguments: BraceCompletionRequestArgs;
710 * Argument for BraceCompletionRequest request.
712 interface BraceCompletionRequestArgs extends FileLocationRequestArgs {
714 * Kind of opening brace
716 openingBrace: string;
718 interface JsxClosingTagRequest extends FileLocationRequest {
719 readonly command: CommandTypes.JsxClosingTag;
720 readonly arguments: JsxClosingTagRequestArgs;
722 interface JsxClosingTagRequestArgs extends FileLocationRequestArgs {
724 interface JsxClosingTagResponse extends Response {
725 readonly body: TextInsertion;
729 * Get occurrences request; value of command field is
730 * "occurrences". Return response giving spans that are relevant
731 * in the file at a given line and column.
733 interface OccurrencesRequest extends FileLocationRequest {
734 command: CommandTypes.Occurrences;
737 interface OccurrencesResponseItem extends FileSpanWithContext {
739 * True if the occurrence is a write location, false otherwise.
741 isWriteAccess: boolean;
743 * True if the occurrence is in a string, undefined otherwise;
748 interface OccurrencesResponse extends Response {
749 body?: OccurrencesResponseItem[];
752 * Get document highlights request; value of command field is
753 * "documentHighlights". Return response giving spans that are relevant
754 * in the file at a given line and column.
756 interface DocumentHighlightsRequest extends FileLocationRequest {
757 command: CommandTypes.DocumentHighlights;
758 arguments: DocumentHighlightsRequestArgs;
761 * Span augmented with extra information that denotes the kind of the highlighting to be used for span.
763 interface HighlightSpan extends TextSpanWithContext {
764 kind: HighlightSpanKind;
767 * Represents a set of highligh spans for a give name
769 interface DocumentHighlightsItem {
771 * File containing highlight spans.
775 * Spans to highlight in file.
777 highlightSpans: HighlightSpan[];
780 * Response for a DocumentHighlightsRequest request.
782 interface DocumentHighlightsResponse extends Response {
783 body?: DocumentHighlightsItem[];
786 * Find references request; value of command field is
787 * "references". Return response giving the file locations that
788 * reference the symbol found in file at location line, col.
790 interface ReferencesRequest extends FileLocationRequest {
791 command: CommandTypes.References;
793 interface ReferencesResponseItem extends FileSpanWithContext {
794 /** Text of line containing the reference. Including this
795 * with the response avoids latency of editor loading files
796 * to show text of reference line (the server already has
797 * loaded the referencing files).
801 * True if reference is a write location, false otherwise.
803 isWriteAccess: boolean;
805 * True if reference is a definition, false otherwise.
807 isDefinition: boolean;
810 * The body of a "references" response message.
812 interface ReferencesResponseBody {
814 * The file locations referencing the symbol.
816 refs: readonly ReferencesResponseItem[];
818 * The name of the symbol.
822 * The start character offset of the symbol (on the line provided by the references request).
824 symbolStartOffset: number;
826 * The full display name of the symbol.
828 symbolDisplayString: string;
831 * Response to "references" request.
833 interface ReferencesResponse extends Response {
834 body?: ReferencesResponseBody;
837 * Argument for RenameRequest request.
839 interface RenameRequestArgs extends FileLocationRequestArgs {
841 * Should text at specified location be found/changed in comments?
843 findInComments?: boolean;
845 * Should text at specified location be found/changed in strings?
847 findInStrings?: boolean;
850 * Rename request; value of command field is "rename". Return
851 * response giving the file locations that reference the symbol
852 * found in file at location line, col. Also return full display
853 * name of the symbol so that client can print it unambiguously.
855 interface RenameRequest extends FileLocationRequest {
856 command: CommandTypes.Rename;
857 arguments: RenameRequestArgs;
860 * Information about the item to be renamed.
862 type RenameInfo = RenameInfoSuccess | RenameInfoFailure;
863 interface RenameInfoSuccess {
865 * True if item can be renamed.
869 * File or directory to rename.
870 * If set, `getEditsForFileRename` should be called instead of `findRenameLocations`.
872 fileToRename?: string;
874 * Display name of the item to be renamed.
878 * Full display name of item to be renamed.
880 fullDisplayName: string;
882 * The items's kind (such as 'className' or 'parameterName' or plain 'text').
884 kind: ScriptElementKind;
886 * Optional modifiers for the kind (such as 'public').
888 kindModifiers: string;
889 /** Span of text to rename. */
890 triggerSpan: TextSpan;
892 interface RenameInfoFailure {
895 * Error message if item can not be renamed.
897 localizedErrorMessage: string;
900 * A group of text spans, all in 'file'.
902 interface SpanGroup {
903 /** The file to which the spans apply */
905 /** The text spans in this group */
906 locs: RenameTextSpan[];
908 interface RenameTextSpan extends TextSpanWithContext {
909 readonly prefixText?: string;
910 readonly suffixText?: string;
912 interface RenameResponseBody {
914 * Information about the item to be renamed.
918 * An array of span groups (one per file) that refer to the item to be renamed.
920 locs: readonly SpanGroup[];
923 * Rename response message.
925 interface RenameResponse extends Response {
926 body?: RenameResponseBody;
929 * Represents a file in external project.
930 * External project is project whose set of files, compilation options and open\close state
931 * is maintained by the client (i.e. if all this data come from .csproj file in Visual Studio).
932 * External project will exist even if all files in it are closed and should be closed explicitly.
933 * If external project includes one or more tsconfig.json/jsconfig.json files then tsserver will
934 * create configured project for every config file but will maintain a link that these projects were created
935 * as a result of opening external project so they should be removed once external project is closed.
937 interface ExternalFile {
943 * Script kind of the file
945 scriptKind?: ScriptKindName | ts.ScriptKind;
947 * Whether file has mixed content (i.e. .cshtml file that combines html markup with C#/JavaScript)
949 hasMixedContent?: boolean;
951 * Content of the file
956 * Represent an external project
958 interface ExternalProject {
962 projectFileName: string;
964 * List of root files in project
966 rootFiles: ExternalFile[];
968 * Compiler options for the project
970 options: ExternalProjectCompilerOptions;
972 * @deprecated typingOptions. Use typeAcquisition instead
974 typingOptions?: TypeAcquisition;
976 * Explicitly specified type acquisition for the project
978 typeAcquisition?: TypeAcquisition;
980 interface CompileOnSaveMixin {
982 * If compile on save is enabled for the project
984 compileOnSave?: boolean;
987 * For external projects, some of the project settings are sent together with
990 type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin & WatchOptions;
991 interface FileWithProjectReferenceRedirectInfo {
997 * True if the file is primarily included in a referenced project
999 isSourceOfProjectReferenceRedirect: boolean;
1002 * Represents a set of changes that happen in project
1004 interface ProjectChanges {
1006 * List of added files
1008 added: string[] | FileWithProjectReferenceRedirectInfo[];
1010 * List of removed files
1012 removed: string[] | FileWithProjectReferenceRedirectInfo[];
1014 * List of updated files
1016 updated: string[] | FileWithProjectReferenceRedirectInfo[];
1018 * List of files that have had their project reference redirect status updated
1019 * Only provided when the synchronizeProjectList request has includeProjectReferenceRedirectInfo set to true
1021 updatedRedirects?: FileWithProjectReferenceRedirectInfo[];
1024 * Information found in a configure request.
1026 interface ConfigureRequestArguments {
1028 * Information about the host, for example 'Emacs 24.4' or
1029 * 'Sublime Text version 3075'
1033 * If present, tab settings apply only to this file.
1037 * The format options to use during formatting and other code editing features.
1039 formatOptions?: FormatCodeSettings;
1040 preferences?: UserPreferences;
1042 * The host's additional supported .js file extensions
1044 extraFileExtensions?: FileExtensionInfo[];
1045 watchOptions?: WatchOptions;
1047 const enum WatchFileKind {
1048 FixedPollingInterval = "FixedPollingInterval",
1049 PriorityPollingInterval = "PriorityPollingInterval",
1050 DynamicPriorityPolling = "DynamicPriorityPolling",
1051 UseFsEvents = "UseFsEvents",
1052 UseFsEventsOnParentDirectory = "UseFsEventsOnParentDirectory"
1054 const enum WatchDirectoryKind {
1055 UseFsEvents = "UseFsEvents",
1056 FixedPollingInterval = "FixedPollingInterval",
1057 DynamicPriorityPolling = "DynamicPriorityPolling"
1059 const enum PollingWatchKind {
1060 FixedInterval = "FixedInterval",
1061 PriorityInterval = "PriorityInterval",
1062 DynamicPriority = "DynamicPriority"
1064 interface WatchOptions {
1065 watchFile?: WatchFileKind | ts.WatchFileKind;
1066 watchDirectory?: WatchDirectoryKind | ts.WatchDirectoryKind;
1067 fallbackPolling?: PollingWatchKind | ts.PollingWatchKind;
1068 synchronousWatchDirectory?: boolean;
1069 [option: string]: CompilerOptionsValue | undefined;
1072 * Configure request; value of command field is "configure". Specifies
1073 * host information, such as host type, tab size, and indent size.
1075 interface ConfigureRequest extends Request {
1076 command: CommandTypes.Configure;
1077 arguments: ConfigureRequestArguments;
1080 * Response to "configure" request. This is just an acknowledgement, so
1081 * no body field is required.
1083 interface ConfigureResponse extends Response {
1085 interface ConfigurePluginRequestArguments {
1089 interface ConfigurePluginRequest extends Request {
1090 command: CommandTypes.ConfigurePlugin;
1091 arguments: ConfigurePluginRequestArguments;
1093 interface ConfigurePluginResponse extends Response {
1095 interface SelectionRangeRequest extends FileRequest {
1096 command: CommandTypes.SelectionRange;
1097 arguments: SelectionRangeRequestArgs;
1099 interface SelectionRangeRequestArgs extends FileRequestArgs {
1100 locations: Location[];
1102 interface SelectionRangeResponse extends Response {
1103 body?: SelectionRange[];
1105 interface SelectionRange {
1107 parent?: SelectionRange;
1109 interface ToggleLineCommentRequest extends FileRequest {
1110 command: CommandTypes.ToggleLineComment;
1111 arguments: FileRangeRequestArgs;
1113 interface ToggleMultilineCommentRequest extends FileRequest {
1114 command: CommandTypes.ToggleMultilineComment;
1115 arguments: FileRangeRequestArgs;
1117 interface CommentSelectionRequest extends FileRequest {
1118 command: CommandTypes.CommentSelection;
1119 arguments: FileRangeRequestArgs;
1121 interface UncommentSelectionRequest extends FileRequest {
1122 command: CommandTypes.UncommentSelection;
1123 arguments: FileRangeRequestArgs;
1126 * Information found in an "open" request.
1128 interface OpenRequestArgs extends FileRequestArgs {
1130 * Used when a version of the file content is known to be more up to date than the one on disk.
1131 * Then the known content will be used upon opening instead of the disk copy
1133 fileContent?: string;
1135 * Used to specify the script kind of the file explicitly. It could be one of the following:
1136 * "TS", "JS", "TSX", "JSX"
1138 scriptKindName?: ScriptKindName;
1140 * Used to limit the searching for project config file. If given the searching will stop at this
1141 * root path; otherwise it will go all the way up to the dist root path.
1143 projectRootPath?: string;
1145 type ScriptKindName = "TS" | "JS" | "TSX" | "JSX";
1147 * Open request; value of command field is "open". Notify the
1148 * server that the client has file open. The server will not
1149 * monitor the filesystem for changes in this file and will assume
1150 * that the client is updating the server (using the change and/or
1151 * reload messages) when the file changes. Server does not currently
1152 * send a response to an open request.
1154 interface OpenRequest extends Request {
1155 command: CommandTypes.Open;
1156 arguments: OpenRequestArgs;
1159 * Request to open or update external project
1161 interface OpenExternalProjectRequest extends Request {
1162 command: CommandTypes.OpenExternalProject;
1163 arguments: OpenExternalProjectArgs;
1166 * Arguments to OpenExternalProjectRequest request
1168 type OpenExternalProjectArgs = ExternalProject;
1170 * Request to open multiple external projects
1172 interface OpenExternalProjectsRequest extends Request {
1173 command: CommandTypes.OpenExternalProjects;
1174 arguments: OpenExternalProjectsArgs;
1177 * Arguments to OpenExternalProjectsRequest
1179 interface OpenExternalProjectsArgs {
1181 * List of external projects to open or update
1183 projects: ExternalProject[];
1186 * Response to OpenExternalProjectRequest request. This is just an acknowledgement, so
1187 * no body field is required.
1189 interface OpenExternalProjectResponse extends Response {
1192 * Response to OpenExternalProjectsRequest request. This is just an acknowledgement, so
1193 * no body field is required.
1195 interface OpenExternalProjectsResponse extends Response {
1198 * Request to close external project.
1200 interface CloseExternalProjectRequest extends Request {
1201 command: CommandTypes.CloseExternalProject;
1202 arguments: CloseExternalProjectRequestArgs;
1205 * Arguments to CloseExternalProjectRequest request
1207 interface CloseExternalProjectRequestArgs {
1209 * Name of the project to close
1211 projectFileName: string;
1214 * Response to CloseExternalProjectRequest request. This is just an acknowledgement, so
1215 * no body field is required.
1217 interface CloseExternalProjectResponse extends Response {
1220 * Request to synchronize list of open files with the client
1222 interface UpdateOpenRequest extends Request {
1223 command: CommandTypes.UpdateOpen;
1224 arguments: UpdateOpenRequestArgs;
1227 * Arguments to UpdateOpenRequest
1229 interface UpdateOpenRequestArgs {
1231 * List of newly open files
1233 openFiles?: OpenRequestArgs[];
1235 * List of open files files that were changes
1237 changedFiles?: FileCodeEdits[];
1239 * List of files that were closed
1241 closedFiles?: string[];
1244 * External projects have a typeAcquisition option so they need to be added separately to compiler options for inferred projects.
1246 type InferredProjectCompilerOptions = ExternalProjectCompilerOptions & TypeAcquisition;
1248 * Request to set compiler options for inferred projects.
1249 * External projects are opened / closed explicitly.
1250 * Configured projects are opened when user opens loose file that has 'tsconfig.json' or 'jsconfig.json' anywhere in one of containing folders.
1251 * This configuration file will be used to obtain a list of files and configuration settings for the project.
1252 * Inferred projects are created when user opens a loose file that is not the part of external project
1253 * or configured project and will contain only open file and transitive closure of referenced files if 'useOneInferredProject' is false,
1254 * or all open loose files and its transitive closure of referenced files if 'useOneInferredProject' is true.
1256 interface SetCompilerOptionsForInferredProjectsRequest extends Request {
1257 command: CommandTypes.CompilerOptionsForInferredProjects;
1258 arguments: SetCompilerOptionsForInferredProjectsArgs;
1261 * Argument for SetCompilerOptionsForInferredProjectsRequest request.
1263 interface SetCompilerOptionsForInferredProjectsArgs {
1265 * Compiler options to be used with inferred projects.
1267 options: InferredProjectCompilerOptions;
1269 * Specifies the project root path used to scope compiler options.
1270 * It is an error to provide this property if the server has not been started with
1271 * `useInferredProjectPerProjectRoot` enabled.
1273 projectRootPath?: string;
1276 * Response to SetCompilerOptionsForInferredProjectsResponse request. This is just an acknowledgement, so
1277 * no body field is required.
1279 interface SetCompilerOptionsForInferredProjectsResponse extends Response {
1282 * Exit request; value of command field is "exit". Ask the server process
1285 interface ExitRequest extends Request {
1286 command: CommandTypes.Exit;
1289 * Close request; value of command field is "close". Notify the
1290 * server that the client has closed a previously open file. If
1291 * file is still referenced by open files, the server will resume
1292 * monitoring the filesystem for changes to file. Server does not
1293 * currently send a response to a close request.
1295 interface CloseRequest extends FileRequest {
1296 command: CommandTypes.Close;
1299 * Request to obtain the list of files that should be regenerated if target file is recompiled.
1300 * NOTE: this us query-only operation and does not generate any output on disk.
1302 interface CompileOnSaveAffectedFileListRequest extends FileRequest {
1303 command: CommandTypes.CompileOnSaveAffectedFileList;
1306 * Contains a list of files that should be regenerated in a project
1308 interface CompileOnSaveAffectedFileListSingleProject {
1312 projectFileName: string;
1314 * List of files names that should be recompiled
1316 fileNames: string[];
1318 * true if project uses outFile or out compiler option
1320 projectUsesOutFile: boolean;
1323 * Response for CompileOnSaveAffectedFileListRequest request;
1325 interface CompileOnSaveAffectedFileListResponse extends Response {
1326 body: CompileOnSaveAffectedFileListSingleProject[];
1329 * Request to recompile the file. All generated outputs (.js, .d.ts or .js.map files) is written on disk.
1331 interface CompileOnSaveEmitFileRequest extends FileRequest {
1332 command: CommandTypes.CompileOnSaveEmitFile;
1333 arguments: CompileOnSaveEmitFileRequestArgs;
1336 * Arguments for CompileOnSaveEmitFileRequest
1338 interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs {
1340 * if true - then file should be recompiled even if it does not have any changes.
1343 includeLinePosition?: boolean;
1344 /** if true - return response as object with emitSkipped and diagnostics */
1345 richResponse?: boolean;
1347 interface CompileOnSaveEmitFileResponse extends Response {
1348 body: boolean | EmitResult;
1350 interface EmitResult {
1351 emitSkipped: boolean;
1352 diagnostics: Diagnostic[] | DiagnosticWithLinePosition[];
1355 * Quickinfo request; value of command field is
1356 * "quickinfo". Return response giving a quick type and
1357 * documentation string for the symbol found in file at location
1360 interface QuickInfoRequest extends FileLocationRequest {
1361 command: CommandTypes.Quickinfo;
1364 * Body of QuickInfoResponse.
1366 interface QuickInfoResponseBody {
1368 * The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
1370 kind: ScriptElementKind;
1372 * Optional modifiers for the kind (such as 'public').
1374 kindModifiers: string;
1376 * Starting file location of symbol.
1380 * One past last character of symbol.
1384 * Type and kind of symbol.
1386 displayString: string;
1388 * Documentation associated with symbol.
1390 documentation: string;
1392 * JSDoc tags associated with symbol.
1394 tags: JSDocTagInfo[];
1397 * Quickinfo response message.
1399 interface QuickInfoResponse extends Response {
1400 body?: QuickInfoResponseBody;
1403 * Arguments for format messages.
1405 interface FormatRequestArgs extends FileLocationRequestArgs {
1407 * Last line of range for which to format text in file.
1411 * Character offset on last line of range for which to format text in file.
1415 * Format options to be used.
1417 options?: FormatCodeSettings;
1420 * Format request; value of command field is "format". Return
1421 * response giving zero or more edit instructions. The edit
1422 * instructions will be sorted in file order. Applying the edit
1423 * instructions in reverse to file will result in correctly
1426 interface FormatRequest extends FileLocationRequest {
1427 command: CommandTypes.Format;
1428 arguments: FormatRequestArgs;
1431 * Object found in response messages defining an editing
1432 * instruction for a span of text in source code. The effect of
1433 * this instruction is to replace the text starting at start and
1434 * ending one character before end with newText. For an insertion,
1435 * the text span is empty. For a deletion, newText is empty.
1437 interface CodeEdit {
1439 * First character of the text span to edit.
1443 * One character past last character of the text span to edit.
1447 * Replace the span defined above with this string (may be
1448 * the empty string).
1452 interface FileCodeEdits {
1454 textChanges: CodeEdit[];
1456 interface CodeFixResponse extends Response {
1457 /** The code actions that are available */
1458 body?: CodeFixAction[];
1460 interface CodeAction {
1461 /** Description of the code action to display in the UI of the editor */
1462 description: string;
1463 /** Text changes to apply to each file as part of the code action */
1464 changes: FileCodeEdits[];
1465 /** A command is an opaque object that should be passed to `ApplyCodeActionCommandRequestArgs` without modification. */
1468 interface CombinedCodeActions {
1469 changes: readonly FileCodeEdits[];
1470 commands?: readonly {}[];
1472 interface CodeFixAction extends CodeAction {
1473 /** Short name to identify the fix, for use by telemetry. */
1476 * If present, one may call 'getCombinedCodeFix' with this fixId.
1477 * This may be omitted to indicate that the code fix can't be applied in a group.
1480 /** Should be present if and only if 'fixId' is. */
1481 fixAllDescription?: string;
1484 * Format and format on key response message.
1486 interface FormatResponse extends Response {
1490 * Arguments for format on key messages.
1492 interface FormatOnKeyRequestArgs extends FileLocationRequestArgs {
1494 * Key pressed (';', '\n', or '}').
1497 options?: FormatCodeSettings;
1500 * Format on key request; value of command field is
1501 * "formatonkey". Given file location and key typed (as string),
1502 * return response giving zero or more edit instructions. The
1503 * edit instructions will be sorted in file order. Applying the
1504 * edit instructions in reverse to file will result in correctly
1507 interface FormatOnKeyRequest extends FileLocationRequest {
1508 command: CommandTypes.Formatonkey;
1509 arguments: FormatOnKeyRequestArgs;
1511 type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#";
1513 * Arguments for completions messages.
1515 interface CompletionsRequestArgs extends FileLocationRequestArgs {
1517 * Optional prefix to apply to possible completions.
1521 * Character that was responsible for triggering completion.
1522 * Should be `undefined` if a user manually requested completion.
1524 triggerCharacter?: CompletionsTriggerCharacter;
1526 * @deprecated Use UserPreferences.includeCompletionsForModuleExports
1528 includeExternalModuleExports?: boolean;
1530 * @deprecated Use UserPreferences.includeCompletionsWithInsertText
1532 includeInsertTextCompletions?: boolean;
1535 * Completions request; value of command field is "completions".
1536 * Given a file location (file, line, col) and a prefix (which may
1537 * be the empty string), return the possible completions that
1538 * begin with prefix.
1540 interface CompletionsRequest extends FileLocationRequest {
1541 command: CommandTypes.Completions | CommandTypes.CompletionInfo;
1542 arguments: CompletionsRequestArgs;
1545 * Arguments for completion details request.
1547 interface CompletionDetailsRequestArgs extends FileLocationRequestArgs {
1549 * Names of one or more entries for which to obtain details.
1551 entryNames: (string | CompletionEntryIdentifier)[];
1553 interface CompletionEntryIdentifier {
1558 * Completion entry details request; value of command field is
1559 * "completionEntryDetails". Given a file location (file, line,
1560 * col) and an array of completion entry names return more
1561 * detailed information for each completion entry.
1563 interface CompletionDetailsRequest extends FileLocationRequest {
1564 command: CommandTypes.CompletionDetails;
1565 arguments: CompletionDetailsRequestArgs;
1568 * Part of a symbol description.
1570 interface SymbolDisplayPart {
1572 * Text of an item describing the symbol.
1576 * The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
1581 * An item found in a completion response.
1583 interface CompletionEntry {
1585 * The symbol's name.
1589 * The symbol's kind (such as 'className' or 'parameterName').
1591 kind: ScriptElementKind;
1593 * Optional modifiers for the kind (such as 'public').
1595 kindModifiers?: string;
1597 * A string that is used for comparing completion items so that they can be ordered. This
1598 * is often the same as the name but may be different in certain circumstances.
1602 * Text to insert instead of `name`.
1603 * This is used to support bracketed completions; If `name` might be "a-b" but `insertText` would be `["a-b"]`,
1604 * coupled with `replacementSpan` to replace a dotted access with a bracket access.
1606 insertText?: string;
1608 * An optional span that indicates the text to be replaced by this completion item.
1609 * If present, this span should be used instead of the default one.
1610 * It will be set if the required span differs from the one generated by the default replacement behavior.
1612 replacementSpan?: TextSpan;
1614 * Indicates whether commiting this completion entry will require additional code actions to be
1615 * made to avoid errors. The CompletionEntryDetails will have these actions.
1619 * Identifier (not necessarily human-readable) identifying where this completion came from.
1623 * If true, this completion should be highlighted as recommended. There will only be one of these.
1624 * 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.
1625 * Then either that enum/class or a namespace containing it will be the recommended symbol.
1627 isRecommended?: true;
1629 * If true, this completion was generated from traversing the name table of an unchecked JS file,
1630 * and therefore may not be accurate.
1632 isFromUncheckedFile?: true;
1634 * If true, this completion was for an auto-import of a module not yet in the program, but listed
1635 * in the project package.json.
1637 isPackageJsonImport?: true;
1640 * Additional completion entry details, available on demand
1642 interface CompletionEntryDetails {
1644 * The symbol's name.
1648 * The symbol's kind (such as 'className' or 'parameterName').
1650 kind: ScriptElementKind;
1652 * Optional modifiers for the kind (such as 'public').
1654 kindModifiers: string;
1656 * Display parts of the symbol (similar to quick info).
1658 displayParts: SymbolDisplayPart[];
1660 * Documentation strings for the symbol.
1662 documentation?: SymbolDisplayPart[];
1664 * JSDoc tags for the symbol.
1666 tags?: JSDocTagInfo[];
1668 * The associated code actions for this entry
1670 codeActions?: CodeAction[];
1672 * Human-readable description of the `source` from the CompletionEntry.
1674 source?: SymbolDisplayPart[];
1676 /** @deprecated Prefer CompletionInfoResponse, which supports several top-level fields in addition to the array of entries. */
1677 interface CompletionsResponse extends Response {
1678 body?: CompletionEntry[];
1680 interface CompletionInfoResponse extends Response {
1681 body?: CompletionInfo;
1683 interface CompletionInfo {
1684 readonly isGlobalCompletion: boolean;
1685 readonly isMemberCompletion: boolean;
1686 readonly isNewIdentifierLocation: boolean;
1688 * In the absence of `CompletionEntry["replacementSpan"]`, the editor may choose whether to use
1689 * this span or its default one. If `CompletionEntry["replacementSpan"]` is defined, that span
1690 * must be used to commit that completion entry.
1692 readonly optionalReplacementSpan?: TextSpan;
1693 readonly entries: readonly CompletionEntry[];
1695 interface CompletionDetailsResponse extends Response {
1696 body?: CompletionEntryDetails[];
1699 * Signature help information for a single parameter
1701 interface SignatureHelpParameter {
1703 * The parameter's name
1707 * Documentation of the parameter.
1709 documentation: SymbolDisplayPart[];
1711 * Display parts of the parameter.
1713 displayParts: SymbolDisplayPart[];
1715 * Whether the parameter is optional or not.
1717 isOptional: boolean;
1720 * Represents a single signature to show in signature help.
1722 interface SignatureHelpItem {
1724 * Whether the signature accepts a variable number of arguments.
1726 isVariadic: boolean;
1728 * The prefix display parts.
1730 prefixDisplayParts: SymbolDisplayPart[];
1732 * The suffix display parts.
1734 suffixDisplayParts: SymbolDisplayPart[];
1736 * The separator display parts.
1738 separatorDisplayParts: SymbolDisplayPart[];
1740 * The signature helps items for the parameters.
1742 parameters: SignatureHelpParameter[];
1744 * The signature's documentation
1746 documentation: SymbolDisplayPart[];
1748 * The signature's JSDoc tags
1750 tags: JSDocTagInfo[];
1753 * Signature help items found in the response of a signature help request.
1755 interface SignatureHelpItems {
1757 * The signature help items.
1759 items: SignatureHelpItem[];
1761 * The span for which signature help should appear on a signature
1763 applicableSpan: TextSpan;
1765 * The item selected in the set of available help items.
1767 selectedItemIndex: number;
1769 * The argument selected in the set of parameters.
1771 argumentIndex: number;
1773 * The argument count
1775 argumentCount: number;
1777 type SignatureHelpTriggerCharacter = "," | "(" | "<";
1778 type SignatureHelpRetriggerCharacter = SignatureHelpTriggerCharacter | ")";
1780 * Arguments of a signature help request.
1782 interface SignatureHelpRequestArgs extends FileLocationRequestArgs {
1784 * Reason why signature help was invoked.
1785 * See each individual possible
1787 triggerReason?: SignatureHelpTriggerReason;
1789 type SignatureHelpTriggerReason = SignatureHelpInvokedReason | SignatureHelpCharacterTypedReason | SignatureHelpRetriggeredReason;
1791 * Signals that the user manually requested signature help.
1792 * The language service will unconditionally attempt to provide a result.
1794 interface SignatureHelpInvokedReason {
1796 triggerCharacter?: undefined;
1799 * Signals that the signature help request came from a user typing a character.
1800 * Depending on the character and the syntactic context, the request may or may not be served a result.
1802 interface SignatureHelpCharacterTypedReason {
1803 kind: "characterTyped";
1805 * Character that was responsible for triggering signature help.
1807 triggerCharacter: SignatureHelpTriggerCharacter;
1810 * Signals that this signature help request came from typing a character or moving the cursor.
1811 * This should only occur if a signature help session was already active and the editor needs to see if it should adjust.
1812 * The language service will unconditionally attempt to provide a result.
1813 * `triggerCharacter` can be `undefined` for a retrigger caused by a cursor move.
1815 interface SignatureHelpRetriggeredReason {
1818 * Character that was responsible for triggering signature help.
1820 triggerCharacter?: SignatureHelpRetriggerCharacter;
1823 * Signature help request; value of command field is "signatureHelp".
1824 * Given a file location (file, line, col), return the signature
1827 interface SignatureHelpRequest extends FileLocationRequest {
1828 command: CommandTypes.SignatureHelp;
1829 arguments: SignatureHelpRequestArgs;
1832 * Response object for a SignatureHelpRequest.
1834 interface SignatureHelpResponse extends Response {
1835 body?: SignatureHelpItems;
1838 * Synchronous request for semantic diagnostics of one file.
1840 interface SemanticDiagnosticsSyncRequest extends FileRequest {
1841 command: CommandTypes.SemanticDiagnosticsSync;
1842 arguments: SemanticDiagnosticsSyncRequestArgs;
1844 interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs {
1845 includeLinePosition?: boolean;
1848 * Response object for synchronous sematic diagnostics request.
1850 interface SemanticDiagnosticsSyncResponse extends Response {
1851 body?: Diagnostic[] | DiagnosticWithLinePosition[];
1853 interface SuggestionDiagnosticsSyncRequest extends FileRequest {
1854 command: CommandTypes.SuggestionDiagnosticsSync;
1855 arguments: SuggestionDiagnosticsSyncRequestArgs;
1857 type SuggestionDiagnosticsSyncRequestArgs = SemanticDiagnosticsSyncRequestArgs;
1858 type SuggestionDiagnosticsSyncResponse = SemanticDiagnosticsSyncResponse;
1860 * Synchronous request for syntactic diagnostics of one file.
1862 interface SyntacticDiagnosticsSyncRequest extends FileRequest {
1863 command: CommandTypes.SyntacticDiagnosticsSync;
1864 arguments: SyntacticDiagnosticsSyncRequestArgs;
1866 interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs {
1867 includeLinePosition?: boolean;
1870 * Response object for synchronous syntactic diagnostics request.
1872 interface SyntacticDiagnosticsSyncResponse extends Response {
1873 body?: Diagnostic[] | DiagnosticWithLinePosition[];
1876 * Arguments for GeterrForProject request.
1878 interface GeterrForProjectRequestArgs {
1880 * the file requesting project error list
1884 * Delay in milliseconds to wait before starting to compute
1885 * errors for the files in the file list
1890 * GeterrForProjectRequest request; value of command field is
1891 * "geterrForProject". It works similarly with 'Geterr', only
1892 * it request for every file in this project.
1894 interface GeterrForProjectRequest extends Request {
1895 command: CommandTypes.GeterrForProject;
1896 arguments: GeterrForProjectRequestArgs;
1899 * Arguments for geterr messages.
1901 interface GeterrRequestArgs {
1903 * List of file names for which to compute compiler errors.
1904 * The files will be checked in list order.
1908 * Delay in milliseconds to wait before starting to compute
1909 * errors for the files in the file list
1914 * Geterr request; value of command field is "geterr". Wait for
1915 * delay milliseconds and then, if during the wait no change or
1916 * reload messages have arrived for the first file in the files
1917 * list, get the syntactic errors for the file, field requests,
1918 * and then get the semantic errors for the file. Repeat with a
1919 * smaller delay for each subsequent file on the files list. Best
1920 * practice for an editor is to send a file list containing each
1921 * file that is currently visible, in most-recently-used order.
1923 interface GeterrRequest extends Request {
1924 command: CommandTypes.Geterr;
1925 arguments: GeterrRequestArgs;
1927 type RequestCompletedEventName = "requestCompleted";
1929 * Event that is sent when server have finished processing request with specified id.
1931 interface RequestCompletedEvent extends Event {
1932 event: RequestCompletedEventName;
1933 body: RequestCompletedEventBody;
1935 interface RequestCompletedEventBody {
1936 request_seq: number;
1939 * Item of diagnostic information found in a DiagnosticEvent message.
1941 interface Diagnostic {
1943 * Starting file location at which text applies.
1947 * The last file location at which the text applies.
1951 * Text of diagnostic message.
1955 * The category of the diagnostic message, e.g. "error", "warning", or "suggestion".
1958 reportsUnnecessary?: {};
1959 reportsDeprecated?: {};
1961 * Any related spans the diagnostic may have, such as other locations relevant to an error, such as declarartion sites
1963 relatedInformation?: DiagnosticRelatedInformation[];
1965 * The error code of the diagnostic message.
1969 * The name of the plugin reporting the message.
1973 interface DiagnosticWithFileName extends Diagnostic {
1975 * Name of the file the diagnostic is in
1980 * Represents additional spans returned with a diagnostic which are relevant to it
1982 interface DiagnosticRelatedInformation {
1984 * The category of the related information message, e.g. "error", "warning", or "suggestion".
1988 * The code used ot identify the related information
1992 * Text of related or additional information.
1996 * Associated location
2000 interface DiagnosticEventBody {
2002 * The file for which diagnostic information is reported.
2006 * An array of diagnostic information items.
2008 diagnostics: Diagnostic[];
2010 type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag";
2012 * Event message for DiagnosticEventKind event types.
2013 * These events provide syntactic and semantic errors for a file.
2015 interface DiagnosticEvent extends Event {
2016 body?: DiagnosticEventBody;
2017 event: DiagnosticEventKind;
2019 interface ConfigFileDiagnosticEventBody {
2021 * The file which trigged the searching and error-checking of the config file
2023 triggerFile: string;
2025 * The name of the found config file.
2029 * An arry of diagnostic information items for the found config file.
2031 diagnostics: DiagnosticWithFileName[];
2034 * Event message for "configFileDiag" event type.
2035 * This event provides errors for a found config file.
2037 interface ConfigFileDiagnosticEvent extends Event {
2038 body?: ConfigFileDiagnosticEventBody;
2039 event: "configFileDiag";
2041 type ProjectLanguageServiceStateEventName = "projectLanguageServiceState";
2042 interface ProjectLanguageServiceStateEvent extends Event {
2043 event: ProjectLanguageServiceStateEventName;
2044 body?: ProjectLanguageServiceStateEventBody;
2046 interface ProjectLanguageServiceStateEventBody {
2048 * Project name that has changes in the state of language service.
2049 * For configured projects this will be the config file path.
2050 * For external projects this will be the name of the projects specified when project was open.
2051 * For inferred projects this event is not raised.
2053 projectName: string;
2055 * True if language service state switched from disabled to enabled
2056 * and false otherwise.
2058 languageServiceEnabled: boolean;
2060 type ProjectsUpdatedInBackgroundEventName = "projectsUpdatedInBackground";
2061 interface ProjectsUpdatedInBackgroundEvent extends Event {
2062 event: ProjectsUpdatedInBackgroundEventName;
2063 body: ProjectsUpdatedInBackgroundEventBody;
2065 interface ProjectsUpdatedInBackgroundEventBody {
2067 * Current set of open files
2069 openFiles: string[];
2071 type ProjectLoadingStartEventName = "projectLoadingStart";
2072 interface ProjectLoadingStartEvent extends Event {
2073 event: ProjectLoadingStartEventName;
2074 body: ProjectLoadingStartEventBody;
2076 interface ProjectLoadingStartEventBody {
2077 /** name of the project */
2078 projectName: string;
2079 /** reason for loading */
2082 type ProjectLoadingFinishEventName = "projectLoadingFinish";
2083 interface ProjectLoadingFinishEvent extends Event {
2084 event: ProjectLoadingFinishEventName;
2085 body: ProjectLoadingFinishEventBody;
2087 interface ProjectLoadingFinishEventBody {
2088 /** name of the project */
2089 projectName: string;
2091 type SurveyReadyEventName = "surveyReady";
2092 interface SurveyReadyEvent extends Event {
2093 event: SurveyReadyEventName;
2094 body: SurveyReadyEventBody;
2096 interface SurveyReadyEventBody {
2097 /** Name of the survey. This is an internal machine- and programmer-friendly name */
2100 type LargeFileReferencedEventName = "largeFileReferenced";
2101 interface LargeFileReferencedEvent extends Event {
2102 event: LargeFileReferencedEventName;
2103 body: LargeFileReferencedEventBody;
2105 interface LargeFileReferencedEventBody {
2107 * name of the large file being loaded
2115 * max file size allowed on the server
2117 maxFileSize: number;
2120 * Arguments for reload request.
2122 interface ReloadRequestArgs extends FileRequestArgs {
2124 * Name of temporary file from which to reload file
2125 * contents. May be same as file.
2130 * Reload request message; value of command field is "reload".
2131 * Reload contents of file with name given by the 'file' argument
2132 * from temporary file with name given by the 'tmpfile' argument.
2133 * The two names can be identical.
2135 interface ReloadRequest extends FileRequest {
2136 command: CommandTypes.Reload;
2137 arguments: ReloadRequestArgs;
2140 * Response to "reload" request. This is just an acknowledgement, so
2141 * no body field is required.
2143 interface ReloadResponse extends Response {
2146 * Arguments for saveto request.
2148 interface SavetoRequestArgs extends FileRequestArgs {
2150 * Name of temporary file into which to save server's view of
2156 * Saveto request message; value of command field is "saveto".
2157 * For debugging purposes, save to a temporaryfile (named by
2158 * argument 'tmpfile') the contents of file named by argument
2159 * 'file'. The server does not currently send a response to a
2162 interface SavetoRequest extends FileRequest {
2163 command: CommandTypes.Saveto;
2164 arguments: SavetoRequestArgs;
2167 * Arguments for navto request message.
2169 interface NavtoRequestArgs {
2171 * Search term to navigate to from current location; term can
2172 * be '.*' or an identifier prefix.
2174 searchValue: string;
2176 * Optional limit on the number of items to return.
2178 maxResultCount?: number;
2180 * The file for the request (absolute pathname required).
2184 * Optional flag to indicate we want results for just the current file
2185 * or the entire project.
2187 currentFileOnly?: boolean;
2188 projectFileName?: string;
2191 * Navto request message; value of command field is "navto".
2192 * Return list of objects giving file locations and symbols that
2193 * match the search term given in argument 'searchTerm'. The
2194 * context for the search is given by the named file.
2196 interface NavtoRequest extends Request {
2197 command: CommandTypes.Navto;
2198 arguments: NavtoRequestArgs;
2201 * An item found in a navto response.
2203 interface NavtoItem extends FileSpan {
2205 * The symbol's name.
2209 * The symbol's kind (such as 'className' or 'parameterName').
2211 kind: ScriptElementKind;
2213 * exact, substring, or prefix.
2217 * If this was a case sensitive or insensitive match.
2219 isCaseSensitive: boolean;
2221 * Optional modifiers for the kind (such as 'public').
2223 kindModifiers?: string;
2225 * Name of symbol's container symbol (if any); for example,
2226 * the class name if symbol is a class member.
2228 containerName?: string;
2230 * Kind of symbol's container symbol (if any).
2232 containerKind?: ScriptElementKind;
2235 * Navto response message. Body is an array of navto items. Each
2236 * item gives a symbol that matched the search term.
2238 interface NavtoResponse extends Response {
2242 * Arguments for change request message.
2244 interface ChangeRequestArgs extends FormatRequestArgs {
2246 * Optional string to insert at location (file, line, offset).
2248 insertString?: string;
2251 * Change request message; value of command field is "change".
2252 * Update the server's view of the file named by argument 'file'.
2253 * Server does not currently send a response to a change request.
2255 interface ChangeRequest extends FileLocationRequest {
2256 command: CommandTypes.Change;
2257 arguments: ChangeRequestArgs;
2260 * Response to "brace" request.
2262 interface BraceResponse extends Response {
2266 * Brace matching request; value of command field is "brace".
2267 * Return response giving the file locations of matching braces
2268 * found in file at location line, offset.
2270 interface BraceRequest extends FileLocationRequest {
2271 command: CommandTypes.Brace;
2274 * NavBar items request; value of command field is "navbar".
2275 * Return response giving the list of navigation bar entries
2276 * extracted from the requested file.
2278 interface NavBarRequest extends FileRequest {
2279 command: CommandTypes.NavBar;
2282 * NavTree request; value of command field is "navtree".
2283 * Return response giving the navigation tree of the requested file.
2285 interface NavTreeRequest extends FileRequest {
2286 command: CommandTypes.NavTree;
2288 interface NavigationBarItem {
2290 * The item's display text.
2294 * The symbol's kind (such as 'className' or 'parameterName').
2296 kind: ScriptElementKind;
2298 * Optional modifiers for the kind (such as 'public').
2300 kindModifiers?: string;
2302 * The definition locations of the item.
2306 * Optional children.
2308 childItems?: NavigationBarItem[];
2310 * Number of levels deep this item should appear.
2314 /** protocol.NavigationTree is identical to ts.NavigationTree, except using protocol.TextSpan instead of ts.TextSpan */
2315 interface NavigationTree {
2317 kind: ScriptElementKind;
2318 kindModifiers: string;
2320 nameSpan: TextSpan | undefined;
2321 childItems?: NavigationTree[];
2323 type TelemetryEventName = "telemetry";
2324 interface TelemetryEvent extends Event {
2325 event: TelemetryEventName;
2326 body: TelemetryEventBody;
2328 interface TelemetryEventBody {
2329 telemetryEventName: string;
2332 type TypesInstallerInitializationFailedEventName = "typesInstallerInitializationFailed";
2333 interface TypesInstallerInitializationFailedEvent extends Event {
2334 event: TypesInstallerInitializationFailedEventName;
2335 body: TypesInstallerInitializationFailedEventBody;
2337 interface TypesInstallerInitializationFailedEventBody {
2340 type TypingsInstalledTelemetryEventName = "typingsInstalled";
2341 interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody {
2342 telemetryEventName: TypingsInstalledTelemetryEventName;
2343 payload: TypingsInstalledTelemetryEventPayload;
2345 interface TypingsInstalledTelemetryEventPayload {
2347 * Comma separated list of installed typing packages
2349 installedPackages: string;
2351 * true if install request succeeded, otherwise - false
2353 installSuccess: boolean;
2355 * version of typings installer
2357 typingsInstallerVersion: string;
2359 type BeginInstallTypesEventName = "beginInstallTypes";
2360 type EndInstallTypesEventName = "endInstallTypes";
2361 interface BeginInstallTypesEvent extends Event {
2362 event: BeginInstallTypesEventName;
2363 body: BeginInstallTypesEventBody;
2365 interface EndInstallTypesEvent extends Event {
2366 event: EndInstallTypesEventName;
2367 body: EndInstallTypesEventBody;
2369 interface InstallTypesEventBody {
2371 * correlation id to match begin and end events
2375 * list of packages to install
2377 packages: readonly string[];
2379 interface BeginInstallTypesEventBody extends InstallTypesEventBody {
2381 interface EndInstallTypesEventBody extends InstallTypesEventBody {
2383 * true if installation succeeded, otherwise false
2387 interface NavBarResponse extends Response {
2388 body?: NavigationBarItem[];
2390 interface NavTreeResponse extends Response {
2391 body?: NavigationTree;
2393 interface CallHierarchyItem {
2395 kind: ScriptElementKind;
2396 kindModifiers?: string;
2399 selectionSpan: TextSpan;
2400 containerName?: string;
2402 interface CallHierarchyIncomingCall {
2403 from: CallHierarchyItem;
2404 fromSpans: TextSpan[];
2406 interface CallHierarchyOutgoingCall {
2407 to: CallHierarchyItem;
2408 fromSpans: TextSpan[];
2410 interface PrepareCallHierarchyRequest extends FileLocationRequest {
2411 command: CommandTypes.PrepareCallHierarchy;
2413 interface PrepareCallHierarchyResponse extends Response {
2414 readonly body: CallHierarchyItem | CallHierarchyItem[];
2416 interface ProvideCallHierarchyIncomingCallsRequest extends FileLocationRequest {
2417 command: CommandTypes.ProvideCallHierarchyIncomingCalls;
2419 interface ProvideCallHierarchyIncomingCallsResponse extends Response {
2420 readonly body: CallHierarchyIncomingCall[];
2422 interface ProvideCallHierarchyOutgoingCallsRequest extends FileLocationRequest {
2423 command: CommandTypes.ProvideCallHierarchyOutgoingCalls;
2425 interface ProvideCallHierarchyOutgoingCallsResponse extends Response {
2426 readonly body: CallHierarchyOutgoingCall[];
2428 const enum IndentStyle {
2433 enum SemicolonPreference {
2438 interface EditorSettings {
2439 baseIndentSize?: number;
2440 indentSize?: number;
2442 newLineCharacter?: string;
2443 convertTabsToSpaces?: boolean;
2444 indentStyle?: IndentStyle | ts.IndentStyle;
2445 trimTrailingWhitespace?: boolean;
2447 interface FormatCodeSettings extends EditorSettings {
2448 insertSpaceAfterCommaDelimiter?: boolean;
2449 insertSpaceAfterSemicolonInForStatements?: boolean;
2450 insertSpaceBeforeAndAfterBinaryOperators?: boolean;
2451 insertSpaceAfterConstructor?: boolean;
2452 insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
2453 insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
2454 insertSpaceAfterOpeningAndBeforeClosingEmptyBraces?: boolean;
2455 insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
2456 insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
2457 insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
2458 insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
2459 insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
2460 insertSpaceAfterTypeAssertion?: boolean;
2461 insertSpaceBeforeFunctionParenthesis?: boolean;
2462 placeOpenBraceOnNewLineForFunctions?: boolean;
2463 placeOpenBraceOnNewLineForControlBlocks?: boolean;
2464 insertSpaceBeforeTypeAnnotation?: boolean;
2465 semicolons?: SemicolonPreference;
2467 interface UserPreferences {
2468 readonly disableSuggestions?: boolean;
2469 readonly quotePreference?: "auto" | "double" | "single";
2471 * If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
2472 * This affects lone identifier completions but not completions on the right hand side of `obj.`.
2474 readonly includeCompletionsForModuleExports?: boolean;
2476 * If enabled, the completion list will include completions with invalid identifier names.
2477 * For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`.
2479 readonly includeCompletionsWithInsertText?: boolean;
2481 * Unless this option is `false`, or `includeCompletionsWithInsertText` is not enabled,
2482 * member completion lists triggered with `.` will include entries on potentially-null and potentially-undefined
2483 * values, with insertion text to replace preceding `.` tokens with `?.`.
2485 readonly includeAutomaticOptionalChainCompletions?: boolean;
2486 readonly importModuleSpecifierPreference?: "auto" | "relative" | "non-relative";
2487 /** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
2488 readonly importModuleSpecifierEnding?: "auto" | "minimal" | "index" | "js";
2489 readonly allowTextChangesInNewFiles?: boolean;
2490 readonly lazyConfiguredProjectsFromExternalProject?: boolean;
2491 readonly providePrefixAndSuffixTextForRename?: boolean;
2492 readonly provideRefactorNotApplicableReason?: boolean;
2493 readonly allowRenameOfImportPath?: boolean;
2494 readonly includePackageJsonAutoImports?: "auto" | "on" | "off";
2496 interface CompilerOptions {
2498 allowSyntheticDefaultImports?: boolean;
2499 allowUnreachableCode?: boolean;
2500 allowUnusedLabels?: boolean;
2501 alwaysStrict?: boolean;
2505 declaration?: boolean;
2506 declarationDir?: string;
2507 disableSizeLimit?: boolean;
2508 downlevelIteration?: boolean;
2510 emitDecoratorMetadata?: boolean;
2511 experimentalDecorators?: boolean;
2512 forceConsistentCasingInFileNames?: boolean;
2513 importHelpers?: boolean;
2514 inlineSourceMap?: boolean;
2515 inlineSources?: boolean;
2516 isolatedModules?: boolean;
2517 jsx?: JsxEmit | ts.JsxEmit;
2521 maxNodeModuleJsDepth?: number;
2522 module?: ModuleKind | ts.ModuleKind;
2523 moduleResolution?: ModuleResolutionKind | ts.ModuleResolutionKind;
2524 newLine?: NewLineKind | ts.NewLineKind;
2526 noEmitHelpers?: boolean;
2527 noEmitOnError?: boolean;
2528 noErrorTruncation?: boolean;
2529 noFallthroughCasesInSwitch?: boolean;
2530 noImplicitAny?: boolean;
2531 noImplicitReturns?: boolean;
2532 noImplicitThis?: boolean;
2533 noUnusedLocals?: boolean;
2534 noUnusedParameters?: boolean;
2535 noImplicitUseStrict?: boolean;
2537 noResolve?: boolean;
2541 paths?: MapLike<string[]>;
2542 plugins?: PluginImport[];
2543 preserveConstEnums?: boolean;
2544 preserveSymlinks?: boolean;
2546 reactNamespace?: string;
2547 removeComments?: boolean;
2548 references?: ProjectReference[];
2550 rootDirs?: string[];
2551 skipLibCheck?: boolean;
2552 skipDefaultLibCheck?: boolean;
2553 sourceMap?: boolean;
2554 sourceRoot?: string;
2556 strictNullChecks?: boolean;
2557 suppressExcessPropertyErrors?: boolean;
2558 suppressImplicitAnyIndexErrors?: boolean;
2559 useDefineForClassFields?: boolean;
2560 target?: ScriptTarget | ts.ScriptTarget;
2561 traceResolution?: boolean;
2562 resolveJsonModule?: boolean;
2564 /** Paths used to used to compute primary types search locations */
2565 typeRoots?: string[];
2566 [option: string]: CompilerOptionsValue | undefined;
2568 const enum JsxEmit {
2570 Preserve = "Preserve",
2571 ReactNative = "ReactNative",
2573 ReactJSX = "ReactJSX",
2574 ReactJSXDev = "ReactJSXDev"
2576 const enum ModuleKind {
2578 CommonJS = "CommonJS",
2587 const enum ModuleResolutionKind {
2588 Classic = "Classic",
2591 const enum NewLineKind {
2595 const enum ScriptTarget {
2609 declare namespace ts.server.protocol {
2611 interface TextInsertion {
2613 /** The position in newText the caret should point to after the insertion. */
2614 caretOffset: number;
2617 interface TodoCommentDescriptor {
2622 interface TodoComment {
2623 descriptor: TodoCommentDescriptor;
2628 enum OutliningSpanKind {
2629 /** Single or multi-line comments */
2630 Comment = "comment",
2631 /** Sections marked by '// #region' and '// #endregion' comments */
2633 /** Declarations and expressions */
2635 /** Contiguous blocks of import declarations */
2639 enum HighlightSpanKind {
2641 definition = "definition",
2642 reference = "reference",
2643 writtenReference = "writtenReference"
2646 enum ScriptElementKind {
2648 warning = "warning",
2649 /** predefined type (void) or keyword (class) */
2650 keyword = "keyword",
2651 /** top level script node */
2652 scriptElement = "script",
2653 /** module foo {} */
2654 moduleElement = "module",
2656 classElement = "class",
2657 /** var x = class X {} */
2658 localClassElement = "local class",
2659 /** interface Y {} */
2660 interfaceElement = "interface",
2662 typeElement = "type",
2664 enumElement = "enum",
2665 enumMemberElement = "enum member",
2667 * Inside module and script only
2670 variableElement = "var",
2671 /** Inside function */
2672 localVariableElement = "local var",
2674 * Inside module and script only
2677 functionElement = "function",
2678 /** Inside function */
2679 localFunctionElement = "local function",
2680 /** class X { [public|private]* foo() {} } */
2681 memberFunctionElement = "method",
2682 /** class X { [public|private]* [get|set] foo:number; } */
2683 memberGetAccessorElement = "getter",
2684 memberSetAccessorElement = "setter",
2686 * class X { [public|private]* foo:number; }
2687 * interface Y { foo:number; }
2689 memberVariableElement = "property",
2690 /** class X { constructor() { } } */
2691 constructorImplementationElement = "constructor",
2692 /** interface Y { ():number; } */
2693 callSignatureElement = "call",
2694 /** interface Y { []:number; } */
2695 indexSignatureElement = "index",
2696 /** interface Y { new():Y; } */
2697 constructSignatureElement = "construct",
2698 /** function foo(*Y*: string) */
2699 parameterElement = "parameter",
2700 typeParameterElement = "type parameter",
2701 primitiveType = "primitive type",
2704 constElement = "const",
2706 directory = "directory",
2707 externalModuleName = "external module name",
2709 * <JsxTagName attribute1 attribute2={0} />
2711 jsxAttribute = "JSX attribute",
2712 /** String literal */
2716 export interface TypeAcquisition {
2718 * @deprecated typingOptions.enableAutoDiscovery
2719 * Use typeAcquisition.enable instead.
2721 enableAutoDiscovery?: boolean;
2725 disableFilenameBasedTypeAcquisition?: boolean;
2726 [option: string]: CompilerOptionsValue | undefined;
2729 export type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]> | PluginImport[] | ProjectReference[] | null | undefined;
2731 export interface FileExtensionInfo {
2733 isMixedContent: boolean;
2734 scriptKind?: ScriptKind;
2737 interface JSDocTagInfo {
2743 * Type of objects whose values are all of the same type.
2744 * The `in` and `for-in` operators can *not* be safely used,
2745 * since `Object.prototype` may be modified by outside code.
2747 interface MapLike<T> {
2751 export interface PluginImport {
2755 export interface ProjectReference {
2756 /** A normalized path on disk */
2758 /** The path as the user originally wrote it */
2759 originalPath?: string;
2760 /** True if the output of this reference should be prepended to the output of this project. Only valid for --outFile compilations */
2762 /** True if it is intended that this reference form a circularity */
2766 declare namespace ts {
2767 // these types are empty stubs for types from services and should not be used directly
2768 export type ScriptKind = never;
2769 export type WatchFileKind = never;
2770 export type WatchDirectoryKind = never;
2771 export type PollingWatchKind = never;
2772 export type IndentStyle = never;
2773 export type JsxEmit = never;
2774 export type ModuleKind = never;
2775 export type ModuleResolutionKind = never;
2776 export type NewLineKind = never;
2777 export type ScriptTarget = never;
2779 import protocol = ts.server.protocol;
2781 export as namespace protocol;