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",
23 FileReferences = "fileReferences",
25 Formatonkey = "formatonkey",
27 GeterrForProject = "geterrForProject",
28 SemanticDiagnosticsSync = "semanticDiagnosticsSync",
29 SyntacticDiagnosticsSync = "syntacticDiagnosticsSync",
30 SuggestionDiagnosticsSync = "suggestionDiagnosticsSync",
34 NavTreeFull = "navtree-full",
36 Occurrences = "occurrences",
37 DocumentHighlights = "documentHighlights",
39 Quickinfo = "quickinfo",
40 References = "references",
44 SignatureHelp = "signatureHelp",
46 TypeDefinition = "typeDefinition",
47 ProjectInfo = "projectInfo",
48 ReloadProjects = "reloadProjects",
50 OpenExternalProject = "openExternalProject",
51 OpenExternalProjects = "openExternalProjects",
52 CloseExternalProject = "closeExternalProject",
53 UpdateOpen = "updateOpen",
54 GetOutliningSpans = "getOutliningSpans",
55 TodoComments = "todoComments",
56 Indentation = "indentation",
57 DocCommentTemplate = "docCommentTemplate",
58 CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects",
59 GetCodeFixes = "getCodeFixes",
60 GetCombinedCodeFix = "getCombinedCodeFix",
61 ApplyCodeActionCommand = "applyCodeActionCommand",
62 GetSupportedCodeFixes = "getSupportedCodeFixes",
63 GetApplicableRefactors = "getApplicableRefactors",
64 GetEditsForRefactor = "getEditsForRefactor",
65 OrganizeImports = "organizeImports",
66 GetEditsForFileRename = "getEditsForFileRename",
67 ConfigurePlugin = "configurePlugin",
68 SelectionRange = "selectionRange",
69 ToggleLineComment = "toggleLineComment",
70 ToggleMultilineComment = "toggleMultilineComment",
71 CommentSelection = "commentSelection",
72 UncommentSelection = "uncommentSelection",
73 PrepareCallHierarchy = "prepareCallHierarchy",
74 ProvideCallHierarchyIncomingCalls = "provideCallHierarchyIncomingCalls",
75 ProvideCallHierarchyOutgoingCalls = "provideCallHierarchyOutgoingCalls",
76 ProvideInlayHints = "provideInlayHints"
79 * A TypeScript Server message
83 * Sequence number of the message
87 * One of "request", "response", or "event"
89 type: "request" | "response" | "event";
92 * Client-initiated request message
94 interface Request extends Message {
97 * The command to execute
101 * Object containing arguments for the command
106 * Request to reload the project structure for all the opened files
108 interface ReloadProjectsRequest extends Message {
109 command: CommandTypes.ReloadProjects;
112 * Server-initiated event message
114 interface Event extends Message {
121 * Event-specific information
126 * Response by server to client request message.
128 interface Response extends Message {
131 * Sequence number of the request message.
135 * Outcome of the request.
139 * The command requested.
143 * If success === false, this should always be provided.
144 * Otherwise, may (or may not) contain a success message.
148 * Contains message body if success === true.
152 * Contains extra information that plugin can include to be passed on
156 * Exposes information about the performance of this request-response pair.
158 performanceData?: PerformanceData;
160 interface PerformanceData {
162 * Time spent updating the program graph, in milliseconds.
164 updateGraphDurationMs?: number;
166 * The time spent creating or updating the auto-import program, in milliseconds.
168 createAutoImportProviderProgramDurationMs?: number;
171 * Arguments for FileRequest messages.
173 interface FileRequestArgs {
175 * The file for the request (absolute pathname required).
178 projectFileName?: string;
180 interface StatusRequest extends Request {
181 command: CommandTypes.Status;
183 interface StatusResponseBody {
185 * The TypeScript version (`ts.version`).
190 * Response to StatusRequest
192 interface StatusResponse extends Response {
193 body: StatusResponseBody;
196 * Requests a JS Doc comment template for a given position
198 interface DocCommentTemplateRequest extends FileLocationRequest {
199 command: CommandTypes.DocCommentTemplate;
202 * Response to DocCommentTemplateRequest
204 interface DocCommandTemplateResponse extends Response {
205 body?: TextInsertion;
208 * A request to get TODO comments from the file
210 interface TodoCommentRequest extends FileRequest {
211 command: CommandTypes.TodoComments;
212 arguments: TodoCommentRequestArgs;
215 * Arguments for TodoCommentRequest request.
217 interface TodoCommentRequestArgs extends FileRequestArgs {
219 * Array of target TodoCommentDescriptors that describes TODO comments to be found
221 descriptors: TodoCommentDescriptor[];
224 * Response for TodoCommentRequest request.
226 interface TodoCommentsResponse extends Response {
227 body?: TodoComment[];
230 * A request to determine if the caret is inside a comment.
232 interface SpanOfEnclosingCommentRequest extends FileLocationRequest {
233 command: CommandTypes.GetSpanOfEnclosingComment;
234 arguments: SpanOfEnclosingCommentRequestArgs;
236 interface SpanOfEnclosingCommentRequestArgs extends FileLocationRequestArgs {
238 * Requires that the enclosing span be a multi-line comment, or else the request returns undefined.
240 onlyMultiLine: boolean;
243 * Request to obtain outlining spans in file.
245 interface OutliningSpansRequest extends FileRequest {
246 command: CommandTypes.GetOutliningSpans;
248 interface OutliningSpan {
249 /** The span of the document to actually collapse. */
251 /** The span of the document to display when the user hovers over the collapsed span. */
253 /** The text to display in the editor for the collapsed region. */
256 * Whether or not this region should be automatically collapsed when
257 * the 'Collapse to Definitions' command is invoked.
259 autoCollapse: boolean;
261 * Classification of the contents of the span
263 kind: OutliningSpanKind;
266 * Response to OutliningSpansRequest request.
268 interface OutliningSpansResponse extends Response {
269 body?: OutliningSpan[];
272 * A request to get indentation for a location in file
274 interface IndentationRequest extends FileLocationRequest {
275 command: CommandTypes.Indentation;
276 arguments: IndentationRequestArgs;
279 * Response for IndentationRequest request.
281 interface IndentationResponse extends Response {
282 body?: IndentationResult;
285 * Indentation result representing where indentation should be placed
287 interface IndentationResult {
289 * The base position in the document that the indent should be relative to
293 * The number of columns the indent should be at relative to the position's column.
298 * Arguments for IndentationRequest request.
300 interface IndentationRequestArgs extends FileLocationRequestArgs {
302 * An optional set of settings to be used when computing indentation.
303 * If argument is omitted - then it will use settings for file that were previously set via 'configure' request or global settings.
305 options?: EditorSettings;
308 * Arguments for ProjectInfoRequest request.
310 interface ProjectInfoRequestArgs extends FileRequestArgs {
312 * Indicate if the file name list of the project is needed
314 needFileNameList: boolean;
317 * A request to get the project information of the current file.
319 interface ProjectInfoRequest extends Request {
320 command: CommandTypes.ProjectInfo;
321 arguments: ProjectInfoRequestArgs;
324 * A request to retrieve compiler options diagnostics for a project
326 interface CompilerOptionsDiagnosticsRequest extends Request {
327 arguments: CompilerOptionsDiagnosticsRequestArgs;
330 * Arguments for CompilerOptionsDiagnosticsRequest request.
332 interface CompilerOptionsDiagnosticsRequestArgs {
334 * Name of the project to retrieve compiler options diagnostics.
336 projectFileName: string;
339 * Response message body for "projectInfo" request
341 interface ProjectInfo {
343 * For configured project, this is the normalized path of the 'tsconfig.json' file
344 * For inferred project, this is undefined
346 configFileName: string;
348 * The list of normalized file name in the project, including 'lib.d.ts'
350 fileNames?: string[];
352 * Indicates if the project has a active language service instance
354 languageServiceDisabled?: boolean;
357 * Represents diagnostic info that includes location of diagnostic in two forms
358 * - start position and length of the error span
359 * - startLocation and endLocation - a pair of Location objects that store start/end line and offset of the error span.
361 interface DiagnosticWithLinePosition {
365 startLocation: Location;
366 endLocation: Location;
369 /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */
370 reportsUnnecessary?: {};
371 reportsDeprecated?: {};
372 relatedInformation?: DiagnosticRelatedInformation[];
375 * Response message for "projectInfo" request
377 interface ProjectInfoResponse extends Response {
381 * Request whose sole parameter is a file name.
383 interface FileRequest extends Request {
384 arguments: FileRequestArgs;
387 * Instances of this interface specify a location in a source file:
388 * (file, line, character offset), where line and character offset are 1-based.
390 interface FileLocationRequestArgs extends FileRequestArgs {
392 * The line number for the request (1-based).
396 * The character offset (on the line) for the request (1-based).
400 type FileLocationOrRangeRequestArgs = FileLocationRequestArgs | FileRangeRequestArgs;
402 * Request refactorings at a given position or selection area.
404 interface GetApplicableRefactorsRequest extends Request {
405 command: CommandTypes.GetApplicableRefactors;
406 arguments: GetApplicableRefactorsRequestArgs;
408 type GetApplicableRefactorsRequestArgs = FileLocationOrRangeRequestArgs & {
409 triggerReason?: RefactorTriggerReason;
412 type RefactorTriggerReason = "implicit" | "invoked";
414 * Response is a list of available refactorings.
415 * Each refactoring exposes one or more "Actions"; a user selects one action to invoke a refactoring
417 interface GetApplicableRefactorsResponse extends Response {
418 body?: ApplicableRefactorInfo[];
421 * A set of one or more available refactoring actions, grouped under a parent refactoring.
423 interface ApplicableRefactorInfo {
425 * The programmatic name of the refactoring
429 * A description of this refactoring category to show to the user.
430 * If the refactoring gets inlined (see below), this text will not be visible.
434 * Inlineable refactorings can have their actions hoisted out to the top level
435 * of a context menu. Non-inlineanable refactorings should always be shown inside
436 * their parent grouping.
438 * If not specified, this value is assumed to be 'true'
440 inlineable?: boolean;
441 actions: RefactorActionInfo[];
444 * Represents a single refactoring action - for example, the "Extract Method..." refactor might
445 * offer several actions, each corresponding to a surround class or closure to extract into.
447 interface RefactorActionInfo {
449 * The programmatic name of the refactoring action
453 * A description of this refactoring action to show to the user.
454 * If the parent refactoring is inlined away, this will be the only text shown,
455 * so this description should make sense by itself if the parent is inlineable=true
459 * A message to show to the user if the refactoring cannot be applied in
460 * the current context.
462 notApplicableReason?: string;
464 * The hierarchical dotted name of the refactor action.
468 interface GetEditsForRefactorRequest extends Request {
469 command: CommandTypes.GetEditsForRefactor;
470 arguments: GetEditsForRefactorRequestArgs;
473 * Request the edits that a particular refactoring action produces.
474 * Callers must specify the name of the refactor and the name of the action.
476 type GetEditsForRefactorRequestArgs = FileLocationOrRangeRequestArgs & {
480 interface GetEditsForRefactorResponse extends Response {
481 body?: RefactorEditInfo;
483 interface RefactorEditInfo {
484 edits: FileCodeEdits[];
486 * An optional location where the editor should start a rename operation once
487 * the refactoring edits have been applied
489 renameLocation?: Location;
490 renameFilename?: string;
493 * Organize imports by:
494 * 1) Removing unused imports
495 * 2) Coalescing imports from the same module
498 interface OrganizeImportsRequest extends Request {
499 command: CommandTypes.OrganizeImports;
500 arguments: OrganizeImportsRequestArgs;
502 type OrganizeImportsScope = GetCombinedCodeFixScope;
503 interface OrganizeImportsRequestArgs {
504 scope: OrganizeImportsScope;
505 skipDestructiveCodeActions?: boolean;
507 interface OrganizeImportsResponse extends Response {
508 body: readonly FileCodeEdits[];
510 interface GetEditsForFileRenameRequest extends Request {
511 command: CommandTypes.GetEditsForFileRename;
512 arguments: GetEditsForFileRenameRequestArgs;
514 /** Note: Paths may also be directories. */
515 interface GetEditsForFileRenameRequestArgs {
516 readonly oldFilePath: string;
517 readonly newFilePath: string;
519 interface GetEditsForFileRenameResponse extends Response {
520 body: readonly FileCodeEdits[];
523 * Request for the available codefixes at a specific position.
525 interface CodeFixRequest extends Request {
526 command: CommandTypes.GetCodeFixes;
527 arguments: CodeFixRequestArgs;
529 interface GetCombinedCodeFixRequest extends Request {
530 command: CommandTypes.GetCombinedCodeFix;
531 arguments: GetCombinedCodeFixRequestArgs;
533 interface GetCombinedCodeFixResponse extends Response {
534 body: CombinedCodeActions;
536 interface ApplyCodeActionCommandRequest extends Request {
537 command: CommandTypes.ApplyCodeActionCommand;
538 arguments: ApplyCodeActionCommandRequestArgs;
540 interface ApplyCodeActionCommandResponse extends Response {
542 interface FileRangeRequestArgs extends FileRequestArgs {
544 * The line number for the request (1-based).
548 * The character offset (on the line) for the request (1-based).
552 * The line number for the request (1-based).
556 * The character offset (on the line) for the request (1-based).
561 * Instances of this interface specify errorcodes on a specific location in a sourcefile.
563 interface CodeFixRequestArgs extends FileRangeRequestArgs {
565 * Errorcodes we want to get the fixes for.
567 errorCodes: readonly number[];
569 interface GetCombinedCodeFixRequestArgs {
570 scope: GetCombinedCodeFixScope;
573 interface GetCombinedCodeFixScope {
575 args: FileRequestArgs;
577 interface ApplyCodeActionCommandRequestArgs {
578 /** May also be an array of commands. */
582 * Response for GetCodeFixes request.
584 interface GetCodeFixesResponse extends Response {
588 * A request whose arguments specify a file location (file, line, col).
590 interface FileLocationRequest extends FileRequest {
591 arguments: FileLocationRequestArgs;
594 * A request to get codes of supported code fixes.
596 interface GetSupportedCodeFixesRequest extends Request {
597 command: CommandTypes.GetSupportedCodeFixes;
600 * A response for GetSupportedCodeFixesRequest request.
602 interface GetSupportedCodeFixesResponse extends Response {
604 * List of error codes supported by the server.
609 * A request to get encoded semantic classifications for a span in the file
611 interface EncodedSemanticClassificationsRequest extends FileRequest {
612 arguments: EncodedSemanticClassificationsRequestArgs;
615 * Arguments for EncodedSemanticClassificationsRequest request.
617 interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs {
619 * Start position of the span.
623 * Length of the span.
627 * Optional parameter for the semantic highlighting response, if absent it
628 * defaults to "original".
630 format?: "original" | "2020";
632 /** The response for a EncodedSemanticClassificationsRequest */
633 interface EncodedSemanticClassificationsResponse extends Response {
634 body?: EncodedSemanticClassificationsResponseBody;
637 * Implementation response message. Gives series of text spans depending on the format ar.
639 interface EncodedSemanticClassificationsResponseBody {
640 endOfLineState: EndOfLineState;
644 * Arguments in document highlight request; include: filesToSearch, file,
647 interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs {
649 * List of files to search for document highlights.
651 filesToSearch: string[];
654 * Go to definition request; value of command field is
655 * "definition". Return response giving the file locations that
656 * define the symbol found in file at location line, col.
658 interface DefinitionRequest extends FileLocationRequest {
659 command: CommandTypes.Definition;
661 interface DefinitionAndBoundSpanRequest extends FileLocationRequest {
662 readonly command: CommandTypes.DefinitionAndBoundSpan;
664 interface DefinitionAndBoundSpanResponse extends Response {
665 readonly body: DefinitionInfoAndBoundSpan;
668 * Go to type request; value of command field is
669 * "typeDefinition". Return response giving the file locations that
670 * define the type for the symbol found in file at location line, col.
672 interface TypeDefinitionRequest extends FileLocationRequest {
673 command: CommandTypes.TypeDefinition;
676 * Go to implementation request; value of command field is
677 * "implementation". Return response giving the file locations that
678 * implement the symbol found in file at location line, col.
680 interface ImplementationRequest extends FileLocationRequest {
681 command: CommandTypes.Implementation;
684 * Location in source code expressed as (one-based) line and (one-based) column offset.
691 * Object found in response messages defining a span of text in source code.
695 * First character of the definition.
699 * One character past last character of the definition.
704 * Object found in response messages defining a span of text in a specific source file.
706 interface FileSpan extends TextSpan {
708 * File containing text span.
712 interface JSDocTagInfo {
713 /** Name of the JSDoc tag */
716 * Comment text after the JSDoc tag -- the text after the tag name until the next tag or end of comment
717 * Display parts when UserPreferences.displayPartsForJSDoc is true, flattened to string otherwise.
719 text?: string | SymbolDisplayPart[];
721 interface TextSpanWithContext extends TextSpan {
722 contextStart?: Location;
723 contextEnd?: Location;
725 interface FileSpanWithContext extends FileSpan, TextSpanWithContext {
727 interface DefinitionInfo extends FileSpanWithContext {
729 * When true, the file may or may not exist.
731 unverified?: boolean;
733 interface DefinitionInfoAndBoundSpan {
734 definitions: readonly DefinitionInfo[];
738 * Definition response message. Gives text range for definition.
740 interface DefinitionResponse extends Response {
741 body?: DefinitionInfo[];
743 interface DefinitionInfoAndBoundSpanResponse extends Response {
744 body?: DefinitionInfoAndBoundSpan;
746 /** @deprecated Use `DefinitionInfoAndBoundSpanResponse` instead. */
747 type DefinitionInfoAndBoundSpanReponse = DefinitionInfoAndBoundSpanResponse;
749 * Definition response message. Gives text range for definition.
751 interface TypeDefinitionResponse extends Response {
752 body?: FileSpanWithContext[];
755 * Implementation response message. Gives text range for implementations.
757 interface ImplementationResponse extends Response {
758 body?: FileSpanWithContext[];
761 * Request to get brace completion for a location in the file.
763 interface BraceCompletionRequest extends FileLocationRequest {
764 command: CommandTypes.BraceCompletion;
765 arguments: BraceCompletionRequestArgs;
768 * Argument for BraceCompletionRequest request.
770 interface BraceCompletionRequestArgs extends FileLocationRequestArgs {
772 * Kind of opening brace
774 openingBrace: string;
776 interface JsxClosingTagRequest extends FileLocationRequest {
777 readonly command: CommandTypes.JsxClosingTag;
778 readonly arguments: JsxClosingTagRequestArgs;
780 interface JsxClosingTagRequestArgs extends FileLocationRequestArgs {
782 interface JsxClosingTagResponse extends Response {
783 readonly body: TextInsertion;
787 * Get occurrences request; value of command field is
788 * "occurrences". Return response giving spans that are relevant
789 * in the file at a given line and column.
791 interface OccurrencesRequest extends FileLocationRequest {
792 command: CommandTypes.Occurrences;
795 interface OccurrencesResponseItem extends FileSpanWithContext {
797 * True if the occurrence is a write location, false otherwise.
799 isWriteAccess: boolean;
801 * True if the occurrence is in a string, undefined otherwise;
806 interface OccurrencesResponse extends Response {
807 body?: OccurrencesResponseItem[];
810 * Get document highlights request; value of command field is
811 * "documentHighlights". Return response giving spans that are relevant
812 * in the file at a given line and column.
814 interface DocumentHighlightsRequest extends FileLocationRequest {
815 command: CommandTypes.DocumentHighlights;
816 arguments: DocumentHighlightsRequestArgs;
819 * Span augmented with extra information that denotes the kind of the highlighting to be used for span.
821 interface HighlightSpan extends TextSpanWithContext {
822 kind: HighlightSpanKind;
825 * Represents a set of highligh spans for a give name
827 interface DocumentHighlightsItem {
829 * File containing highlight spans.
833 * Spans to highlight in file.
835 highlightSpans: HighlightSpan[];
838 * Response for a DocumentHighlightsRequest request.
840 interface DocumentHighlightsResponse extends Response {
841 body?: DocumentHighlightsItem[];
844 * Find references request; value of command field is
845 * "references". Return response giving the file locations that
846 * reference the symbol found in file at location line, col.
848 interface ReferencesRequest extends FileLocationRequest {
849 command: CommandTypes.References;
851 interface ReferencesResponseItem extends FileSpanWithContext {
852 /** Text of line containing the reference. Including this
853 * with the response avoids latency of editor loading files
854 * to show text of reference line (the server already has
855 * loaded the referencing files).
859 * True if reference is a write location, false otherwise.
861 isWriteAccess: boolean;
863 * True if reference is a definition, false otherwise.
865 isDefinition: boolean;
868 * The body of a "references" response message.
870 interface ReferencesResponseBody {
872 * The file locations referencing the symbol.
874 refs: readonly ReferencesResponseItem[];
876 * The name of the symbol.
880 * The start character offset of the symbol (on the line provided by the references request).
882 symbolStartOffset: number;
884 * The full display name of the symbol.
886 symbolDisplayString: string;
889 * Response to "references" request.
891 interface ReferencesResponse extends Response {
892 body?: ReferencesResponseBody;
894 interface FileReferencesRequest extends FileRequest {
895 command: CommandTypes.FileReferences;
897 interface FileReferencesResponseBody {
899 * The file locations referencing the symbol.
901 refs: readonly ReferencesResponseItem[];
903 * The name of the symbol.
907 interface FileReferencesResponse extends Response {
908 body?: FileReferencesResponseBody;
911 * Argument for RenameRequest request.
913 interface RenameRequestArgs extends FileLocationRequestArgs {
915 * Should text at specified location be found/changed in comments?
917 findInComments?: boolean;
919 * Should text at specified location be found/changed in strings?
921 findInStrings?: boolean;
924 * Rename request; value of command field is "rename". Return
925 * response giving the file locations that reference the symbol
926 * found in file at location line, col. Also return full display
927 * name of the symbol so that client can print it unambiguously.
929 interface RenameRequest extends FileLocationRequest {
930 command: CommandTypes.Rename;
931 arguments: RenameRequestArgs;
934 * Information about the item to be renamed.
936 type RenameInfo = RenameInfoSuccess | RenameInfoFailure;
937 interface RenameInfoSuccess {
939 * True if item can be renamed.
943 * File or directory to rename.
944 * If set, `getEditsForFileRename` should be called instead of `findRenameLocations`.
946 fileToRename?: string;
948 * Display name of the item to be renamed.
952 * Full display name of item to be renamed.
954 fullDisplayName: string;
956 * The items's kind (such as 'className' or 'parameterName' or plain 'text').
958 kind: ScriptElementKind;
960 * Optional modifiers for the kind (such as 'public').
962 kindModifiers: string;
963 /** Span of text to rename. */
964 triggerSpan: TextSpan;
966 interface RenameInfoFailure {
969 * Error message if item can not be renamed.
971 localizedErrorMessage: string;
974 * A group of text spans, all in 'file'.
976 interface SpanGroup {
977 /** The file to which the spans apply */
979 /** The text spans in this group */
980 locs: RenameTextSpan[];
982 interface RenameTextSpan extends TextSpanWithContext {
983 readonly prefixText?: string;
984 readonly suffixText?: string;
986 interface RenameResponseBody {
988 * Information about the item to be renamed.
992 * An array of span groups (one per file) that refer to the item to be renamed.
994 locs: readonly SpanGroup[];
997 * Rename response message.
999 interface RenameResponse extends Response {
1000 body?: RenameResponseBody;
1003 * Represents a file in external project.
1004 * External project is project whose set of files, compilation options and open\close state
1005 * is maintained by the client (i.e. if all this data come from .csproj file in Visual Studio).
1006 * External project will exist even if all files in it are closed and should be closed explicitly.
1007 * If external project includes one or more tsconfig.json/jsconfig.json files then tsserver will
1008 * create configured project for every config file but will maintain a link that these projects were created
1009 * as a result of opening external project so they should be removed once external project is closed.
1011 interface ExternalFile {
1017 * Script kind of the file
1019 scriptKind?: ScriptKindName | ts.ScriptKind;
1021 * Whether file has mixed content (i.e. .cshtml file that combines html markup with C#/JavaScript)
1023 hasMixedContent?: boolean;
1025 * Content of the file
1030 * Represent an external project
1032 interface ExternalProject {
1036 projectFileName: string;
1038 * List of root files in project
1040 rootFiles: ExternalFile[];
1042 * Compiler options for the project
1044 options: ExternalProjectCompilerOptions;
1046 * @deprecated typingOptions. Use typeAcquisition instead
1048 typingOptions?: TypeAcquisition;
1050 * Explicitly specified type acquisition for the project
1052 typeAcquisition?: TypeAcquisition;
1054 interface CompileOnSaveMixin {
1056 * If compile on save is enabled for the project
1058 compileOnSave?: boolean;
1061 * For external projects, some of the project settings are sent together with
1062 * compiler settings.
1064 type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin & WatchOptions;
1065 interface FileWithProjectReferenceRedirectInfo {
1071 * True if the file is primarily included in a referenced project
1073 isSourceOfProjectReferenceRedirect: boolean;
1076 * Represents a set of changes that happen in project
1078 interface ProjectChanges {
1080 * List of added files
1082 added: string[] | FileWithProjectReferenceRedirectInfo[];
1084 * List of removed files
1086 removed: string[] | FileWithProjectReferenceRedirectInfo[];
1088 * List of updated files
1090 updated: string[] | FileWithProjectReferenceRedirectInfo[];
1092 * List of files that have had their project reference redirect status updated
1093 * Only provided when the synchronizeProjectList request has includeProjectReferenceRedirectInfo set to true
1095 updatedRedirects?: FileWithProjectReferenceRedirectInfo[];
1098 * Information found in a configure request.
1100 interface ConfigureRequestArguments {
1102 * Information about the host, for example 'Emacs 24.4' or
1103 * 'Sublime Text version 3075'
1107 * If present, tab settings apply only to this file.
1111 * The format options to use during formatting and other code editing features.
1113 formatOptions?: FormatCodeSettings;
1114 preferences?: UserPreferences;
1116 * The host's additional supported .js file extensions
1118 extraFileExtensions?: FileExtensionInfo[];
1119 watchOptions?: WatchOptions;
1121 const enum WatchFileKind {
1122 FixedPollingInterval = "FixedPollingInterval",
1123 PriorityPollingInterval = "PriorityPollingInterval",
1124 DynamicPriorityPolling = "DynamicPriorityPolling",
1125 FixedChunkSizePolling = "FixedChunkSizePolling",
1126 UseFsEvents = "UseFsEvents",
1127 UseFsEventsOnParentDirectory = "UseFsEventsOnParentDirectory"
1129 const enum WatchDirectoryKind {
1130 UseFsEvents = "UseFsEvents",
1131 FixedPollingInterval = "FixedPollingInterval",
1132 DynamicPriorityPolling = "DynamicPriorityPolling",
1133 FixedChunkSizePolling = "FixedChunkSizePolling"
1135 const enum PollingWatchKind {
1136 FixedInterval = "FixedInterval",
1137 PriorityInterval = "PriorityInterval",
1138 DynamicPriority = "DynamicPriority",
1139 FixedChunkSize = "FixedChunkSize"
1141 interface WatchOptions {
1142 watchFile?: WatchFileKind | ts.WatchFileKind;
1143 watchDirectory?: WatchDirectoryKind | ts.WatchDirectoryKind;
1144 fallbackPolling?: PollingWatchKind | ts.PollingWatchKind;
1145 synchronousWatchDirectory?: boolean;
1146 excludeDirectories?: string[];
1147 excludeFiles?: string[];
1148 [option: string]: CompilerOptionsValue | undefined;
1151 * Configure request; value of command field is "configure". Specifies
1152 * host information, such as host type, tab size, and indent size.
1154 interface ConfigureRequest extends Request {
1155 command: CommandTypes.Configure;
1156 arguments: ConfigureRequestArguments;
1159 * Response to "configure" request. This is just an acknowledgement, so
1160 * no body field is required.
1162 interface ConfigureResponse extends Response {
1164 interface ConfigurePluginRequestArguments {
1168 interface ConfigurePluginRequest extends Request {
1169 command: CommandTypes.ConfigurePlugin;
1170 arguments: ConfigurePluginRequestArguments;
1172 interface ConfigurePluginResponse extends Response {
1174 interface SelectionRangeRequest extends FileRequest {
1175 command: CommandTypes.SelectionRange;
1176 arguments: SelectionRangeRequestArgs;
1178 interface SelectionRangeRequestArgs extends FileRequestArgs {
1179 locations: Location[];
1181 interface SelectionRangeResponse extends Response {
1182 body?: SelectionRange[];
1184 interface SelectionRange {
1186 parent?: SelectionRange;
1188 interface ToggleLineCommentRequest extends FileRequest {
1189 command: CommandTypes.ToggleLineComment;
1190 arguments: FileRangeRequestArgs;
1192 interface ToggleMultilineCommentRequest extends FileRequest {
1193 command: CommandTypes.ToggleMultilineComment;
1194 arguments: FileRangeRequestArgs;
1196 interface CommentSelectionRequest extends FileRequest {
1197 command: CommandTypes.CommentSelection;
1198 arguments: FileRangeRequestArgs;
1200 interface UncommentSelectionRequest extends FileRequest {
1201 command: CommandTypes.UncommentSelection;
1202 arguments: FileRangeRequestArgs;
1205 * Information found in an "open" request.
1207 interface OpenRequestArgs extends FileRequestArgs {
1209 * Used when a version of the file content is known to be more up to date than the one on disk.
1210 * Then the known content will be used upon opening instead of the disk copy
1212 fileContent?: string;
1214 * Used to specify the script kind of the file explicitly. It could be one of the following:
1215 * "TS", "JS", "TSX", "JSX"
1217 scriptKindName?: ScriptKindName;
1219 * Used to limit the searching for project config file. If given the searching will stop at this
1220 * root path; otherwise it will go all the way up to the dist root path.
1222 projectRootPath?: string;
1224 type ScriptKindName = "TS" | "JS" | "TSX" | "JSX";
1226 * Open request; value of command field is "open". Notify the
1227 * server that the client has file open. The server will not
1228 * monitor the filesystem for changes in this file and will assume
1229 * that the client is updating the server (using the change and/or
1230 * reload messages) when the file changes. Server does not currently
1231 * send a response to an open request.
1233 interface OpenRequest extends Request {
1234 command: CommandTypes.Open;
1235 arguments: OpenRequestArgs;
1238 * Request to open or update external project
1240 interface OpenExternalProjectRequest extends Request {
1241 command: CommandTypes.OpenExternalProject;
1242 arguments: OpenExternalProjectArgs;
1245 * Arguments to OpenExternalProjectRequest request
1247 type OpenExternalProjectArgs = ExternalProject;
1249 * Request to open multiple external projects
1251 interface OpenExternalProjectsRequest extends Request {
1252 command: CommandTypes.OpenExternalProjects;
1253 arguments: OpenExternalProjectsArgs;
1256 * Arguments to OpenExternalProjectsRequest
1258 interface OpenExternalProjectsArgs {
1260 * List of external projects to open or update
1262 projects: ExternalProject[];
1265 * Response to OpenExternalProjectRequest request. This is just an acknowledgement, so
1266 * no body field is required.
1268 interface OpenExternalProjectResponse extends Response {
1271 * Response to OpenExternalProjectsRequest request. This is just an acknowledgement, so
1272 * no body field is required.
1274 interface OpenExternalProjectsResponse extends Response {
1277 * Request to close external project.
1279 interface CloseExternalProjectRequest extends Request {
1280 command: CommandTypes.CloseExternalProject;
1281 arguments: CloseExternalProjectRequestArgs;
1284 * Arguments to CloseExternalProjectRequest request
1286 interface CloseExternalProjectRequestArgs {
1288 * Name of the project to close
1290 projectFileName: string;
1293 * Response to CloseExternalProjectRequest request. This is just an acknowledgement, so
1294 * no body field is required.
1296 interface CloseExternalProjectResponse extends Response {
1299 * Request to synchronize list of open files with the client
1301 interface UpdateOpenRequest extends Request {
1302 command: CommandTypes.UpdateOpen;
1303 arguments: UpdateOpenRequestArgs;
1306 * Arguments to UpdateOpenRequest
1308 interface UpdateOpenRequestArgs {
1310 * List of newly open files
1312 openFiles?: OpenRequestArgs[];
1314 * List of open files files that were changes
1316 changedFiles?: FileCodeEdits[];
1318 * List of files that were closed
1320 closedFiles?: string[];
1323 * External projects have a typeAcquisition option so they need to be added separately to compiler options for inferred projects.
1325 type InferredProjectCompilerOptions = ExternalProjectCompilerOptions & TypeAcquisition;
1327 * Request to set compiler options for inferred projects.
1328 * External projects are opened / closed explicitly.
1329 * Configured projects are opened when user opens loose file that has 'tsconfig.json' or 'jsconfig.json' anywhere in one of containing folders.
1330 * This configuration file will be used to obtain a list of files and configuration settings for the project.
1331 * Inferred projects are created when user opens a loose file that is not the part of external project
1332 * or configured project and will contain only open file and transitive closure of referenced files if 'useOneInferredProject' is false,
1333 * or all open loose files and its transitive closure of referenced files if 'useOneInferredProject' is true.
1335 interface SetCompilerOptionsForInferredProjectsRequest extends Request {
1336 command: CommandTypes.CompilerOptionsForInferredProjects;
1337 arguments: SetCompilerOptionsForInferredProjectsArgs;
1340 * Argument for SetCompilerOptionsForInferredProjectsRequest request.
1342 interface SetCompilerOptionsForInferredProjectsArgs {
1344 * Compiler options to be used with inferred projects.
1346 options: InferredProjectCompilerOptions;
1348 * Specifies the project root path used to scope compiler options.
1349 * It is an error to provide this property if the server has not been started with
1350 * `useInferredProjectPerProjectRoot` enabled.
1352 projectRootPath?: string;
1355 * Response to SetCompilerOptionsForInferredProjectsResponse request. This is just an acknowledgement, so
1356 * no body field is required.
1358 interface SetCompilerOptionsForInferredProjectsResponse extends Response {
1361 * Exit request; value of command field is "exit". Ask the server process
1364 interface ExitRequest extends Request {
1365 command: CommandTypes.Exit;
1368 * Close request; value of command field is "close". Notify the
1369 * server that the client has closed a previously open file. If
1370 * file is still referenced by open files, the server will resume
1371 * monitoring the filesystem for changes to file. Server does not
1372 * currently send a response to a close request.
1374 interface CloseRequest extends FileRequest {
1375 command: CommandTypes.Close;
1378 * Request to obtain the list of files that should be regenerated if target file is recompiled.
1379 * NOTE: this us query-only operation and does not generate any output on disk.
1381 interface CompileOnSaveAffectedFileListRequest extends FileRequest {
1382 command: CommandTypes.CompileOnSaveAffectedFileList;
1385 * Contains a list of files that should be regenerated in a project
1387 interface CompileOnSaveAffectedFileListSingleProject {
1391 projectFileName: string;
1393 * List of files names that should be recompiled
1395 fileNames: string[];
1397 * true if project uses outFile or out compiler option
1399 projectUsesOutFile: boolean;
1402 * Response for CompileOnSaveAffectedFileListRequest request;
1404 interface CompileOnSaveAffectedFileListResponse extends Response {
1405 body: CompileOnSaveAffectedFileListSingleProject[];
1408 * Request to recompile the file. All generated outputs (.js, .d.ts or .js.map files) is written on disk.
1410 interface CompileOnSaveEmitFileRequest extends FileRequest {
1411 command: CommandTypes.CompileOnSaveEmitFile;
1412 arguments: CompileOnSaveEmitFileRequestArgs;
1415 * Arguments for CompileOnSaveEmitFileRequest
1417 interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs {
1419 * if true - then file should be recompiled even if it does not have any changes.
1422 includeLinePosition?: boolean;
1423 /** if true - return response as object with emitSkipped and diagnostics */
1424 richResponse?: boolean;
1426 interface CompileOnSaveEmitFileResponse extends Response {
1427 body: boolean | EmitResult;
1429 interface EmitResult {
1430 emitSkipped: boolean;
1431 diagnostics: Diagnostic[] | DiagnosticWithLinePosition[];
1434 * Quickinfo request; value of command field is
1435 * "quickinfo". Return response giving a quick type and
1436 * documentation string for the symbol found in file at location
1439 interface QuickInfoRequest extends FileLocationRequest {
1440 command: CommandTypes.Quickinfo;
1441 arguments: FileLocationRequestArgs;
1444 * Body of QuickInfoResponse.
1446 interface QuickInfoResponseBody {
1448 * The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
1450 kind: ScriptElementKind;
1452 * Optional modifiers for the kind (such as 'public').
1454 kindModifiers: string;
1456 * Starting file location of symbol.
1460 * One past last character of symbol.
1464 * Type and kind of symbol.
1466 displayString: string;
1468 * Documentation associated with symbol.
1469 * Display parts when UserPreferences.displayPartsForJSDoc is true, flattened to string otherwise.
1471 documentation: string | SymbolDisplayPart[];
1473 * JSDoc tags associated with symbol.
1475 tags: JSDocTagInfo[];
1478 * Quickinfo response message.
1480 interface QuickInfoResponse extends Response {
1481 body?: QuickInfoResponseBody;
1484 * Arguments for format messages.
1486 interface FormatRequestArgs extends FileLocationRequestArgs {
1488 * Last line of range for which to format text in file.
1492 * Character offset on last line of range for which to format text in file.
1496 * Format options to be used.
1498 options?: FormatCodeSettings;
1501 * Format request; value of command field is "format". Return
1502 * response giving zero or more edit instructions. The edit
1503 * instructions will be sorted in file order. Applying the edit
1504 * instructions in reverse to file will result in correctly
1507 interface FormatRequest extends FileLocationRequest {
1508 command: CommandTypes.Format;
1509 arguments: FormatRequestArgs;
1512 * Object found in response messages defining an editing
1513 * instruction for a span of text in source code. The effect of
1514 * this instruction is to replace the text starting at start and
1515 * ending one character before end with newText. For an insertion,
1516 * the text span is empty. For a deletion, newText is empty.
1518 interface CodeEdit {
1520 * First character of the text span to edit.
1524 * One character past last character of the text span to edit.
1528 * Replace the span defined above with this string (may be
1529 * the empty string).
1533 interface FileCodeEdits {
1535 textChanges: CodeEdit[];
1537 interface CodeFixResponse extends Response {
1538 /** The code actions that are available */
1539 body?: CodeFixAction[];
1541 interface CodeAction {
1542 /** Description of the code action to display in the UI of the editor */
1543 description: string;
1544 /** Text changes to apply to each file as part of the code action */
1545 changes: FileCodeEdits[];
1546 /** A command is an opaque object that should be passed to `ApplyCodeActionCommandRequestArgs` without modification. */
1549 interface CombinedCodeActions {
1550 changes: readonly FileCodeEdits[];
1551 commands?: readonly {}[];
1553 interface CodeFixAction extends CodeAction {
1554 /** Short name to identify the fix, for use by telemetry. */
1557 * If present, one may call 'getCombinedCodeFix' with this fixId.
1558 * This may be omitted to indicate that the code fix can't be applied in a group.
1561 /** Should be present if and only if 'fixId' is. */
1562 fixAllDescription?: string;
1565 * Format and format on key response message.
1567 interface FormatResponse extends Response {
1571 * Arguments for format on key messages.
1573 interface FormatOnKeyRequestArgs extends FileLocationRequestArgs {
1575 * Key pressed (';', '\n', or '}').
1578 options?: FormatCodeSettings;
1581 * Format on key request; value of command field is
1582 * "formatonkey". Given file location and key typed (as string),
1583 * return response giving zero or more edit instructions. The
1584 * edit instructions will be sorted in file order. Applying the
1585 * edit instructions in reverse to file will result in correctly
1588 interface FormatOnKeyRequest extends FileLocationRequest {
1589 command: CommandTypes.Formatonkey;
1590 arguments: FormatOnKeyRequestArgs;
1592 type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#" | " ";
1593 const enum CompletionTriggerKind {
1594 /** Completion was triggered by typing an identifier, manual invocation (e.g Ctrl+Space) or via API. */
1596 /** Completion was triggered by a trigger character. */
1597 TriggerCharacter = 2,
1598 /** Completion was re-triggered as the current completion list is incomplete. */
1599 TriggerForIncompleteCompletions = 3
1602 * Arguments for completions messages.
1604 interface CompletionsRequestArgs extends FileLocationRequestArgs {
1606 * Optional prefix to apply to possible completions.
1610 * Character that was responsible for triggering completion.
1611 * Should be `undefined` if a user manually requested completion.
1613 triggerCharacter?: CompletionsTriggerCharacter;
1614 triggerKind?: CompletionTriggerKind;
1616 * @deprecated Use UserPreferences.includeCompletionsForModuleExports
1618 includeExternalModuleExports?: boolean;
1620 * @deprecated Use UserPreferences.includeCompletionsWithInsertText
1622 includeInsertTextCompletions?: boolean;
1625 * Completions request; value of command field is "completions".
1626 * Given a file location (file, line, col) and a prefix (which may
1627 * be the empty string), return the possible completions that
1628 * begin with prefix.
1630 interface CompletionsRequest extends FileLocationRequest {
1631 command: CommandTypes.Completions | CommandTypes.CompletionInfo;
1632 arguments: CompletionsRequestArgs;
1635 * Arguments for completion details request.
1637 interface CompletionDetailsRequestArgs extends FileLocationRequestArgs {
1639 * Names of one or more entries for which to obtain details.
1641 entryNames: (string | CompletionEntryIdentifier)[];
1643 interface CompletionEntryIdentifier {
1649 * Completion entry details request; value of command field is
1650 * "completionEntryDetails". Given a file location (file, line,
1651 * col) and an array of completion entry names return more
1652 * detailed information for each completion entry.
1654 interface CompletionDetailsRequest extends FileLocationRequest {
1655 command: CommandTypes.CompletionDetails;
1656 arguments: CompletionDetailsRequestArgs;
1659 * Part of a symbol description.
1661 interface SymbolDisplayPart {
1663 * Text of an item describing the symbol.
1667 * The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
1671 /** A part of a symbol description that links from a jsdoc @link tag to a declaration */
1672 interface JSDocLinkDisplayPart extends SymbolDisplayPart {
1673 /** The location of the declaration that the @link tag links to. */
1677 * An item found in a completion response.
1679 interface CompletionEntry {
1681 * The symbol's name.
1685 * The symbol's kind (such as 'className' or 'parameterName').
1687 kind: ScriptElementKind;
1689 * Optional modifiers for the kind (such as 'public').
1691 kindModifiers?: string;
1693 * A string that is used for comparing completion items so that they can be ordered. This
1694 * is often the same as the name but may be different in certain circumstances.
1698 * Text to insert instead of `name`.
1699 * This is used to support bracketed completions; If `name` might be "a-b" but `insertText` would be `["a-b"]`,
1700 * coupled with `replacementSpan` to replace a dotted access with a bracket access.
1702 insertText?: string;
1704 * `insertText` should be interpreted as a snippet if true.
1708 * An optional span that indicates the text to be replaced by this completion item.
1709 * If present, this span should be used instead of the default one.
1710 * It will be set if the required span differs from the one generated by the default replacement behavior.
1712 replacementSpan?: TextSpan;
1714 * Indicates whether commiting this completion entry will require additional code actions to be
1715 * made to avoid errors. The CompletionEntryDetails will have these actions.
1719 * Identifier (not necessarily human-readable) identifying where this completion came from.
1723 * Human-readable description of the `source`.
1725 sourceDisplay?: SymbolDisplayPart[];
1727 * If true, this completion should be highlighted as recommended. There will only be one of these.
1728 * 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.
1729 * Then either that enum/class or a namespace containing it will be the recommended symbol.
1731 isRecommended?: true;
1733 * If true, this completion was generated from traversing the name table of an unchecked JS file,
1734 * and therefore may not be accurate.
1736 isFromUncheckedFile?: true;
1738 * If true, this completion was for an auto-import of a module not yet in the program, but listed
1739 * in the project package.json. Used for telemetry reporting.
1741 isPackageJsonImport?: true;
1743 * If true, this completion was an auto-import-style completion of an import statement (i.e., the
1744 * module specifier was inserted along with the imported identifier). Used for telemetry reporting.
1746 isImportStatementCompletion?: true;
1748 * A property to be sent back to TS Server in the CompletionDetailsRequest, along with `name`,
1749 * that allows TS Server to look up the symbol represented by the completion item, disambiguating
1750 * items with the same name.
1755 * Additional completion entry details, available on demand
1757 interface CompletionEntryDetails {
1759 * The symbol's name.
1763 * The symbol's kind (such as 'className' or 'parameterName').
1765 kind: ScriptElementKind;
1767 * Optional modifiers for the kind (such as 'public').
1769 kindModifiers: string;
1771 * Display parts of the symbol (similar to quick info).
1773 displayParts: SymbolDisplayPart[];
1775 * Documentation strings for the symbol.
1777 documentation?: SymbolDisplayPart[];
1779 * JSDoc tags for the symbol.
1781 tags?: JSDocTagInfo[];
1783 * The associated code actions for this entry
1785 codeActions?: CodeAction[];
1787 * @deprecated Use `sourceDisplay` instead.
1789 source?: SymbolDisplayPart[];
1791 * Human-readable description of the `source` from the CompletionEntry.
1793 sourceDisplay?: SymbolDisplayPart[];
1795 /** @deprecated Prefer CompletionInfoResponse, which supports several top-level fields in addition to the array of entries. */
1796 interface CompletionsResponse extends Response {
1797 body?: CompletionEntry[];
1799 interface CompletionInfoResponse extends Response {
1800 body?: CompletionInfo;
1802 interface CompletionInfo {
1803 readonly isGlobalCompletion: boolean;
1804 readonly isMemberCompletion: boolean;
1805 readonly isNewIdentifierLocation: boolean;
1807 * In the absence of `CompletionEntry["replacementSpan"]`, the editor may choose whether to use
1808 * this span or its default one. If `CompletionEntry["replacementSpan"]` is defined, that span
1809 * must be used to commit that completion entry.
1811 readonly optionalReplacementSpan?: TextSpan;
1812 readonly isIncomplete?: boolean;
1813 readonly entries: readonly CompletionEntry[];
1815 interface CompletionDetailsResponse extends Response {
1816 body?: CompletionEntryDetails[];
1819 * Signature help information for a single parameter
1821 interface SignatureHelpParameter {
1823 * The parameter's name
1827 * Documentation of the parameter.
1829 documentation: SymbolDisplayPart[];
1831 * Display parts of the parameter.
1833 displayParts: SymbolDisplayPart[];
1835 * Whether the parameter is optional or not.
1837 isOptional: boolean;
1840 * Represents a single signature to show in signature help.
1842 interface SignatureHelpItem {
1844 * Whether the signature accepts a variable number of arguments.
1846 isVariadic: boolean;
1848 * The prefix display parts.
1850 prefixDisplayParts: SymbolDisplayPart[];
1852 * The suffix display parts.
1854 suffixDisplayParts: SymbolDisplayPart[];
1856 * The separator display parts.
1858 separatorDisplayParts: SymbolDisplayPart[];
1860 * The signature helps items for the parameters.
1862 parameters: SignatureHelpParameter[];
1864 * The signature's documentation
1866 documentation: SymbolDisplayPart[];
1868 * The signature's JSDoc tags
1870 tags: JSDocTagInfo[];
1873 * Signature help items found in the response of a signature help request.
1875 interface SignatureHelpItems {
1877 * The signature help items.
1879 items: SignatureHelpItem[];
1881 * The span for which signature help should appear on a signature
1883 applicableSpan: TextSpan;
1885 * The item selected in the set of available help items.
1887 selectedItemIndex: number;
1889 * The argument selected in the set of parameters.
1891 argumentIndex: number;
1893 * The argument count
1895 argumentCount: number;
1897 type SignatureHelpTriggerCharacter = "," | "(" | "<";
1898 type SignatureHelpRetriggerCharacter = SignatureHelpTriggerCharacter | ")";
1900 * Arguments of a signature help request.
1902 interface SignatureHelpRequestArgs extends FileLocationRequestArgs {
1904 * Reason why signature help was invoked.
1905 * See each individual possible
1907 triggerReason?: SignatureHelpTriggerReason;
1909 type SignatureHelpTriggerReason = SignatureHelpInvokedReason | SignatureHelpCharacterTypedReason | SignatureHelpRetriggeredReason;
1911 * Signals that the user manually requested signature help.
1912 * The language service will unconditionally attempt to provide a result.
1914 interface SignatureHelpInvokedReason {
1916 triggerCharacter?: undefined;
1919 * Signals that the signature help request came from a user typing a character.
1920 * Depending on the character and the syntactic context, the request may or may not be served a result.
1922 interface SignatureHelpCharacterTypedReason {
1923 kind: "characterTyped";
1925 * Character that was responsible for triggering signature help.
1927 triggerCharacter: SignatureHelpTriggerCharacter;
1930 * Signals that this signature help request came from typing a character or moving the cursor.
1931 * This should only occur if a signature help session was already active and the editor needs to see if it should adjust.
1932 * The language service will unconditionally attempt to provide a result.
1933 * `triggerCharacter` can be `undefined` for a retrigger caused by a cursor move.
1935 interface SignatureHelpRetriggeredReason {
1938 * Character that was responsible for triggering signature help.
1940 triggerCharacter?: SignatureHelpRetriggerCharacter;
1943 * Signature help request; value of command field is "signatureHelp".
1944 * Given a file location (file, line, col), return the signature
1947 interface SignatureHelpRequest extends FileLocationRequest {
1948 command: CommandTypes.SignatureHelp;
1949 arguments: SignatureHelpRequestArgs;
1952 * Response object for a SignatureHelpRequest.
1954 interface SignatureHelpResponse extends Response {
1955 body?: SignatureHelpItems;
1957 type InlayHintKind = "Type" | "Parameter" | "Enum";
1958 interface InlayHintsRequestArgs extends FileRequestArgs {
1960 * Start position of the span.
1964 * Length of the span.
1968 interface InlayHintsRequest extends Request {
1969 command: CommandTypes.ProvideInlayHints;
1970 arguments: InlayHintsRequestArgs;
1972 interface InlayHintItem {
1975 kind: InlayHintKind;
1976 whitespaceBefore?: boolean;
1977 whitespaceAfter?: boolean;
1979 interface InlayHintsResponse extends Response {
1980 body?: InlayHintItem[];
1983 * Synchronous request for semantic diagnostics of one file.
1985 interface SemanticDiagnosticsSyncRequest extends FileRequest {
1986 command: CommandTypes.SemanticDiagnosticsSync;
1987 arguments: SemanticDiagnosticsSyncRequestArgs;
1989 interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs {
1990 includeLinePosition?: boolean;
1993 * Response object for synchronous sematic diagnostics request.
1995 interface SemanticDiagnosticsSyncResponse extends Response {
1996 body?: Diagnostic[] | DiagnosticWithLinePosition[];
1998 interface SuggestionDiagnosticsSyncRequest extends FileRequest {
1999 command: CommandTypes.SuggestionDiagnosticsSync;
2000 arguments: SuggestionDiagnosticsSyncRequestArgs;
2002 type SuggestionDiagnosticsSyncRequestArgs = SemanticDiagnosticsSyncRequestArgs;
2003 type SuggestionDiagnosticsSyncResponse = SemanticDiagnosticsSyncResponse;
2005 * Synchronous request for syntactic diagnostics of one file.
2007 interface SyntacticDiagnosticsSyncRequest extends FileRequest {
2008 command: CommandTypes.SyntacticDiagnosticsSync;
2009 arguments: SyntacticDiagnosticsSyncRequestArgs;
2011 interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs {
2012 includeLinePosition?: boolean;
2015 * Response object for synchronous syntactic diagnostics request.
2017 interface SyntacticDiagnosticsSyncResponse extends Response {
2018 body?: Diagnostic[] | DiagnosticWithLinePosition[];
2021 * Arguments for GeterrForProject request.
2023 interface GeterrForProjectRequestArgs {
2025 * the file requesting project error list
2029 * Delay in milliseconds to wait before starting to compute
2030 * errors for the files in the file list
2035 * GeterrForProjectRequest request; value of command field is
2036 * "geterrForProject". It works similarly with 'Geterr', only
2037 * it request for every file in this project.
2039 interface GeterrForProjectRequest extends Request {
2040 command: CommandTypes.GeterrForProject;
2041 arguments: GeterrForProjectRequestArgs;
2044 * Arguments for geterr messages.
2046 interface GeterrRequestArgs {
2048 * List of file names for which to compute compiler errors.
2049 * The files will be checked in list order.
2053 * Delay in milliseconds to wait before starting to compute
2054 * errors for the files in the file list
2059 * Geterr request; value of command field is "geterr". Wait for
2060 * delay milliseconds and then, if during the wait no change or
2061 * reload messages have arrived for the first file in the files
2062 * list, get the syntactic errors for the file, field requests,
2063 * and then get the semantic errors for the file. Repeat with a
2064 * smaller delay for each subsequent file on the files list. Best
2065 * practice for an editor is to send a file list containing each
2066 * file that is currently visible, in most-recently-used order.
2068 interface GeterrRequest extends Request {
2069 command: CommandTypes.Geterr;
2070 arguments: GeterrRequestArgs;
2072 type RequestCompletedEventName = "requestCompleted";
2074 * Event that is sent when server have finished processing request with specified id.
2076 interface RequestCompletedEvent extends Event {
2077 event: RequestCompletedEventName;
2078 body: RequestCompletedEventBody;
2080 interface RequestCompletedEventBody {
2081 request_seq: number;
2084 * Item of diagnostic information found in a DiagnosticEvent message.
2086 interface Diagnostic {
2088 * Starting file location at which text applies.
2092 * The last file location at which the text applies.
2096 * Text of diagnostic message.
2100 * The category of the diagnostic message, e.g. "error", "warning", or "suggestion".
2103 reportsUnnecessary?: {};
2104 reportsDeprecated?: {};
2106 * Any related spans the diagnostic may have, such as other locations relevant to an error, such as declarartion sites
2108 relatedInformation?: DiagnosticRelatedInformation[];
2110 * The error code of the diagnostic message.
2114 * The name of the plugin reporting the message.
2118 interface DiagnosticWithFileName extends Diagnostic {
2120 * Name of the file the diagnostic is in
2125 * Represents additional spans returned with a diagnostic which are relevant to it
2127 interface DiagnosticRelatedInformation {
2129 * The category of the related information message, e.g. "error", "warning", or "suggestion".
2133 * The code used ot identify the related information
2137 * Text of related or additional information.
2141 * Associated location
2145 interface DiagnosticEventBody {
2147 * The file for which diagnostic information is reported.
2151 * An array of diagnostic information items.
2153 diagnostics: Diagnostic[];
2155 type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag";
2157 * Event message for DiagnosticEventKind event types.
2158 * These events provide syntactic and semantic errors for a file.
2160 interface DiagnosticEvent extends Event {
2161 body?: DiagnosticEventBody;
2162 event: DiagnosticEventKind;
2164 interface ConfigFileDiagnosticEventBody {
2166 * The file which trigged the searching and error-checking of the config file
2168 triggerFile: string;
2170 * The name of the found config file.
2174 * An arry of diagnostic information items for the found config file.
2176 diagnostics: DiagnosticWithFileName[];
2179 * Event message for "configFileDiag" event type.
2180 * This event provides errors for a found config file.
2182 interface ConfigFileDiagnosticEvent extends Event {
2183 body?: ConfigFileDiagnosticEventBody;
2184 event: "configFileDiag";
2186 type ProjectLanguageServiceStateEventName = "projectLanguageServiceState";
2187 interface ProjectLanguageServiceStateEvent extends Event {
2188 event: ProjectLanguageServiceStateEventName;
2189 body?: ProjectLanguageServiceStateEventBody;
2191 interface ProjectLanguageServiceStateEventBody {
2193 * Project name that has changes in the state of language service.
2194 * For configured projects this will be the config file path.
2195 * For external projects this will be the name of the projects specified when project was open.
2196 * For inferred projects this event is not raised.
2198 projectName: string;
2200 * True if language service state switched from disabled to enabled
2201 * and false otherwise.
2203 languageServiceEnabled: boolean;
2205 type ProjectsUpdatedInBackgroundEventName = "projectsUpdatedInBackground";
2206 interface ProjectsUpdatedInBackgroundEvent extends Event {
2207 event: ProjectsUpdatedInBackgroundEventName;
2208 body: ProjectsUpdatedInBackgroundEventBody;
2210 interface ProjectsUpdatedInBackgroundEventBody {
2212 * Current set of open files
2214 openFiles: string[];
2216 type ProjectLoadingStartEventName = "projectLoadingStart";
2217 interface ProjectLoadingStartEvent extends Event {
2218 event: ProjectLoadingStartEventName;
2219 body: ProjectLoadingStartEventBody;
2221 interface ProjectLoadingStartEventBody {
2222 /** name of the project */
2223 projectName: string;
2224 /** reason for loading */
2227 type ProjectLoadingFinishEventName = "projectLoadingFinish";
2228 interface ProjectLoadingFinishEvent extends Event {
2229 event: ProjectLoadingFinishEventName;
2230 body: ProjectLoadingFinishEventBody;
2232 interface ProjectLoadingFinishEventBody {
2233 /** name of the project */
2234 projectName: string;
2236 type SurveyReadyEventName = "surveyReady";
2237 interface SurveyReadyEvent extends Event {
2238 event: SurveyReadyEventName;
2239 body: SurveyReadyEventBody;
2241 interface SurveyReadyEventBody {
2242 /** Name of the survey. This is an internal machine- and programmer-friendly name */
2245 type LargeFileReferencedEventName = "largeFileReferenced";
2246 interface LargeFileReferencedEvent extends Event {
2247 event: LargeFileReferencedEventName;
2248 body: LargeFileReferencedEventBody;
2250 interface LargeFileReferencedEventBody {
2252 * name of the large file being loaded
2260 * max file size allowed on the server
2262 maxFileSize: number;
2265 * Arguments for reload request.
2267 interface ReloadRequestArgs extends FileRequestArgs {
2269 * Name of temporary file from which to reload file
2270 * contents. May be same as file.
2275 * Reload request message; value of command field is "reload".
2276 * Reload contents of file with name given by the 'file' argument
2277 * from temporary file with name given by the 'tmpfile' argument.
2278 * The two names can be identical.
2280 interface ReloadRequest extends FileRequest {
2281 command: CommandTypes.Reload;
2282 arguments: ReloadRequestArgs;
2285 * Response to "reload" request. This is just an acknowledgement, so
2286 * no body field is required.
2288 interface ReloadResponse extends Response {
2291 * Arguments for saveto request.
2293 interface SavetoRequestArgs extends FileRequestArgs {
2295 * Name of temporary file into which to save server's view of
2301 * Saveto request message; value of command field is "saveto".
2302 * For debugging purposes, save to a temporaryfile (named by
2303 * argument 'tmpfile') the contents of file named by argument
2304 * 'file'. The server does not currently send a response to a
2307 interface SavetoRequest extends FileRequest {
2308 command: CommandTypes.Saveto;
2309 arguments: SavetoRequestArgs;
2312 * Arguments for navto request message.
2314 interface NavtoRequestArgs {
2316 * Search term to navigate to from current location; term can
2317 * be '.*' or an identifier prefix.
2319 searchValue: string;
2321 * Optional limit on the number of items to return.
2323 maxResultCount?: number;
2325 * The file for the request (absolute pathname required).
2329 * Optional flag to indicate we want results for just the current file
2330 * or the entire project.
2332 currentFileOnly?: boolean;
2333 projectFileName?: string;
2336 * Navto request message; value of command field is "navto".
2337 * Return list of objects giving file locations and symbols that
2338 * match the search term given in argument 'searchTerm'. The
2339 * context for the search is given by the named file.
2341 interface NavtoRequest extends Request {
2342 command: CommandTypes.Navto;
2343 arguments: NavtoRequestArgs;
2346 * An item found in a navto response.
2348 interface NavtoItem extends FileSpan {
2350 * The symbol's name.
2354 * The symbol's kind (such as 'className' or 'parameterName').
2356 kind: ScriptElementKind;
2358 * exact, substring, or prefix.
2362 * If this was a case sensitive or insensitive match.
2364 isCaseSensitive: boolean;
2366 * Optional modifiers for the kind (such as 'public').
2368 kindModifiers?: string;
2370 * Name of symbol's container symbol (if any); for example,
2371 * the class name if symbol is a class member.
2373 containerName?: string;
2375 * Kind of symbol's container symbol (if any).
2377 containerKind?: ScriptElementKind;
2380 * Navto response message. Body is an array of navto items. Each
2381 * item gives a symbol that matched the search term.
2383 interface NavtoResponse extends Response {
2387 * Arguments for change request message.
2389 interface ChangeRequestArgs extends FormatRequestArgs {
2391 * Optional string to insert at location (file, line, offset).
2393 insertString?: string;
2396 * Change request message; value of command field is "change".
2397 * Update the server's view of the file named by argument 'file'.
2398 * Server does not currently send a response to a change request.
2400 interface ChangeRequest extends FileLocationRequest {
2401 command: CommandTypes.Change;
2402 arguments: ChangeRequestArgs;
2405 * Response to "brace" request.
2407 interface BraceResponse extends Response {
2411 * Brace matching request; value of command field is "brace".
2412 * Return response giving the file locations of matching braces
2413 * found in file at location line, offset.
2415 interface BraceRequest extends FileLocationRequest {
2416 command: CommandTypes.Brace;
2419 * NavBar items request; value of command field is "navbar".
2420 * Return response giving the list of navigation bar entries
2421 * extracted from the requested file.
2423 interface NavBarRequest extends FileRequest {
2424 command: CommandTypes.NavBar;
2427 * NavTree request; value of command field is "navtree".
2428 * Return response giving the navigation tree of the requested file.
2430 interface NavTreeRequest extends FileRequest {
2431 command: CommandTypes.NavTree;
2433 interface NavigationBarItem {
2435 * The item's display text.
2439 * The symbol's kind (such as 'className' or 'parameterName').
2441 kind: ScriptElementKind;
2443 * Optional modifiers for the kind (such as 'public').
2445 kindModifiers?: string;
2447 * The definition locations of the item.
2451 * Optional children.
2453 childItems?: NavigationBarItem[];
2455 * Number of levels deep this item should appear.
2459 /** protocol.NavigationTree is identical to ts.NavigationTree, except using protocol.TextSpan instead of ts.TextSpan */
2460 interface NavigationTree {
2462 kind: ScriptElementKind;
2463 kindModifiers: string;
2465 nameSpan: TextSpan | undefined;
2466 childItems?: NavigationTree[];
2468 type TelemetryEventName = "telemetry";
2469 interface TelemetryEvent extends Event {
2470 event: TelemetryEventName;
2471 body: TelemetryEventBody;
2473 interface TelemetryEventBody {
2474 telemetryEventName: string;
2477 type TypesInstallerInitializationFailedEventName = "typesInstallerInitializationFailed";
2478 interface TypesInstallerInitializationFailedEvent extends Event {
2479 event: TypesInstallerInitializationFailedEventName;
2480 body: TypesInstallerInitializationFailedEventBody;
2482 interface TypesInstallerInitializationFailedEventBody {
2485 type TypingsInstalledTelemetryEventName = "typingsInstalled";
2486 interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody {
2487 telemetryEventName: TypingsInstalledTelemetryEventName;
2488 payload: TypingsInstalledTelemetryEventPayload;
2490 interface TypingsInstalledTelemetryEventPayload {
2492 * Comma separated list of installed typing packages
2494 installedPackages: string;
2496 * true if install request succeeded, otherwise - false
2498 installSuccess: boolean;
2500 * version of typings installer
2502 typingsInstallerVersion: string;
2504 type BeginInstallTypesEventName = "beginInstallTypes";
2505 type EndInstallTypesEventName = "endInstallTypes";
2506 interface BeginInstallTypesEvent extends Event {
2507 event: BeginInstallTypesEventName;
2508 body: BeginInstallTypesEventBody;
2510 interface EndInstallTypesEvent extends Event {
2511 event: EndInstallTypesEventName;
2512 body: EndInstallTypesEventBody;
2514 interface InstallTypesEventBody {
2516 * correlation id to match begin and end events
2520 * list of packages to install
2522 packages: readonly string[];
2524 interface BeginInstallTypesEventBody extends InstallTypesEventBody {
2526 interface EndInstallTypesEventBody extends InstallTypesEventBody {
2528 * true if installation succeeded, otherwise false
2532 interface NavBarResponse extends Response {
2533 body?: NavigationBarItem[];
2535 interface NavTreeResponse extends Response {
2536 body?: NavigationTree;
2538 interface CallHierarchyItem {
2540 kind: ScriptElementKind;
2541 kindModifiers?: string;
2544 selectionSpan: TextSpan;
2545 containerName?: string;
2547 interface CallHierarchyIncomingCall {
2548 from: CallHierarchyItem;
2549 fromSpans: TextSpan[];
2551 interface CallHierarchyOutgoingCall {
2552 to: CallHierarchyItem;
2553 fromSpans: TextSpan[];
2555 interface PrepareCallHierarchyRequest extends FileLocationRequest {
2556 command: CommandTypes.PrepareCallHierarchy;
2558 interface PrepareCallHierarchyResponse extends Response {
2559 readonly body: CallHierarchyItem | CallHierarchyItem[];
2561 interface ProvideCallHierarchyIncomingCallsRequest extends FileLocationRequest {
2562 command: CommandTypes.ProvideCallHierarchyIncomingCalls;
2564 interface ProvideCallHierarchyIncomingCallsResponse extends Response {
2565 readonly body: CallHierarchyIncomingCall[];
2567 interface ProvideCallHierarchyOutgoingCallsRequest extends FileLocationRequest {
2568 command: CommandTypes.ProvideCallHierarchyOutgoingCalls;
2570 interface ProvideCallHierarchyOutgoingCallsResponse extends Response {
2571 readonly body: CallHierarchyOutgoingCall[];
2573 const enum IndentStyle {
2578 enum SemicolonPreference {
2583 interface EditorSettings {
2584 baseIndentSize?: number;
2585 indentSize?: number;
2587 newLineCharacter?: string;
2588 convertTabsToSpaces?: boolean;
2589 indentStyle?: IndentStyle | ts.IndentStyle;
2590 trimTrailingWhitespace?: boolean;
2592 interface FormatCodeSettings extends EditorSettings {
2593 insertSpaceAfterCommaDelimiter?: boolean;
2594 insertSpaceAfterSemicolonInForStatements?: boolean;
2595 insertSpaceBeforeAndAfterBinaryOperators?: boolean;
2596 insertSpaceAfterConstructor?: boolean;
2597 insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
2598 insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
2599 insertSpaceAfterOpeningAndBeforeClosingEmptyBraces?: boolean;
2600 insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
2601 insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
2602 insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
2603 insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
2604 insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
2605 insertSpaceAfterTypeAssertion?: boolean;
2606 insertSpaceBeforeFunctionParenthesis?: boolean;
2607 placeOpenBraceOnNewLineForFunctions?: boolean;
2608 placeOpenBraceOnNewLineForControlBlocks?: boolean;
2609 insertSpaceBeforeTypeAnnotation?: boolean;
2610 semicolons?: SemicolonPreference;
2612 interface UserPreferences {
2613 readonly disableSuggestions?: boolean;
2614 readonly quotePreference?: "auto" | "double" | "single";
2616 * If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
2617 * This affects lone identifier completions but not completions on the right hand side of `obj.`.
2619 readonly includeCompletionsForModuleExports?: boolean;
2621 * Enables auto-import-style completions on partially-typed import statements. E.g., allows
2622 * `import write|` to be completed to `import { writeFile } from "fs"`.
2624 readonly includeCompletionsForImportStatements?: boolean;
2626 * Allows completions to be formatted with snippet text, indicated by `CompletionItem["isSnippet"]`.
2628 readonly includeCompletionsWithSnippetText?: boolean;
2630 * If enabled, the completion list will include completions with invalid identifier names.
2631 * For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`.
2633 readonly includeCompletionsWithInsertText?: boolean;
2635 * Unless this option is `false`, or `includeCompletionsWithInsertText` is not enabled,
2636 * member completion lists triggered with `.` will include entries on potentially-null and potentially-undefined
2637 * values, with insertion text to replace preceding `.` tokens with `?.`.
2639 readonly includeAutomaticOptionalChainCompletions?: boolean;
2641 * If enabled, completions for class members (e.g. methods and properties) will include
2642 * a whole declaration for the member.
2643 * E.g., `class A { f| }` could be completed to `class A { foo(): number {} }`, instead of
2644 * `class A { foo }`.
2646 readonly includeCompletionsWithClassMemberSnippets?: boolean;
2647 readonly allowIncompleteCompletions?: boolean;
2648 readonly importModuleSpecifierPreference?: "shortest" | "project-relative" | "relative" | "non-relative";
2649 /** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
2650 readonly importModuleSpecifierEnding?: "auto" | "minimal" | "index" | "js";
2651 readonly allowTextChangesInNewFiles?: boolean;
2652 readonly lazyConfiguredProjectsFromExternalProject?: boolean;
2653 readonly providePrefixAndSuffixTextForRename?: boolean;
2654 readonly provideRefactorNotApplicableReason?: boolean;
2655 readonly allowRenameOfImportPath?: boolean;
2656 readonly includePackageJsonAutoImports?: "auto" | "on" | "off";
2657 readonly jsxAttributeCompletionStyle?: "auto" | "braces" | "none";
2658 readonly displayPartsForJSDoc?: boolean;
2659 readonly generateReturnInDocTemplate?: boolean;
2661 interface CompilerOptions {
2663 allowSyntheticDefaultImports?: boolean;
2664 allowUnreachableCode?: boolean;
2665 allowUnusedLabels?: boolean;
2666 alwaysStrict?: boolean;
2670 declaration?: boolean;
2671 declarationDir?: string;
2672 disableSizeLimit?: boolean;
2673 downlevelIteration?: boolean;
2675 emitDecoratorMetadata?: boolean;
2676 experimentalDecorators?: boolean;
2677 forceConsistentCasingInFileNames?: boolean;
2678 importHelpers?: boolean;
2679 inlineSourceMap?: boolean;
2680 inlineSources?: boolean;
2681 isolatedModules?: boolean;
2682 jsx?: JsxEmit | ts.JsxEmit;
2686 maxNodeModuleJsDepth?: number;
2687 module?: ModuleKind | ts.ModuleKind;
2688 moduleResolution?: ModuleResolutionKind | ts.ModuleResolutionKind;
2689 newLine?: NewLineKind | ts.NewLineKind;
2691 noEmitHelpers?: boolean;
2692 noEmitOnError?: boolean;
2693 noErrorTruncation?: boolean;
2694 noFallthroughCasesInSwitch?: boolean;
2695 noImplicitAny?: boolean;
2696 noImplicitReturns?: boolean;
2697 noImplicitThis?: boolean;
2698 noUnusedLocals?: boolean;
2699 noUnusedParameters?: boolean;
2700 noImplicitUseStrict?: boolean;
2702 noResolve?: boolean;
2706 paths?: MapLike<string[]>;
2707 plugins?: PluginImport[];
2708 preserveConstEnums?: boolean;
2709 preserveSymlinks?: boolean;
2711 reactNamespace?: string;
2712 removeComments?: boolean;
2713 references?: ProjectReference[];
2715 rootDirs?: string[];
2716 skipLibCheck?: boolean;
2717 skipDefaultLibCheck?: boolean;
2718 sourceMap?: boolean;
2719 sourceRoot?: string;
2721 strictNullChecks?: boolean;
2722 suppressExcessPropertyErrors?: boolean;
2723 suppressImplicitAnyIndexErrors?: boolean;
2724 useDefineForClassFields?: boolean;
2725 target?: ScriptTarget | ts.ScriptTarget;
2726 traceResolution?: boolean;
2727 resolveJsonModule?: boolean;
2729 /** Paths used to used to compute primary types search locations */
2730 typeRoots?: string[];
2731 [option: string]: CompilerOptionsValue | undefined;
2733 const enum JsxEmit {
2735 Preserve = "Preserve",
2736 ReactNative = "ReactNative",
2739 const enum ModuleKind {
2741 CommonJS = "CommonJS",
2749 const enum ModuleResolutionKind {
2750 Classic = "Classic",
2753 const enum NewLineKind {
2757 const enum ScriptTarget {
2770 const enum ClassificationType {
2777 regularExpressionLiteral = 7,
2785 typeParameterName = 15,
2788 docCommentTagName = 18,
2789 jsxOpenTagName = 19,
2790 jsxCloseTagName = 20,
2791 jsxSelfClosingTagName = 21,
2794 jsxAttributeStringLiteralValue = 24,
2798 declare namespace ts.server.protocol {
2800 interface TextInsertion {
2802 /** The position in newText the caret should point to after the insertion. */
2803 caretOffset: number;
2806 interface TodoCommentDescriptor {
2811 interface TodoComment {
2812 descriptor: TodoCommentDescriptor;
2817 enum OutliningSpanKind {
2818 /** Single or multi-line comments */
2819 Comment = "comment",
2820 /** Sections marked by '// #region' and '// #endregion' comments */
2822 /** Declarations and expressions */
2824 /** Contiguous blocks of import declarations */
2828 enum HighlightSpanKind {
2830 definition = "definition",
2831 reference = "reference",
2832 writtenReference = "writtenReference"
2835 enum ScriptElementKind {
2837 warning = "warning",
2838 /** predefined type (void) or keyword (class) */
2839 keyword = "keyword",
2840 /** top level script node */
2841 scriptElement = "script",
2842 /** module foo {} */
2843 moduleElement = "module",
2845 classElement = "class",
2846 /** var x = class X {} */
2847 localClassElement = "local class",
2848 /** interface Y {} */
2849 interfaceElement = "interface",
2851 typeElement = "type",
2853 enumElement = "enum",
2854 enumMemberElement = "enum member",
2856 * Inside module and script only
2859 variableElement = "var",
2860 /** Inside function */
2861 localVariableElement = "local var",
2863 * Inside module and script only
2866 functionElement = "function",
2867 /** Inside function */
2868 localFunctionElement = "local function",
2869 /** class X { [public|private]* foo() {} } */
2870 memberFunctionElement = "method",
2871 /** class X { [public|private]* [get|set] foo:number; } */
2872 memberGetAccessorElement = "getter",
2873 memberSetAccessorElement = "setter",
2875 * class X { [public|private]* foo:number; }
2876 * interface Y { foo:number; }
2878 memberVariableElement = "property",
2880 * class X { constructor() { } }
2881 * class X { static { } }
2883 constructorImplementationElement = "constructor",
2884 /** interface Y { ():number; } */
2885 callSignatureElement = "call",
2886 /** interface Y { []:number; } */
2887 indexSignatureElement = "index",
2888 /** interface Y { new():Y; } */
2889 constructSignatureElement = "construct",
2890 /** function foo(*Y*: string) */
2891 parameterElement = "parameter",
2892 typeParameterElement = "type parameter",
2893 primitiveType = "primitive type",
2896 constElement = "const",
2898 directory = "directory",
2899 externalModuleName = "external module name",
2901 * <JsxTagName attribute1 attribute2={0} />
2903 jsxAttribute = "JSX attribute",
2904 /** String literal */
2906 /** Jsdoc @link: in `{@link C link text}`, the before and after text "{@link " and "}" */
2908 /** Jsdoc @link: in `{@link C link text}`, the entity name "C" */
2909 linkName = "link name",
2910 /** Jsdoc @link: in `{@link C link text}`, the link text "link text" */
2911 linkText = "link text"
2914 export interface TypeAcquisition {
2916 * @deprecated typingOptions.enableAutoDiscovery
2917 * Use typeAcquisition.enable instead.
2919 enableAutoDiscovery?: boolean;
2923 disableFilenameBasedTypeAcquisition?: boolean;
2924 [option: string]: CompilerOptionsValue | undefined;
2927 export type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]> | PluginImport[] | ProjectReference[] | null | undefined;
2929 export interface FileExtensionInfo {
2931 isMixedContent: boolean;
2932 scriptKind?: ScriptKind;
2936 * Type of objects whose values are all of the same type.
2937 * The `in` and `for-in` operators can *not* be safely used,
2938 * since `Object.prototype` may be modified by outside code.
2940 interface MapLike<T> {
2944 export interface PluginImport {
2948 export interface ProjectReference {
2949 /** A normalized path on disk */
2951 /** The path as the user originally wrote it */
2952 originalPath?: string;
2953 /** True if the output of this reference should be prepended to the output of this project. Only valid for --outFile compilations */
2955 /** True if it is intended that this reference form a circularity */
2959 declare namespace ts {
2960 // these types are empty stubs for types from services and should not be used directly
2961 export type EndOfLineState = never;
2962 export type ScriptKind = never;
2963 export type WatchFileKind = never;
2964 export type WatchDirectoryKind = never;
2965 export type PollingWatchKind = never;
2966 export type IndentStyle = never;
2967 export type JsxEmit = never;
2968 export type ModuleKind = never;
2969 export type ModuleResolutionKind = never;
2970 export type NewLineKind = never;
2971 export type ScriptTarget = never;
2973 import protocol = ts.server.protocol;
2975 export as namespace protocol;