UNPKG

94.5 kBTypeScriptView Raw
1/**
2 * Declaration module describing the TypeScript Server protocol
3 */
4declare namespace ts.server.protocol {
5 const enum CommandTypes {
6 JsxClosingTag = "jsxClosingTag",
7 Brace = "brace",
8 BraceCompletion = "braceCompletion",
9 GetSpanOfEnclosingComment = "getSpanOfEnclosingComment",
10 Change = "change",
11 Close = "close",
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",
22 Exit = "exit",
23 Format = "format",
24 Formatonkey = "formatonkey",
25 Geterr = "geterr",
26 GeterrForProject = "geterrForProject",
27 SemanticDiagnosticsSync = "semanticDiagnosticsSync",
28 SyntacticDiagnosticsSync = "syntacticDiagnosticsSync",
29 SuggestionDiagnosticsSync = "suggestionDiagnosticsSync",
30 NavBar = "navbar",
31 Navto = "navto",
32 NavTree = "navtree",
33 NavTreeFull = "navtree-full",
34 /** @deprecated */
35 Occurrences = "occurrences",
36 DocumentHighlights = "documentHighlights",
37 Open = "open",
38 Quickinfo = "quickinfo",
39 References = "references",
40 Reload = "reload",
41 Rename = "rename",
42 Saveto = "saveto",
43 SignatureHelp = "signatureHelp",
44 Status = "status",
45 TypeDefinition = "typeDefinition",
46 ProjectInfo = "projectInfo",
47 ReloadProjects = "reloadProjects",
48 Unknown = "unknown",
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"
75 }
76 /**
77 * A TypeScript Server message
78 */
79 interface Message {
80 /**
81 * Sequence number of the message
82 */
83 seq: number;
84 /**
85 * One of "request", "response", or "event"
86 */
87 type: "request" | "response" | "event";
88 }
89 /**
90 * Client-initiated request message
91 */
92 interface Request extends Message {
93 type: "request";
94 /**
95 * The command to execute
96 */
97 command: string;
98 /**
99 * Object containing arguments for the command
100 */
101 arguments?: any;
102 }
103 /**
104 * Request to reload the project structure for all the opened files
105 */
106 interface ReloadProjectsRequest extends Message {
107 command: CommandTypes.ReloadProjects;
108 }
109 /**
110 * Server-initiated event message
111 */
112 interface Event extends Message {
113 type: "event";
114 /**
115 * Name of event
116 */
117 event: string;
118 /**
119 * Event-specific information
120 */
121 body?: any;
122 }
123 /**
124 * Response by server to client request message.
125 */
126 interface Response extends Message {
127 type: "response";
128 /**
129 * Sequence number of the request message.
130 */
131 request_seq: number;
132 /**
133 * Outcome of the request.
134 */
135 success: boolean;
136 /**
137 * The command requested.
138 */
139 command: string;
140 /**
141 * If success === false, this should always be provided.
142 * Otherwise, may (or may not) contain a success message.
143 */
144 message?: string;
145 /**
146 * Contains message body if success === true.
147 */
148 body?: any;
149 /**
150 * Contains extra information that plugin can include to be passed on
151 */
152 metadata?: unknown;
153 /**
154 * Exposes information about the performance of this request-response pair.
155 */
156 performanceData?: PerformanceData;
157 }
158 interface PerformanceData {
159 /**
160 * Time spent updating the program graph, in milliseconds.
161 */
162 updateGraphDurationMs?: number;
163 /**
164 * The time spent creating or updating the auto-import program, in milliseconds.
165 */
166 createAutoImportProviderProgramDurationMs?: number;
167 }
168 /**
169 * Arguments for FileRequest messages.
170 */
171 interface FileRequestArgs {
172 /**
173 * The file for the request (absolute pathname required).
174 */
175 file: string;
176 projectFileName?: string;
177 }
178 interface StatusRequest extends Request {
179 command: CommandTypes.Status;
180 }
181 interface StatusResponseBody {
182 /**
183 * The TypeScript version (`ts.version`).
184 */
185 version: string;
186 }
187 /**
188 * Response to StatusRequest
189 */
190 interface StatusResponse extends Response {
191 body: StatusResponseBody;
192 }
193 /**
194 * Requests a JS Doc comment template for a given position
195 */
196 interface DocCommentTemplateRequest extends FileLocationRequest {
197 command: CommandTypes.DocCommentTemplate;
198 }
199 /**
200 * Response to DocCommentTemplateRequest
201 */
202 interface DocCommandTemplateResponse extends Response {
203 body?: TextInsertion;
204 }
205 /**
206 * A request to get TODO comments from the file
207 */
208 interface TodoCommentRequest extends FileRequest {
209 command: CommandTypes.TodoComments;
210 arguments: TodoCommentRequestArgs;
211 }
212 /**
213 * Arguments for TodoCommentRequest request.
214 */
215 interface TodoCommentRequestArgs extends FileRequestArgs {
216 /**
217 * Array of target TodoCommentDescriptors that describes TODO comments to be found
218 */
219 descriptors: TodoCommentDescriptor[];
220 }
221 /**
222 * Response for TodoCommentRequest request.
223 */
224 interface TodoCommentsResponse extends Response {
225 body?: TodoComment[];
226 }
227 /**
228 * A request to determine if the caret is inside a comment.
229 */
230 interface SpanOfEnclosingCommentRequest extends FileLocationRequest {
231 command: CommandTypes.GetSpanOfEnclosingComment;
232 arguments: SpanOfEnclosingCommentRequestArgs;
233 }
234 interface SpanOfEnclosingCommentRequestArgs extends FileLocationRequestArgs {
235 /**
236 * Requires that the enclosing span be a multi-line comment, or else the request returns undefined.
237 */
238 onlyMultiLine: boolean;
239 }
240 /**
241 * Request to obtain outlining spans in file.
242 */
243 interface OutliningSpansRequest extends FileRequest {
244 command: CommandTypes.GetOutliningSpans;
245 }
246 interface OutliningSpan {
247 /** The span of the document to actually collapse. */
248 textSpan: TextSpan;
249 /** The span of the document to display when the user hovers over the collapsed span. */
250 hintSpan: TextSpan;
251 /** The text to display in the editor for the collapsed region. */
252 bannerText: string;
253 /**
254 * Whether or not this region should be automatically collapsed when
255 * the 'Collapse to Definitions' command is invoked.
256 */
257 autoCollapse: boolean;
258 /**
259 * Classification of the contents of the span
260 */
261 kind: OutliningSpanKind;
262 }
263 /**
264 * Response to OutliningSpansRequest request.
265 */
266 interface OutliningSpansResponse extends Response {
267 body?: OutliningSpan[];
268 }
269 /**
270 * A request to get indentation for a location in file
271 */
272 interface IndentationRequest extends FileLocationRequest {
273 command: CommandTypes.Indentation;
274 arguments: IndentationRequestArgs;
275 }
276 /**
277 * Response for IndentationRequest request.
278 */
279 interface IndentationResponse extends Response {
280 body?: IndentationResult;
281 }
282 /**
283 * Indentation result representing where indentation should be placed
284 */
285 interface IndentationResult {
286 /**
287 * The base position in the document that the indent should be relative to
288 */
289 position: number;
290 /**
291 * The number of columns the indent should be at relative to the position's column.
292 */
293 indentation: number;
294 }
295 /**
296 * Arguments for IndentationRequest request.
297 */
298 interface IndentationRequestArgs extends FileLocationRequestArgs {
299 /**
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.
302 */
303 options?: EditorSettings;
304 }
305 /**
306 * Arguments for ProjectInfoRequest request.
307 */
308 interface ProjectInfoRequestArgs extends FileRequestArgs {
309 /**
310 * Indicate if the file name list of the project is needed
311 */
312 needFileNameList: boolean;
313 }
314 /**
315 * A request to get the project information of the current file.
316 */
317 interface ProjectInfoRequest extends Request {
318 command: CommandTypes.ProjectInfo;
319 arguments: ProjectInfoRequestArgs;
320 }
321 /**
322 * A request to retrieve compiler options diagnostics for a project
323 */
324 interface CompilerOptionsDiagnosticsRequest extends Request {
325 arguments: CompilerOptionsDiagnosticsRequestArgs;
326 }
327 /**
328 * Arguments for CompilerOptionsDiagnosticsRequest request.
329 */
330 interface CompilerOptionsDiagnosticsRequestArgs {
331 /**
332 * Name of the project to retrieve compiler options diagnostics.
333 */
334 projectFileName: string;
335 }
336 /**
337 * Response message body for "projectInfo" request
338 */
339 interface ProjectInfo {
340 /**
341 * For configured project, this is the normalized path of the 'tsconfig.json' file
342 * For inferred project, this is undefined
343 */
344 configFileName: string;
345 /**
346 * The list of normalized file name in the project, including 'lib.d.ts'
347 */
348 fileNames?: string[];
349 /**
350 * Indicates if the project has a active language service instance
351 */
352 languageServiceDisabled?: boolean;
353 }
354 /**
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.
358 */
359 interface DiagnosticWithLinePosition {
360 message: string;
361 start: number;
362 length: number;
363 startLocation: Location;
364 endLocation: Location;
365 category: string;
366 code: number;
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[];
371 }
372 /**
373 * Response message for "projectInfo" request
374 */
375 interface ProjectInfoResponse extends Response {
376 body?: ProjectInfo;
377 }
378 /**
379 * Request whose sole parameter is a file name.
380 */
381 interface FileRequest extends Request {
382 arguments: FileRequestArgs;
383 }
384 /**
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.
387 */
388 interface FileLocationRequestArgs extends FileRequestArgs {
389 /**
390 * The line number for the request (1-based).
391 */
392 line: number;
393 /**
394 * The character offset (on the line) for the request (1-based).
395 */
396 offset: number;
397 }
398 type FileLocationOrRangeRequestArgs = FileLocationRequestArgs | FileRangeRequestArgs;
399 /**
400 * Request refactorings at a given position or selection area.
401 */
402 interface GetApplicableRefactorsRequest extends Request {
403 command: CommandTypes.GetApplicableRefactors;
404 arguments: GetApplicableRefactorsRequestArgs;
405 }
406 type GetApplicableRefactorsRequestArgs = FileLocationOrRangeRequestArgs & {
407 triggerReason?: RefactorTriggerReason;
408 };
409 type RefactorTriggerReason = "implicit" | "invoked";
410 /**
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
413 */
414 interface GetApplicableRefactorsResponse extends Response {
415 body?: ApplicableRefactorInfo[];
416 }
417 /**
418 * A set of one or more available refactoring actions, grouped under a parent refactoring.
419 */
420 interface ApplicableRefactorInfo {
421 /**
422 * The programmatic name of the refactoring
423 */
424 name: string;
425 /**
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.
428 */
429 description: string;
430 /**
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.
434 *
435 * If not specified, this value is assumed to be 'true'
436 */
437 inlineable?: boolean;
438 actions: RefactorActionInfo[];
439 }
440 /**
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.
443 */
444 interface RefactorActionInfo {
445 /**
446 * The programmatic name of the refactoring action
447 */
448 name: string;
449 /**
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
453 */
454 description: string;
455 }
456 interface GetEditsForRefactorRequest extends Request {
457 command: CommandTypes.GetEditsForRefactor;
458 arguments: GetEditsForRefactorRequestArgs;
459 }
460 /**
461 * Request the edits that a particular refactoring action produces.
462 * Callers must specify the name of the refactor and the name of the action.
463 */
464 type GetEditsForRefactorRequestArgs = FileLocationOrRangeRequestArgs & {
465 refactor: string;
466 action: string;
467 };
468 interface GetEditsForRefactorResponse extends Response {
469 body?: RefactorEditInfo;
470 }
471 interface RefactorEditInfo {
472 edits: FileCodeEdits[];
473 /**
474 * An optional location where the editor should start a rename operation once
475 * the refactoring edits have been applied
476 */
477 renameLocation?: Location;
478 renameFilename?: string;
479 }
480 /**
481 * Organize imports by:
482 * 1) Removing unused imports
483 * 2) Coalescing imports from the same module
484 * 3) Sorting imports
485 */
486 interface OrganizeImportsRequest extends Request {
487 command: CommandTypes.OrganizeImports;
488 arguments: OrganizeImportsRequestArgs;
489 }
490 type OrganizeImportsScope = GetCombinedCodeFixScope;
491 interface OrganizeImportsRequestArgs {
492 scope: OrganizeImportsScope;
493 }
494 interface OrganizeImportsResponse extends Response {
495 body: readonly FileCodeEdits[];
496 }
497 interface GetEditsForFileRenameRequest extends Request {
498 command: CommandTypes.GetEditsForFileRename;
499 arguments: GetEditsForFileRenameRequestArgs;
500 }
501 /** Note: Paths may also be directories. */
502 interface GetEditsForFileRenameRequestArgs {
503 readonly oldFilePath: string;
504 readonly newFilePath: string;
505 }
506 interface GetEditsForFileRenameResponse extends Response {
507 body: readonly FileCodeEdits[];
508 }
509 /**
510 * Request for the available codefixes at a specific position.
511 */
512 interface CodeFixRequest extends Request {
513 command: CommandTypes.GetCodeFixes;
514 arguments: CodeFixRequestArgs;
515 }
516 interface GetCombinedCodeFixRequest extends Request {
517 command: CommandTypes.GetCombinedCodeFix;
518 arguments: GetCombinedCodeFixRequestArgs;
519 }
520 interface GetCombinedCodeFixResponse extends Response {
521 body: CombinedCodeActions;
522 }
523 interface ApplyCodeActionCommandRequest extends Request {
524 command: CommandTypes.ApplyCodeActionCommand;
525 arguments: ApplyCodeActionCommandRequestArgs;
526 }
527 interface ApplyCodeActionCommandResponse extends Response {
528 }
529 interface FileRangeRequestArgs extends FileRequestArgs {
530 /**
531 * The line number for the request (1-based).
532 */
533 startLine: number;
534 /**
535 * The character offset (on the line) for the request (1-based).
536 */
537 startOffset: number;
538 /**
539 * The line number for the request (1-based).
540 */
541 endLine: number;
542 /**
543 * The character offset (on the line) for the request (1-based).
544 */
545 endOffset: number;
546 }
547 /**
548 * Instances of this interface specify errorcodes on a specific location in a sourcefile.
549 */
550 interface CodeFixRequestArgs extends FileRangeRequestArgs {
551 /**
552 * Errorcodes we want to get the fixes for.
553 */
554 errorCodes: readonly number[];
555 }
556 interface GetCombinedCodeFixRequestArgs {
557 scope: GetCombinedCodeFixScope;
558 fixId: {};
559 }
560 interface GetCombinedCodeFixScope {
561 type: "file";
562 args: FileRequestArgs;
563 }
564 interface ApplyCodeActionCommandRequestArgs {
565 /** May also be an array of commands. */
566 command: {};
567 }
568 /**
569 * Response for GetCodeFixes request.
570 */
571 interface GetCodeFixesResponse extends Response {
572 body?: CodeAction[];
573 }
574 /**
575 * A request whose arguments specify a file location (file, line, col).
576 */
577 interface FileLocationRequest extends FileRequest {
578 arguments: FileLocationRequestArgs;
579 }
580 /**
581 * A request to get codes of supported code fixes.
582 */
583 interface GetSupportedCodeFixesRequest extends Request {
584 command: CommandTypes.GetSupportedCodeFixes;
585 }
586 /**
587 * A response for GetSupportedCodeFixesRequest request.
588 */
589 interface GetSupportedCodeFixesResponse extends Response {
590 /**
591 * List of error codes supported by the server.
592 */
593 body?: string[];
594 }
595 /**
596 * Arguments in document highlight request; include: filesToSearch, file,
597 * line, offset.
598 */
599 interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs {
600 /**
601 * List of files to search for document highlights.
602 */
603 filesToSearch: string[];
604 }
605 /**
606 * Go to definition request; value of command field is
607 * "definition". Return response giving the file locations that
608 * define the symbol found in file at location line, col.
609 */
610 interface DefinitionRequest extends FileLocationRequest {
611 command: CommandTypes.Definition;
612 }
613 interface DefinitionAndBoundSpanRequest extends FileLocationRequest {
614 readonly command: CommandTypes.DefinitionAndBoundSpan;
615 }
616 interface DefinitionAndBoundSpanResponse extends Response {
617 readonly body: DefinitionInfoAndBoundSpan;
618 }
619 /**
620 * Go to type request; value of command field is
621 * "typeDefinition". Return response giving the file locations that
622 * define the type for the symbol found in file at location line, col.
623 */
624 interface TypeDefinitionRequest extends FileLocationRequest {
625 command: CommandTypes.TypeDefinition;
626 }
627 /**
628 * Go to implementation request; value of command field is
629 * "implementation". Return response giving the file locations that
630 * implement the symbol found in file at location line, col.
631 */
632 interface ImplementationRequest extends FileLocationRequest {
633 command: CommandTypes.Implementation;
634 }
635 /**
636 * Location in source code expressed as (one-based) line and (one-based) column offset.
637 */
638 interface Location {
639 line: number;
640 offset: number;
641 }
642 /**
643 * Object found in response messages defining a span of text in source code.
644 */
645 interface TextSpan {
646 /**
647 * First character of the definition.
648 */
649 start: Location;
650 /**
651 * One character past last character of the definition.
652 */
653 end: Location;
654 }
655 /**
656 * Object found in response messages defining a span of text in a specific source file.
657 */
658 interface FileSpan extends TextSpan {
659 /**
660 * File containing text span.
661 */
662 file: string;
663 }
664 interface TextSpanWithContext extends TextSpan {
665 contextStart?: Location;
666 contextEnd?: Location;
667 }
668 interface FileSpanWithContext extends FileSpan, TextSpanWithContext {
669 }
670 interface DefinitionInfoAndBoundSpan {
671 definitions: readonly FileSpanWithContext[];
672 textSpan: TextSpan;
673 }
674 /**
675 * Definition response message. Gives text range for definition.
676 */
677 interface DefinitionResponse extends Response {
678 body?: FileSpanWithContext[];
679 }
680 interface DefinitionInfoAndBoundSpanResponse extends Response {
681 body?: DefinitionInfoAndBoundSpan;
682 }
683 /** @deprecated Use `DefinitionInfoAndBoundSpanResponse` instead. */
684 type DefinitionInfoAndBoundSpanReponse = DefinitionInfoAndBoundSpanResponse;
685 /**
686 * Definition response message. Gives text range for definition.
687 */
688 interface TypeDefinitionResponse extends Response {
689 body?: FileSpanWithContext[];
690 }
691 /**
692 * Implementation response message. Gives text range for implementations.
693 */
694 interface ImplementationResponse extends Response {
695 body?: FileSpanWithContext[];
696 }
697 /**
698 * Request to get brace completion for a location in the file.
699 */
700 interface BraceCompletionRequest extends FileLocationRequest {
701 command: CommandTypes.BraceCompletion;
702 arguments: BraceCompletionRequestArgs;
703 }
704 /**
705 * Argument for BraceCompletionRequest request.
706 */
707 interface BraceCompletionRequestArgs extends FileLocationRequestArgs {
708 /**
709 * Kind of opening brace
710 */
711 openingBrace: string;
712 }
713 interface JsxClosingTagRequest extends FileLocationRequest {
714 readonly command: CommandTypes.JsxClosingTag;
715 readonly arguments: JsxClosingTagRequestArgs;
716 }
717 interface JsxClosingTagRequestArgs extends FileLocationRequestArgs {
718 }
719 interface JsxClosingTagResponse extends Response {
720 readonly body: TextInsertion;
721 }
722 /**
723 * @deprecated
724 * Get occurrences request; value of command field is
725 * "occurrences". Return response giving spans that are relevant
726 * in the file at a given line and column.
727 */
728 interface OccurrencesRequest extends FileLocationRequest {
729 command: CommandTypes.Occurrences;
730 }
731 /** @deprecated */
732 interface OccurrencesResponseItem extends FileSpanWithContext {
733 /**
734 * True if the occurrence is a write location, false otherwise.
735 */
736 isWriteAccess: boolean;
737 /**
738 * True if the occurrence is in a string, undefined otherwise;
739 */
740 isInString?: true;
741 }
742 /** @deprecated */
743 interface OccurrencesResponse extends Response {
744 body?: OccurrencesResponseItem[];
745 }
746 /**
747 * Get document highlights request; value of command field is
748 * "documentHighlights". Return response giving spans that are relevant
749 * in the file at a given line and column.
750 */
751 interface DocumentHighlightsRequest extends FileLocationRequest {
752 command: CommandTypes.DocumentHighlights;
753 arguments: DocumentHighlightsRequestArgs;
754 }
755 /**
756 * Span augmented with extra information that denotes the kind of the highlighting to be used for span.
757 */
758 interface HighlightSpan extends TextSpanWithContext {
759 kind: HighlightSpanKind;
760 }
761 /**
762 * Represents a set of highligh spans for a give name
763 */
764 interface DocumentHighlightsItem {
765 /**
766 * File containing highlight spans.
767 */
768 file: string;
769 /**
770 * Spans to highlight in file.
771 */
772 highlightSpans: HighlightSpan[];
773 }
774 /**
775 * Response for a DocumentHighlightsRequest request.
776 */
777 interface DocumentHighlightsResponse extends Response {
778 body?: DocumentHighlightsItem[];
779 }
780 /**
781 * Find references request; value of command field is
782 * "references". Return response giving the file locations that
783 * reference the symbol found in file at location line, col.
784 */
785 interface ReferencesRequest extends FileLocationRequest {
786 command: CommandTypes.References;
787 }
788 interface ReferencesResponseItem extends FileSpanWithContext {
789 /** Text of line containing the reference. Including this
790 * with the response avoids latency of editor loading files
791 * to show text of reference line (the server already has
792 * loaded the referencing files).
793 */
794 lineText: string;
795 /**
796 * True if reference is a write location, false otherwise.
797 */
798 isWriteAccess: boolean;
799 /**
800 * True if reference is a definition, false otherwise.
801 */
802 isDefinition: boolean;
803 }
804 /**
805 * The body of a "references" response message.
806 */
807 interface ReferencesResponseBody {
808 /**
809 * The file locations referencing the symbol.
810 */
811 refs: readonly ReferencesResponseItem[];
812 /**
813 * The name of the symbol.
814 */
815 symbolName: string;
816 /**
817 * The start character offset of the symbol (on the line provided by the references request).
818 */
819 symbolStartOffset: number;
820 /**
821 * The full display name of the symbol.
822 */
823 symbolDisplayString: string;
824 }
825 /**
826 * Response to "references" request.
827 */
828 interface ReferencesResponse extends Response {
829 body?: ReferencesResponseBody;
830 }
831 /**
832 * Argument for RenameRequest request.
833 */
834 interface RenameRequestArgs extends FileLocationRequestArgs {
835 /**
836 * Should text at specified location be found/changed in comments?
837 */
838 findInComments?: boolean;
839 /**
840 * Should text at specified location be found/changed in strings?
841 */
842 findInStrings?: boolean;
843 }
844 /**
845 * Rename request; value of command field is "rename". Return
846 * response giving the file locations that reference the symbol
847 * found in file at location line, col. Also return full display
848 * name of the symbol so that client can print it unambiguously.
849 */
850 interface RenameRequest extends FileLocationRequest {
851 command: CommandTypes.Rename;
852 arguments: RenameRequestArgs;
853 }
854 /**
855 * Information about the item to be renamed.
856 */
857 type RenameInfo = RenameInfoSuccess | RenameInfoFailure;
858 interface RenameInfoSuccess {
859 /**
860 * True if item can be renamed.
861 */
862 canRename: true;
863 /**
864 * File or directory to rename.
865 * If set, `getEditsForFileRename` should be called instead of `findRenameLocations`.
866 */
867 fileToRename?: string;
868 /**
869 * Display name of the item to be renamed.
870 */
871 displayName: string;
872 /**
873 * Full display name of item to be renamed.
874 */
875 fullDisplayName: string;
876 /**
877 * The items's kind (such as 'className' or 'parameterName' or plain 'text').
878 */
879 kind: ScriptElementKind;
880 /**
881 * Optional modifiers for the kind (such as 'public').
882 */
883 kindModifiers: string;
884 /** Span of text to rename. */
885 triggerSpan: TextSpan;
886 }
887 interface RenameInfoFailure {
888 canRename: false;
889 /**
890 * Error message if item can not be renamed.
891 */
892 localizedErrorMessage: string;
893 }
894 /**
895 * A group of text spans, all in 'file'.
896 */
897 interface SpanGroup {
898 /** The file to which the spans apply */
899 file: string;
900 /** The text spans in this group */
901 locs: RenameTextSpan[];
902 }
903 interface RenameTextSpan extends TextSpanWithContext {
904 readonly prefixText?: string;
905 readonly suffixText?: string;
906 }
907 interface RenameResponseBody {
908 /**
909 * Information about the item to be renamed.
910 */
911 info: RenameInfo;
912 /**
913 * An array of span groups (one per file) that refer to the item to be renamed.
914 */
915 locs: readonly SpanGroup[];
916 }
917 /**
918 * Rename response message.
919 */
920 interface RenameResponse extends Response {
921 body?: RenameResponseBody;
922 }
923 /**
924 * Represents a file in external project.
925 * External project is project whose set of files, compilation options and open\close state
926 * is maintained by the client (i.e. if all this data come from .csproj file in Visual Studio).
927 * External project will exist even if all files in it are closed and should be closed explicitly.
928 * If external project includes one or more tsconfig.json/jsconfig.json files then tsserver will
929 * create configured project for every config file but will maintain a link that these projects were created
930 * as a result of opening external project so they should be removed once external project is closed.
931 */
932 interface ExternalFile {
933 /**
934 * Name of file file
935 */
936 fileName: string;
937 /**
938 * Script kind of the file
939 */
940 scriptKind?: ScriptKindName | ts.ScriptKind;
941 /**
942 * Whether file has mixed content (i.e. .cshtml file that combines html markup with C#/JavaScript)
943 */
944 hasMixedContent?: boolean;
945 /**
946 * Content of the file
947 */
948 content?: string;
949 }
950 /**
951 * Represent an external project
952 */
953 interface ExternalProject {
954 /**
955 * Project name
956 */
957 projectFileName: string;
958 /**
959 * List of root files in project
960 */
961 rootFiles: ExternalFile[];
962 /**
963 * Compiler options for the project
964 */
965 options: ExternalProjectCompilerOptions;
966 /**
967 * @deprecated typingOptions. Use typeAcquisition instead
968 */
969 typingOptions?: TypeAcquisition;
970 /**
971 * Explicitly specified type acquisition for the project
972 */
973 typeAcquisition?: TypeAcquisition;
974 }
975 interface CompileOnSaveMixin {
976 /**
977 * If compile on save is enabled for the project
978 */
979 compileOnSave?: boolean;
980 }
981 /**
982 * For external projects, some of the project settings are sent together with
983 * compiler settings.
984 */
985 type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin & WatchOptions;
986 interface FileWithProjectReferenceRedirectInfo {
987 /**
988 * Name of file
989 */
990 fileName: string;
991 /**
992 * True if the file is primarily included in a referenced project
993 */
994 isSourceOfProjectReferenceRedirect: boolean;
995 }
996 /**
997 * Represents a set of changes that happen in project
998 */
999 interface ProjectChanges {
1000 /**
1001 * List of added files
1002 */
1003 added: string[] | FileWithProjectReferenceRedirectInfo[];
1004 /**
1005 * List of removed files
1006 */
1007 removed: string[] | FileWithProjectReferenceRedirectInfo[];
1008 /**
1009 * List of updated files
1010 */
1011 updated: string[] | FileWithProjectReferenceRedirectInfo[];
1012 /**
1013 * List of files that have had their project reference redirect status updated
1014 * Only provided when the synchronizeProjectList request has includeProjectReferenceRedirectInfo set to true
1015 */
1016 updatedRedirects?: FileWithProjectReferenceRedirectInfo[];
1017 }
1018 /**
1019 * Information found in a configure request.
1020 */
1021 interface ConfigureRequestArguments {
1022 /**
1023 * Information about the host, for example 'Emacs 24.4' or
1024 * 'Sublime Text version 3075'
1025 */
1026 hostInfo?: string;
1027 /**
1028 * If present, tab settings apply only to this file.
1029 */
1030 file?: string;
1031 /**
1032 * The format options to use during formatting and other code editing features.
1033 */
1034 formatOptions?: FormatCodeSettings;
1035 preferences?: UserPreferences;
1036 /**
1037 * The host's additional supported .js file extensions
1038 */
1039 extraFileExtensions?: FileExtensionInfo[];
1040 watchOptions?: WatchOptions;
1041 }
1042 const enum WatchFileKind {
1043 FixedPollingInterval = "FixedPollingInterval",
1044 PriorityPollingInterval = "PriorityPollingInterval",
1045 DynamicPriorityPolling = "DynamicPriorityPolling",
1046 UseFsEvents = "UseFsEvents",
1047 UseFsEventsOnParentDirectory = "UseFsEventsOnParentDirectory"
1048 }
1049 const enum WatchDirectoryKind {
1050 UseFsEvents = "UseFsEvents",
1051 FixedPollingInterval = "FixedPollingInterval",
1052 DynamicPriorityPolling = "DynamicPriorityPolling"
1053 }
1054 const enum PollingWatchKind {
1055 FixedInterval = "FixedInterval",
1056 PriorityInterval = "PriorityInterval",
1057 DynamicPriority = "DynamicPriority"
1058 }
1059 interface WatchOptions {
1060 watchFile?: WatchFileKind | ts.WatchFileKind;
1061 watchDirectory?: WatchDirectoryKind | ts.WatchDirectoryKind;
1062 fallbackPolling?: PollingWatchKind | ts.PollingWatchKind;
1063 synchronousWatchDirectory?: boolean;
1064 [option: string]: CompilerOptionsValue | undefined;
1065 }
1066 /**
1067 * Configure request; value of command field is "configure". Specifies
1068 * host information, such as host type, tab size, and indent size.
1069 */
1070 interface ConfigureRequest extends Request {
1071 command: CommandTypes.Configure;
1072 arguments: ConfigureRequestArguments;
1073 }
1074 /**
1075 * Response to "configure" request. This is just an acknowledgement, so
1076 * no body field is required.
1077 */
1078 interface ConfigureResponse extends Response {
1079 }
1080 interface ConfigurePluginRequestArguments {
1081 pluginName: string;
1082 configuration: any;
1083 }
1084 interface ConfigurePluginRequest extends Request {
1085 command: CommandTypes.ConfigurePlugin;
1086 arguments: ConfigurePluginRequestArguments;
1087 }
1088 interface ConfigurePluginResponse extends Response {
1089 }
1090 interface SelectionRangeRequest extends FileRequest {
1091 command: CommandTypes.SelectionRange;
1092 arguments: SelectionRangeRequestArgs;
1093 }
1094 interface SelectionRangeRequestArgs extends FileRequestArgs {
1095 locations: Location[];
1096 }
1097 interface SelectionRangeResponse extends Response {
1098 body?: SelectionRange[];
1099 }
1100 interface SelectionRange {
1101 textSpan: TextSpan;
1102 parent?: SelectionRange;
1103 }
1104 interface ToggleLineCommentRequest extends FileRequest {
1105 command: CommandTypes.ToggleLineComment;
1106 arguments: FileRangeRequestArgs;
1107 }
1108 interface ToggleMultilineCommentRequest extends FileRequest {
1109 command: CommandTypes.ToggleMultilineComment;
1110 arguments: FileRangeRequestArgs;
1111 }
1112 interface CommentSelectionRequest extends FileRequest {
1113 command: CommandTypes.CommentSelection;
1114 arguments: FileRangeRequestArgs;
1115 }
1116 interface UncommentSelectionRequest extends FileRequest {
1117 command: CommandTypes.UncommentSelection;
1118 arguments: FileRangeRequestArgs;
1119 }
1120 /**
1121 * Information found in an "open" request.
1122 */
1123 interface OpenRequestArgs extends FileRequestArgs {
1124 /**
1125 * Used when a version of the file content is known to be more up to date than the one on disk.
1126 * Then the known content will be used upon opening instead of the disk copy
1127 */
1128 fileContent?: string;
1129 /**
1130 * Used to specify the script kind of the file explicitly. It could be one of the following:
1131 * "TS", "JS", "TSX", "JSX"
1132 */
1133 scriptKindName?: ScriptKindName;
1134 /**
1135 * Used to limit the searching for project config file. If given the searching will stop at this
1136 * root path; otherwise it will go all the way up to the dist root path.
1137 */
1138 projectRootPath?: string;
1139 }
1140 type ScriptKindName = "TS" | "JS" | "TSX" | "JSX";
1141 /**
1142 * Open request; value of command field is "open". Notify the
1143 * server that the client has file open. The server will not
1144 * monitor the filesystem for changes in this file and will assume
1145 * that the client is updating the server (using the change and/or
1146 * reload messages) when the file changes. Server does not currently
1147 * send a response to an open request.
1148 */
1149 interface OpenRequest extends Request {
1150 command: CommandTypes.Open;
1151 arguments: OpenRequestArgs;
1152 }
1153 /**
1154 * Request to open or update external project
1155 */
1156 interface OpenExternalProjectRequest extends Request {
1157 command: CommandTypes.OpenExternalProject;
1158 arguments: OpenExternalProjectArgs;
1159 }
1160 /**
1161 * Arguments to OpenExternalProjectRequest request
1162 */
1163 type OpenExternalProjectArgs = ExternalProject;
1164 /**
1165 * Request to open multiple external projects
1166 */
1167 interface OpenExternalProjectsRequest extends Request {
1168 command: CommandTypes.OpenExternalProjects;
1169 arguments: OpenExternalProjectsArgs;
1170 }
1171 /**
1172 * Arguments to OpenExternalProjectsRequest
1173 */
1174 interface OpenExternalProjectsArgs {
1175 /**
1176 * List of external projects to open or update
1177 */
1178 projects: ExternalProject[];
1179 }
1180 /**
1181 * Response to OpenExternalProjectRequest request. This is just an acknowledgement, so
1182 * no body field is required.
1183 */
1184 interface OpenExternalProjectResponse extends Response {
1185 }
1186 /**
1187 * Response to OpenExternalProjectsRequest request. This is just an acknowledgement, so
1188 * no body field is required.
1189 */
1190 interface OpenExternalProjectsResponse extends Response {
1191 }
1192 /**
1193 * Request to close external project.
1194 */
1195 interface CloseExternalProjectRequest extends Request {
1196 command: CommandTypes.CloseExternalProject;
1197 arguments: CloseExternalProjectRequestArgs;
1198 }
1199 /**
1200 * Arguments to CloseExternalProjectRequest request
1201 */
1202 interface CloseExternalProjectRequestArgs {
1203 /**
1204 * Name of the project to close
1205 */
1206 projectFileName: string;
1207 }
1208 /**
1209 * Response to CloseExternalProjectRequest request. This is just an acknowledgement, so
1210 * no body field is required.
1211 */
1212 interface CloseExternalProjectResponse extends Response {
1213 }
1214 /**
1215 * Request to synchronize list of open files with the client
1216 */
1217 interface UpdateOpenRequest extends Request {
1218 command: CommandTypes.UpdateOpen;
1219 arguments: UpdateOpenRequestArgs;
1220 }
1221 /**
1222 * Arguments to UpdateOpenRequest
1223 */
1224 interface UpdateOpenRequestArgs {
1225 /**
1226 * List of newly open files
1227 */
1228 openFiles?: OpenRequestArgs[];
1229 /**
1230 * List of open files files that were changes
1231 */
1232 changedFiles?: FileCodeEdits[];
1233 /**
1234 * List of files that were closed
1235 */
1236 closedFiles?: string[];
1237 }
1238 /**
1239 * Request to set compiler options for inferred projects.
1240 * External projects are opened / closed explicitly.
1241 * Configured projects are opened when user opens loose file that has 'tsconfig.json' or 'jsconfig.json' anywhere in one of containing folders.
1242 * This configuration file will be used to obtain a list of files and configuration settings for the project.
1243 * Inferred projects are created when user opens a loose file that is not the part of external project
1244 * or configured project and will contain only open file and transitive closure of referenced files if 'useOneInferredProject' is false,
1245 * or all open loose files and its transitive closure of referenced files if 'useOneInferredProject' is true.
1246 */
1247 interface SetCompilerOptionsForInferredProjectsRequest extends Request {
1248 command: CommandTypes.CompilerOptionsForInferredProjects;
1249 arguments: SetCompilerOptionsForInferredProjectsArgs;
1250 }
1251 /**
1252 * Argument for SetCompilerOptionsForInferredProjectsRequest request.
1253 */
1254 interface SetCompilerOptionsForInferredProjectsArgs {
1255 /**
1256 * Compiler options to be used with inferred projects.
1257 */
1258 options: ExternalProjectCompilerOptions;
1259 /**
1260 * Specifies the project root path used to scope compiler options.
1261 * It is an error to provide this property if the server has not been started with
1262 * `useInferredProjectPerProjectRoot` enabled.
1263 */
1264 projectRootPath?: string;
1265 }
1266 /**
1267 * Response to SetCompilerOptionsForInferredProjectsResponse request. This is just an acknowledgement, so
1268 * no body field is required.
1269 */
1270 interface SetCompilerOptionsForInferredProjectsResponse extends Response {
1271 }
1272 /**
1273 * Exit request; value of command field is "exit". Ask the server process
1274 * to exit.
1275 */
1276 interface ExitRequest extends Request {
1277 command: CommandTypes.Exit;
1278 }
1279 /**
1280 * Close request; value of command field is "close". Notify the
1281 * server that the client has closed a previously open file. If
1282 * file is still referenced by open files, the server will resume
1283 * monitoring the filesystem for changes to file. Server does not
1284 * currently send a response to a close request.
1285 */
1286 interface CloseRequest extends FileRequest {
1287 command: CommandTypes.Close;
1288 }
1289 /**
1290 * Request to obtain the list of files that should be regenerated if target file is recompiled.
1291 * NOTE: this us query-only operation and does not generate any output on disk.
1292 */
1293 interface CompileOnSaveAffectedFileListRequest extends FileRequest {
1294 command: CommandTypes.CompileOnSaveAffectedFileList;
1295 }
1296 /**
1297 * Contains a list of files that should be regenerated in a project
1298 */
1299 interface CompileOnSaveAffectedFileListSingleProject {
1300 /**
1301 * Project name
1302 */
1303 projectFileName: string;
1304 /**
1305 * List of files names that should be recompiled
1306 */
1307 fileNames: string[];
1308 /**
1309 * true if project uses outFile or out compiler option
1310 */
1311 projectUsesOutFile: boolean;
1312 }
1313 /**
1314 * Response for CompileOnSaveAffectedFileListRequest request;
1315 */
1316 interface CompileOnSaveAffectedFileListResponse extends Response {
1317 body: CompileOnSaveAffectedFileListSingleProject[];
1318 }
1319 /**
1320 * Request to recompile the file. All generated outputs (.js, .d.ts or .js.map files) is written on disk.
1321 */
1322 interface CompileOnSaveEmitFileRequest extends FileRequest {
1323 command: CommandTypes.CompileOnSaveEmitFile;
1324 arguments: CompileOnSaveEmitFileRequestArgs;
1325 }
1326 /**
1327 * Arguments for CompileOnSaveEmitFileRequest
1328 */
1329 interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs {
1330 /**
1331 * if true - then file should be recompiled even if it does not have any changes.
1332 */
1333 forced?: boolean;
1334 includeLinePosition?: boolean;
1335 /** if true - return response as object with emitSkipped and diagnostics */
1336 richResponse?: boolean;
1337 }
1338 interface CompileOnSaveEmitFileResponse extends Response {
1339 body: boolean | EmitResult;
1340 }
1341 interface EmitResult {
1342 emitSkipped: boolean;
1343 diagnostics: Diagnostic[] | DiagnosticWithLinePosition[];
1344 }
1345 /**
1346 * Quickinfo request; value of command field is
1347 * "quickinfo". Return response giving a quick type and
1348 * documentation string for the symbol found in file at location
1349 * line, col.
1350 */
1351 interface QuickInfoRequest extends FileLocationRequest {
1352 command: CommandTypes.Quickinfo;
1353 }
1354 /**
1355 * Body of QuickInfoResponse.
1356 */
1357 interface QuickInfoResponseBody {
1358 /**
1359 * The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
1360 */
1361 kind: ScriptElementKind;
1362 /**
1363 * Optional modifiers for the kind (such as 'public').
1364 */
1365 kindModifiers: string;
1366 /**
1367 * Starting file location of symbol.
1368 */
1369 start: Location;
1370 /**
1371 * One past last character of symbol.
1372 */
1373 end: Location;
1374 /**
1375 * Type and kind of symbol.
1376 */
1377 displayString: string;
1378 /**
1379 * Documentation associated with symbol.
1380 */
1381 documentation: string;
1382 /**
1383 * JSDoc tags associated with symbol.
1384 */
1385 tags: JSDocTagInfo[];
1386 }
1387 /**
1388 * Quickinfo response message.
1389 */
1390 interface QuickInfoResponse extends Response {
1391 body?: QuickInfoResponseBody;
1392 }
1393 /**
1394 * Arguments for format messages.
1395 */
1396 interface FormatRequestArgs extends FileLocationRequestArgs {
1397 /**
1398 * Last line of range for which to format text in file.
1399 */
1400 endLine: number;
1401 /**
1402 * Character offset on last line of range for which to format text in file.
1403 */
1404 endOffset: number;
1405 /**
1406 * Format options to be used.
1407 */
1408 options?: FormatCodeSettings;
1409 }
1410 /**
1411 * Format request; value of command field is "format". Return
1412 * response giving zero or more edit instructions. The edit
1413 * instructions will be sorted in file order. Applying the edit
1414 * instructions in reverse to file will result in correctly
1415 * reformatted text.
1416 */
1417 interface FormatRequest extends FileLocationRequest {
1418 command: CommandTypes.Format;
1419 arguments: FormatRequestArgs;
1420 }
1421 /**
1422 * Object found in response messages defining an editing
1423 * instruction for a span of text in source code. The effect of
1424 * this instruction is to replace the text starting at start and
1425 * ending one character before end with newText. For an insertion,
1426 * the text span is empty. For a deletion, newText is empty.
1427 */
1428 interface CodeEdit {
1429 /**
1430 * First character of the text span to edit.
1431 */
1432 start: Location;
1433 /**
1434 * One character past last character of the text span to edit.
1435 */
1436 end: Location;
1437 /**
1438 * Replace the span defined above with this string (may be
1439 * the empty string).
1440 */
1441 newText: string;
1442 }
1443 interface FileCodeEdits {
1444 fileName: string;
1445 textChanges: CodeEdit[];
1446 }
1447 interface CodeFixResponse extends Response {
1448 /** The code actions that are available */
1449 body?: CodeFixAction[];
1450 }
1451 interface CodeAction {
1452 /** Description of the code action to display in the UI of the editor */
1453 description: string;
1454 /** Text changes to apply to each file as part of the code action */
1455 changes: FileCodeEdits[];
1456 /** A command is an opaque object that should be passed to `ApplyCodeActionCommandRequestArgs` without modification. */
1457 commands?: {}[];
1458 }
1459 interface CombinedCodeActions {
1460 changes: readonly FileCodeEdits[];
1461 commands?: readonly {}[];
1462 }
1463 interface CodeFixAction extends CodeAction {
1464 /** Short name to identify the fix, for use by telemetry. */
1465 fixName: string;
1466 /**
1467 * If present, one may call 'getCombinedCodeFix' with this fixId.
1468 * This may be omitted to indicate that the code fix can't be applied in a group.
1469 */
1470 fixId?: {};
1471 /** Should be present if and only if 'fixId' is. */
1472 fixAllDescription?: string;
1473 }
1474 /**
1475 * Format and format on key response message.
1476 */
1477 interface FormatResponse extends Response {
1478 body?: CodeEdit[];
1479 }
1480 /**
1481 * Arguments for format on key messages.
1482 */
1483 interface FormatOnKeyRequestArgs extends FileLocationRequestArgs {
1484 /**
1485 * Key pressed (';', '\n', or '}').
1486 */
1487 key: string;
1488 options?: FormatCodeSettings;
1489 }
1490 /**
1491 * Format on key request; value of command field is
1492 * "formatonkey". Given file location and key typed (as string),
1493 * return response giving zero or more edit instructions. The
1494 * edit instructions will be sorted in file order. Applying the
1495 * edit instructions in reverse to file will result in correctly
1496 * reformatted text.
1497 */
1498 interface FormatOnKeyRequest extends FileLocationRequest {
1499 command: CommandTypes.Formatonkey;
1500 arguments: FormatOnKeyRequestArgs;
1501 }
1502 type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#";
1503 /**
1504 * Arguments for completions messages.
1505 */
1506 interface CompletionsRequestArgs extends FileLocationRequestArgs {
1507 /**
1508 * Optional prefix to apply to possible completions.
1509 */
1510 prefix?: string;
1511 /**
1512 * Character that was responsible for triggering completion.
1513 * Should be `undefined` if a user manually requested completion.
1514 */
1515 triggerCharacter?: CompletionsTriggerCharacter;
1516 /**
1517 * @deprecated Use UserPreferences.includeCompletionsForModuleExports
1518 */
1519 includeExternalModuleExports?: boolean;
1520 /**
1521 * @deprecated Use UserPreferences.includeCompletionsWithInsertText
1522 */
1523 includeInsertTextCompletions?: boolean;
1524 }
1525 /**
1526 * Completions request; value of command field is "completions".
1527 * Given a file location (file, line, col) and a prefix (which may
1528 * be the empty string), return the possible completions that
1529 * begin with prefix.
1530 */
1531 interface CompletionsRequest extends FileLocationRequest {
1532 command: CommandTypes.Completions | CommandTypes.CompletionInfo;
1533 arguments: CompletionsRequestArgs;
1534 }
1535 /**
1536 * Arguments for completion details request.
1537 */
1538 interface CompletionDetailsRequestArgs extends FileLocationRequestArgs {
1539 /**
1540 * Names of one or more entries for which to obtain details.
1541 */
1542 entryNames: (string | CompletionEntryIdentifier)[];
1543 }
1544 interface CompletionEntryIdentifier {
1545 name: string;
1546 source?: string;
1547 }
1548 /**
1549 * Completion entry details request; value of command field is
1550 * "completionEntryDetails". Given a file location (file, line,
1551 * col) and an array of completion entry names return more
1552 * detailed information for each completion entry.
1553 */
1554 interface CompletionDetailsRequest extends FileLocationRequest {
1555 command: CommandTypes.CompletionDetails;
1556 arguments: CompletionDetailsRequestArgs;
1557 }
1558 /**
1559 * Part of a symbol description.
1560 */
1561 interface SymbolDisplayPart {
1562 /**
1563 * Text of an item describing the symbol.
1564 */
1565 text: string;
1566 /**
1567 * The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
1568 */
1569 kind: string;
1570 }
1571 /**
1572 * An item found in a completion response.
1573 */
1574 interface CompletionEntry {
1575 /**
1576 * The symbol's name.
1577 */
1578 name: string;
1579 /**
1580 * The symbol's kind (such as 'className' or 'parameterName').
1581 */
1582 kind: ScriptElementKind;
1583 /**
1584 * Optional modifiers for the kind (such as 'public').
1585 */
1586 kindModifiers?: string;
1587 /**
1588 * A string that is used for comparing completion items so that they can be ordered. This
1589 * is often the same as the name but may be different in certain circumstances.
1590 */
1591 sortText: string;
1592 /**
1593 * Text to insert instead of `name`.
1594 * This is used to support bracketed completions; If `name` might be "a-b" but `insertText` would be `["a-b"]`,
1595 * coupled with `replacementSpan` to replace a dotted access with a bracket access.
1596 */
1597 insertText?: string;
1598 /**
1599 * An optional span that indicates the text to be replaced by this completion item.
1600 * If present, this span should be used instead of the default one.
1601 * It will be set if the required span differs from the one generated by the default replacement behavior.
1602 */
1603 replacementSpan?: TextSpan;
1604 /**
1605 * Indicates whether commiting this completion entry will require additional code actions to be
1606 * made to avoid errors. The CompletionEntryDetails will have these actions.
1607 */
1608 hasAction?: true;
1609 /**
1610 * Identifier (not necessarily human-readable) identifying where this completion came from.
1611 */
1612 source?: string;
1613 /**
1614 * If true, this completion should be highlighted as recommended. There will only be one of these.
1615 * 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.
1616 * Then either that enum/class or a namespace containing it will be the recommended symbol.
1617 */
1618 isRecommended?: true;
1619 /**
1620 * If true, this completion was generated from traversing the name table of an unchecked JS file,
1621 * and therefore may not be accurate.
1622 */
1623 isFromUncheckedFile?: true;
1624 /**
1625 * If true, this completion was for an auto-import of a module not yet in the program, but listed
1626 * in the project package.json.
1627 */
1628 isPackageJsonImport?: true;
1629 }
1630 /**
1631 * Additional completion entry details, available on demand
1632 */
1633 interface CompletionEntryDetails {
1634 /**
1635 * The symbol's name.
1636 */
1637 name: string;
1638 /**
1639 * The symbol's kind (such as 'className' or 'parameterName').
1640 */
1641 kind: ScriptElementKind;
1642 /**
1643 * Optional modifiers for the kind (such as 'public').
1644 */
1645 kindModifiers: string;
1646 /**
1647 * Display parts of the symbol (similar to quick info).
1648 */
1649 displayParts: SymbolDisplayPart[];
1650 /**
1651 * Documentation strings for the symbol.
1652 */
1653 documentation?: SymbolDisplayPart[];
1654 /**
1655 * JSDoc tags for the symbol.
1656 */
1657 tags?: JSDocTagInfo[];
1658 /**
1659 * The associated code actions for this entry
1660 */
1661 codeActions?: CodeAction[];
1662 /**
1663 * Human-readable description of the `source` from the CompletionEntry.
1664 */
1665 source?: SymbolDisplayPart[];
1666 }
1667 /** @deprecated Prefer CompletionInfoResponse, which supports several top-level fields in addition to the array of entries. */
1668 interface CompletionsResponse extends Response {
1669 body?: CompletionEntry[];
1670 }
1671 interface CompletionInfoResponse extends Response {
1672 body?: CompletionInfo;
1673 }
1674 interface CompletionInfo {
1675 readonly isGlobalCompletion: boolean;
1676 readonly isMemberCompletion: boolean;
1677 readonly isNewIdentifierLocation: boolean;
1678 readonly entries: readonly CompletionEntry[];
1679 }
1680 interface CompletionDetailsResponse extends Response {
1681 body?: CompletionEntryDetails[];
1682 }
1683 /**
1684 * Signature help information for a single parameter
1685 */
1686 interface SignatureHelpParameter {
1687 /**
1688 * The parameter's name
1689 */
1690 name: string;
1691 /**
1692 * Documentation of the parameter.
1693 */
1694 documentation: SymbolDisplayPart[];
1695 /**
1696 * Display parts of the parameter.
1697 */
1698 displayParts: SymbolDisplayPart[];
1699 /**
1700 * Whether the parameter is optional or not.
1701 */
1702 isOptional: boolean;
1703 }
1704 /**
1705 * Represents a single signature to show in signature help.
1706 */
1707 interface SignatureHelpItem {
1708 /**
1709 * Whether the signature accepts a variable number of arguments.
1710 */
1711 isVariadic: boolean;
1712 /**
1713 * The prefix display parts.
1714 */
1715 prefixDisplayParts: SymbolDisplayPart[];
1716 /**
1717 * The suffix display parts.
1718 */
1719 suffixDisplayParts: SymbolDisplayPart[];
1720 /**
1721 * The separator display parts.
1722 */
1723 separatorDisplayParts: SymbolDisplayPart[];
1724 /**
1725 * The signature helps items for the parameters.
1726 */
1727 parameters: SignatureHelpParameter[];
1728 /**
1729 * The signature's documentation
1730 */
1731 documentation: SymbolDisplayPart[];
1732 /**
1733 * The signature's JSDoc tags
1734 */
1735 tags: JSDocTagInfo[];
1736 }
1737 /**
1738 * Signature help items found in the response of a signature help request.
1739 */
1740 interface SignatureHelpItems {
1741 /**
1742 * The signature help items.
1743 */
1744 items: SignatureHelpItem[];
1745 /**
1746 * The span for which signature help should appear on a signature
1747 */
1748 applicableSpan: TextSpan;
1749 /**
1750 * The item selected in the set of available help items.
1751 */
1752 selectedItemIndex: number;
1753 /**
1754 * The argument selected in the set of parameters.
1755 */
1756 argumentIndex: number;
1757 /**
1758 * The argument count
1759 */
1760 argumentCount: number;
1761 }
1762 type SignatureHelpTriggerCharacter = "," | "(" | "<";
1763 type SignatureHelpRetriggerCharacter = SignatureHelpTriggerCharacter | ")";
1764 /**
1765 * Arguments of a signature help request.
1766 */
1767 interface SignatureHelpRequestArgs extends FileLocationRequestArgs {
1768 /**
1769 * Reason why signature help was invoked.
1770 * See each individual possible
1771 */
1772 triggerReason?: SignatureHelpTriggerReason;
1773 }
1774 type SignatureHelpTriggerReason = SignatureHelpInvokedReason | SignatureHelpCharacterTypedReason | SignatureHelpRetriggeredReason;
1775 /**
1776 * Signals that the user manually requested signature help.
1777 * The language service will unconditionally attempt to provide a result.
1778 */
1779 interface SignatureHelpInvokedReason {
1780 kind: "invoked";
1781 triggerCharacter?: undefined;
1782 }
1783 /**
1784 * Signals that the signature help request came from a user typing a character.
1785 * Depending on the character and the syntactic context, the request may or may not be served a result.
1786 */
1787 interface SignatureHelpCharacterTypedReason {
1788 kind: "characterTyped";
1789 /**
1790 * Character that was responsible for triggering signature help.
1791 */
1792 triggerCharacter: SignatureHelpTriggerCharacter;
1793 }
1794 /**
1795 * Signals that this signature help request came from typing a character or moving the cursor.
1796 * This should only occur if a signature help session was already active and the editor needs to see if it should adjust.
1797 * The language service will unconditionally attempt to provide a result.
1798 * `triggerCharacter` can be `undefined` for a retrigger caused by a cursor move.
1799 */
1800 interface SignatureHelpRetriggeredReason {
1801 kind: "retrigger";
1802 /**
1803 * Character that was responsible for triggering signature help.
1804 */
1805 triggerCharacter?: SignatureHelpRetriggerCharacter;
1806 }
1807 /**
1808 * Signature help request; value of command field is "signatureHelp".
1809 * Given a file location (file, line, col), return the signature
1810 * help.
1811 */
1812 interface SignatureHelpRequest extends FileLocationRequest {
1813 command: CommandTypes.SignatureHelp;
1814 arguments: SignatureHelpRequestArgs;
1815 }
1816 /**
1817 * Response object for a SignatureHelpRequest.
1818 */
1819 interface SignatureHelpResponse extends Response {
1820 body?: SignatureHelpItems;
1821 }
1822 /**
1823 * Synchronous request for semantic diagnostics of one file.
1824 */
1825 interface SemanticDiagnosticsSyncRequest extends FileRequest {
1826 command: CommandTypes.SemanticDiagnosticsSync;
1827 arguments: SemanticDiagnosticsSyncRequestArgs;
1828 }
1829 interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs {
1830 includeLinePosition?: boolean;
1831 }
1832 /**
1833 * Response object for synchronous sematic diagnostics request.
1834 */
1835 interface SemanticDiagnosticsSyncResponse extends Response {
1836 body?: Diagnostic[] | DiagnosticWithLinePosition[];
1837 }
1838 interface SuggestionDiagnosticsSyncRequest extends FileRequest {
1839 command: CommandTypes.SuggestionDiagnosticsSync;
1840 arguments: SuggestionDiagnosticsSyncRequestArgs;
1841 }
1842 type SuggestionDiagnosticsSyncRequestArgs = SemanticDiagnosticsSyncRequestArgs;
1843 type SuggestionDiagnosticsSyncResponse = SemanticDiagnosticsSyncResponse;
1844 /**
1845 * Synchronous request for syntactic diagnostics of one file.
1846 */
1847 interface SyntacticDiagnosticsSyncRequest extends FileRequest {
1848 command: CommandTypes.SyntacticDiagnosticsSync;
1849 arguments: SyntacticDiagnosticsSyncRequestArgs;
1850 }
1851 interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs {
1852 includeLinePosition?: boolean;
1853 }
1854 /**
1855 * Response object for synchronous syntactic diagnostics request.
1856 */
1857 interface SyntacticDiagnosticsSyncResponse extends Response {
1858 body?: Diagnostic[] | DiagnosticWithLinePosition[];
1859 }
1860 /**
1861 * Arguments for GeterrForProject request.
1862 */
1863 interface GeterrForProjectRequestArgs {
1864 /**
1865 * the file requesting project error list
1866 */
1867 file: string;
1868 /**
1869 * Delay in milliseconds to wait before starting to compute
1870 * errors for the files in the file list
1871 */
1872 delay: number;
1873 }
1874 /**
1875 * GeterrForProjectRequest request; value of command field is
1876 * "geterrForProject". It works similarly with 'Geterr', only
1877 * it request for every file in this project.
1878 */
1879 interface GeterrForProjectRequest extends Request {
1880 command: CommandTypes.GeterrForProject;
1881 arguments: GeterrForProjectRequestArgs;
1882 }
1883 /**
1884 * Arguments for geterr messages.
1885 */
1886 interface GeterrRequestArgs {
1887 /**
1888 * List of file names for which to compute compiler errors.
1889 * The files will be checked in list order.
1890 */
1891 files: string[];
1892 /**
1893 * Delay in milliseconds to wait before starting to compute
1894 * errors for the files in the file list
1895 */
1896 delay: number;
1897 }
1898 /**
1899 * Geterr request; value of command field is "geterr". Wait for
1900 * delay milliseconds and then, if during the wait no change or
1901 * reload messages have arrived for the first file in the files
1902 * list, get the syntactic errors for the file, field requests,
1903 * and then get the semantic errors for the file. Repeat with a
1904 * smaller delay for each subsequent file on the files list. Best
1905 * practice for an editor is to send a file list containing each
1906 * file that is currently visible, in most-recently-used order.
1907 */
1908 interface GeterrRequest extends Request {
1909 command: CommandTypes.Geterr;
1910 arguments: GeterrRequestArgs;
1911 }
1912 type RequestCompletedEventName = "requestCompleted";
1913 /**
1914 * Event that is sent when server have finished processing request with specified id.
1915 */
1916 interface RequestCompletedEvent extends Event {
1917 event: RequestCompletedEventName;
1918 body: RequestCompletedEventBody;
1919 }
1920 interface RequestCompletedEventBody {
1921 request_seq: number;
1922 }
1923 /**
1924 * Item of diagnostic information found in a DiagnosticEvent message.
1925 */
1926 interface Diagnostic {
1927 /**
1928 * Starting file location at which text applies.
1929 */
1930 start: Location;
1931 /**
1932 * The last file location at which the text applies.
1933 */
1934 end: Location;
1935 /**
1936 * Text of diagnostic message.
1937 */
1938 text: string;
1939 /**
1940 * The category of the diagnostic message, e.g. "error", "warning", or "suggestion".
1941 */
1942 category: string;
1943 reportsUnnecessary?: {};
1944 reportsDeprecated?: {};
1945 /**
1946 * Any related spans the diagnostic may have, such as other locations relevant to an error, such as declarartion sites
1947 */
1948 relatedInformation?: DiagnosticRelatedInformation[];
1949 /**
1950 * The error code of the diagnostic message.
1951 */
1952 code?: number;
1953 /**
1954 * The name of the plugin reporting the message.
1955 */
1956 source?: string;
1957 }
1958 interface DiagnosticWithFileName extends Diagnostic {
1959 /**
1960 * Name of the file the diagnostic is in
1961 */
1962 fileName: string;
1963 }
1964 /**
1965 * Represents additional spans returned with a diagnostic which are relevant to it
1966 */
1967 interface DiagnosticRelatedInformation {
1968 /**
1969 * The category of the related information message, e.g. "error", "warning", or "suggestion".
1970 */
1971 category: string;
1972 /**
1973 * The code used ot identify the related information
1974 */
1975 code: number;
1976 /**
1977 * Text of related or additional information.
1978 */
1979 message: string;
1980 /**
1981 * Associated location
1982 */
1983 span?: FileSpan;
1984 }
1985 interface DiagnosticEventBody {
1986 /**
1987 * The file for which diagnostic information is reported.
1988 */
1989 file: string;
1990 /**
1991 * An array of diagnostic information items.
1992 */
1993 diagnostics: Diagnostic[];
1994 }
1995 type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag";
1996 /**
1997 * Event message for DiagnosticEventKind event types.
1998 * These events provide syntactic and semantic errors for a file.
1999 */
2000 interface DiagnosticEvent extends Event {
2001 body?: DiagnosticEventBody;
2002 event: DiagnosticEventKind;
2003 }
2004 interface ConfigFileDiagnosticEventBody {
2005 /**
2006 * The file which trigged the searching and error-checking of the config file
2007 */
2008 triggerFile: string;
2009 /**
2010 * The name of the found config file.
2011 */
2012 configFile: string;
2013 /**
2014 * An arry of diagnostic information items for the found config file.
2015 */
2016 diagnostics: DiagnosticWithFileName[];
2017 }
2018 /**
2019 * Event message for "configFileDiag" event type.
2020 * This event provides errors for a found config file.
2021 */
2022 interface ConfigFileDiagnosticEvent extends Event {
2023 body?: ConfigFileDiagnosticEventBody;
2024 event: "configFileDiag";
2025 }
2026 type ProjectLanguageServiceStateEventName = "projectLanguageServiceState";
2027 interface ProjectLanguageServiceStateEvent extends Event {
2028 event: ProjectLanguageServiceStateEventName;
2029 body?: ProjectLanguageServiceStateEventBody;
2030 }
2031 interface ProjectLanguageServiceStateEventBody {
2032 /**
2033 * Project name that has changes in the state of language service.
2034 * For configured projects this will be the config file path.
2035 * For external projects this will be the name of the projects specified when project was open.
2036 * For inferred projects this event is not raised.
2037 */
2038 projectName: string;
2039 /**
2040 * True if language service state switched from disabled to enabled
2041 * and false otherwise.
2042 */
2043 languageServiceEnabled: boolean;
2044 }
2045 type ProjectsUpdatedInBackgroundEventName = "projectsUpdatedInBackground";
2046 interface ProjectsUpdatedInBackgroundEvent extends Event {
2047 event: ProjectsUpdatedInBackgroundEventName;
2048 body: ProjectsUpdatedInBackgroundEventBody;
2049 }
2050 interface ProjectsUpdatedInBackgroundEventBody {
2051 /**
2052 * Current set of open files
2053 */
2054 openFiles: string[];
2055 }
2056 type ProjectLoadingStartEventName = "projectLoadingStart";
2057 interface ProjectLoadingStartEvent extends Event {
2058 event: ProjectLoadingStartEventName;
2059 body: ProjectLoadingStartEventBody;
2060 }
2061 interface ProjectLoadingStartEventBody {
2062 /** name of the project */
2063 projectName: string;
2064 /** reason for loading */
2065 reason: string;
2066 }
2067 type ProjectLoadingFinishEventName = "projectLoadingFinish";
2068 interface ProjectLoadingFinishEvent extends Event {
2069 event: ProjectLoadingFinishEventName;
2070 body: ProjectLoadingFinishEventBody;
2071 }
2072 interface ProjectLoadingFinishEventBody {
2073 /** name of the project */
2074 projectName: string;
2075 }
2076 type SurveyReadyEventName = "surveyReady";
2077 interface SurveyReadyEvent extends Event {
2078 event: SurveyReadyEventName;
2079 body: SurveyReadyEventBody;
2080 }
2081 interface SurveyReadyEventBody {
2082 /** Name of the survey. This is an internal machine- and programmer-friendly name */
2083 surveyId: string;
2084 }
2085 type LargeFileReferencedEventName = "largeFileReferenced";
2086 interface LargeFileReferencedEvent extends Event {
2087 event: LargeFileReferencedEventName;
2088 body: LargeFileReferencedEventBody;
2089 }
2090 interface LargeFileReferencedEventBody {
2091 /**
2092 * name of the large file being loaded
2093 */
2094 file: string;
2095 /**
2096 * size of the file
2097 */
2098 fileSize: number;
2099 /**
2100 * max file size allowed on the server
2101 */
2102 maxFileSize: number;
2103 }
2104 /**
2105 * Arguments for reload request.
2106 */
2107 interface ReloadRequestArgs extends FileRequestArgs {
2108 /**
2109 * Name of temporary file from which to reload file
2110 * contents. May be same as file.
2111 */
2112 tmpfile: string;
2113 }
2114 /**
2115 * Reload request message; value of command field is "reload".
2116 * Reload contents of file with name given by the 'file' argument
2117 * from temporary file with name given by the 'tmpfile' argument.
2118 * The two names can be identical.
2119 */
2120 interface ReloadRequest extends FileRequest {
2121 command: CommandTypes.Reload;
2122 arguments: ReloadRequestArgs;
2123 }
2124 /**
2125 * Response to "reload" request. This is just an acknowledgement, so
2126 * no body field is required.
2127 */
2128 interface ReloadResponse extends Response {
2129 }
2130 /**
2131 * Arguments for saveto request.
2132 */
2133 interface SavetoRequestArgs extends FileRequestArgs {
2134 /**
2135 * Name of temporary file into which to save server's view of
2136 * file contents.
2137 */
2138 tmpfile: string;
2139 }
2140 /**
2141 * Saveto request message; value of command field is "saveto".
2142 * For debugging purposes, save to a temporaryfile (named by
2143 * argument 'tmpfile') the contents of file named by argument
2144 * 'file'. The server does not currently send a response to a
2145 * "saveto" request.
2146 */
2147 interface SavetoRequest extends FileRequest {
2148 command: CommandTypes.Saveto;
2149 arguments: SavetoRequestArgs;
2150 }
2151 /**
2152 * Arguments for navto request message.
2153 */
2154 interface NavtoRequestArgs {
2155 /**
2156 * Search term to navigate to from current location; term can
2157 * be '.*' or an identifier prefix.
2158 */
2159 searchValue: string;
2160 /**
2161 * Optional limit on the number of items to return.
2162 */
2163 maxResultCount?: number;
2164 /**
2165 * The file for the request (absolute pathname required).
2166 */
2167 file?: string;
2168 /**
2169 * Optional flag to indicate we want results for just the current file
2170 * or the entire project.
2171 */
2172 currentFileOnly?: boolean;
2173 projectFileName?: string;
2174 }
2175 /**
2176 * Navto request message; value of command field is "navto".
2177 * Return list of objects giving file locations and symbols that
2178 * match the search term given in argument 'searchTerm'. The
2179 * context for the search is given by the named file.
2180 */
2181 interface NavtoRequest extends Request {
2182 command: CommandTypes.Navto;
2183 arguments: NavtoRequestArgs;
2184 }
2185 /**
2186 * An item found in a navto response.
2187 */
2188 interface NavtoItem extends FileSpan {
2189 /**
2190 * The symbol's name.
2191 */
2192 name: string;
2193 /**
2194 * The symbol's kind (such as 'className' or 'parameterName').
2195 */
2196 kind: ScriptElementKind;
2197 /**
2198 * exact, substring, or prefix.
2199 */
2200 matchKind: string;
2201 /**
2202 * If this was a case sensitive or insensitive match.
2203 */
2204 isCaseSensitive: boolean;
2205 /**
2206 * Optional modifiers for the kind (such as 'public').
2207 */
2208 kindModifiers?: string;
2209 /**
2210 * Name of symbol's container symbol (if any); for example,
2211 * the class name if symbol is a class member.
2212 */
2213 containerName?: string;
2214 /**
2215 * Kind of symbol's container symbol (if any).
2216 */
2217 containerKind?: ScriptElementKind;
2218 }
2219 /**
2220 * Navto response message. Body is an array of navto items. Each
2221 * item gives a symbol that matched the search term.
2222 */
2223 interface NavtoResponse extends Response {
2224 body?: NavtoItem[];
2225 }
2226 /**
2227 * Arguments for change request message.
2228 */
2229 interface ChangeRequestArgs extends FormatRequestArgs {
2230 /**
2231 * Optional string to insert at location (file, line, offset).
2232 */
2233 insertString?: string;
2234 }
2235 /**
2236 * Change request message; value of command field is "change".
2237 * Update the server's view of the file named by argument 'file'.
2238 * Server does not currently send a response to a change request.
2239 */
2240 interface ChangeRequest extends FileLocationRequest {
2241 command: CommandTypes.Change;
2242 arguments: ChangeRequestArgs;
2243 }
2244 /**
2245 * Response to "brace" request.
2246 */
2247 interface BraceResponse extends Response {
2248 body?: TextSpan[];
2249 }
2250 /**
2251 * Brace matching request; value of command field is "brace".
2252 * Return response giving the file locations of matching braces
2253 * found in file at location line, offset.
2254 */
2255 interface BraceRequest extends FileLocationRequest {
2256 command: CommandTypes.Brace;
2257 }
2258 /**
2259 * NavBar items request; value of command field is "navbar".
2260 * Return response giving the list of navigation bar entries
2261 * extracted from the requested file.
2262 */
2263 interface NavBarRequest extends FileRequest {
2264 command: CommandTypes.NavBar;
2265 }
2266 /**
2267 * NavTree request; value of command field is "navtree".
2268 * Return response giving the navigation tree of the requested file.
2269 */
2270 interface NavTreeRequest extends FileRequest {
2271 command: CommandTypes.NavTree;
2272 }
2273 interface NavigationBarItem {
2274 /**
2275 * The item's display text.
2276 */
2277 text: string;
2278 /**
2279 * The symbol's kind (such as 'className' or 'parameterName').
2280 */
2281 kind: ScriptElementKind;
2282 /**
2283 * Optional modifiers for the kind (such as 'public').
2284 */
2285 kindModifiers?: string;
2286 /**
2287 * The definition locations of the item.
2288 */
2289 spans: TextSpan[];
2290 /**
2291 * Optional children.
2292 */
2293 childItems?: NavigationBarItem[];
2294 /**
2295 * Number of levels deep this item should appear.
2296 */
2297 indent: number;
2298 }
2299 /** protocol.NavigationTree is identical to ts.NavigationTree, except using protocol.TextSpan instead of ts.TextSpan */
2300 interface NavigationTree {
2301 text: string;
2302 kind: ScriptElementKind;
2303 kindModifiers: string;
2304 spans: TextSpan[];
2305 nameSpan: TextSpan | undefined;
2306 childItems?: NavigationTree[];
2307 }
2308 type TelemetryEventName = "telemetry";
2309 interface TelemetryEvent extends Event {
2310 event: TelemetryEventName;
2311 body: TelemetryEventBody;
2312 }
2313 interface TelemetryEventBody {
2314 telemetryEventName: string;
2315 payload: any;
2316 }
2317 type TypesInstallerInitializationFailedEventName = "typesInstallerInitializationFailed";
2318 interface TypesInstallerInitializationFailedEvent extends Event {
2319 event: TypesInstallerInitializationFailedEventName;
2320 body: TypesInstallerInitializationFailedEventBody;
2321 }
2322 interface TypesInstallerInitializationFailedEventBody {
2323 message: string;
2324 }
2325 type TypingsInstalledTelemetryEventName = "typingsInstalled";
2326 interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody {
2327 telemetryEventName: TypingsInstalledTelemetryEventName;
2328 payload: TypingsInstalledTelemetryEventPayload;
2329 }
2330 interface TypingsInstalledTelemetryEventPayload {
2331 /**
2332 * Comma separated list of installed typing packages
2333 */
2334 installedPackages: string;
2335 /**
2336 * true if install request succeeded, otherwise - false
2337 */
2338 installSuccess: boolean;
2339 /**
2340 * version of typings installer
2341 */
2342 typingsInstallerVersion: string;
2343 }
2344 type BeginInstallTypesEventName = "beginInstallTypes";
2345 type EndInstallTypesEventName = "endInstallTypes";
2346 interface BeginInstallTypesEvent extends Event {
2347 event: BeginInstallTypesEventName;
2348 body: BeginInstallTypesEventBody;
2349 }
2350 interface EndInstallTypesEvent extends Event {
2351 event: EndInstallTypesEventName;
2352 body: EndInstallTypesEventBody;
2353 }
2354 interface InstallTypesEventBody {
2355 /**
2356 * correlation id to match begin and end events
2357 */
2358 eventId: number;
2359 /**
2360 * list of packages to install
2361 */
2362 packages: readonly string[];
2363 }
2364 interface BeginInstallTypesEventBody extends InstallTypesEventBody {
2365 }
2366 interface EndInstallTypesEventBody extends InstallTypesEventBody {
2367 /**
2368 * true if installation succeeded, otherwise false
2369 */
2370 success: boolean;
2371 }
2372 interface NavBarResponse extends Response {
2373 body?: NavigationBarItem[];
2374 }
2375 interface NavTreeResponse extends Response {
2376 body?: NavigationTree;
2377 }
2378 interface CallHierarchyItem {
2379 name: string;
2380 kind: ScriptElementKind;
2381 kindModifiers?: string;
2382 file: string;
2383 span: TextSpan;
2384 selectionSpan: TextSpan;
2385 containerName?: string;
2386 }
2387 interface CallHierarchyIncomingCall {
2388 from: CallHierarchyItem;
2389 fromSpans: TextSpan[];
2390 }
2391 interface CallHierarchyOutgoingCall {
2392 to: CallHierarchyItem;
2393 fromSpans: TextSpan[];
2394 }
2395 interface PrepareCallHierarchyRequest extends FileLocationRequest {
2396 command: CommandTypes.PrepareCallHierarchy;
2397 }
2398 interface PrepareCallHierarchyResponse extends Response {
2399 readonly body: CallHierarchyItem | CallHierarchyItem[];
2400 }
2401 interface ProvideCallHierarchyIncomingCallsRequest extends FileLocationRequest {
2402 command: CommandTypes.ProvideCallHierarchyIncomingCalls;
2403 }
2404 interface ProvideCallHierarchyIncomingCallsResponse extends Response {
2405 readonly body: CallHierarchyIncomingCall[];
2406 }
2407 interface ProvideCallHierarchyOutgoingCallsRequest extends FileLocationRequest {
2408 command: CommandTypes.ProvideCallHierarchyOutgoingCalls;
2409 }
2410 interface ProvideCallHierarchyOutgoingCallsResponse extends Response {
2411 readonly body: CallHierarchyOutgoingCall[];
2412 }
2413 const enum IndentStyle {
2414 None = "None",
2415 Block = "Block",
2416 Smart = "Smart"
2417 }
2418 enum SemicolonPreference {
2419 Ignore = "ignore",
2420 Insert = "insert",
2421 Remove = "remove"
2422 }
2423 interface EditorSettings {
2424 baseIndentSize?: number;
2425 indentSize?: number;
2426 tabSize?: number;
2427 newLineCharacter?: string;
2428 convertTabsToSpaces?: boolean;
2429 indentStyle?: IndentStyle | ts.IndentStyle;
2430 trimTrailingWhitespace?: boolean;
2431 }
2432 interface FormatCodeSettings extends EditorSettings {
2433 insertSpaceAfterCommaDelimiter?: boolean;
2434 insertSpaceAfterSemicolonInForStatements?: boolean;
2435 insertSpaceBeforeAndAfterBinaryOperators?: boolean;
2436 insertSpaceAfterConstructor?: boolean;
2437 insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
2438 insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
2439 insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
2440 insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
2441 insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
2442 insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
2443 insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
2444 insertSpaceAfterTypeAssertion?: boolean;
2445 insertSpaceBeforeFunctionParenthesis?: boolean;
2446 placeOpenBraceOnNewLineForFunctions?: boolean;
2447 placeOpenBraceOnNewLineForControlBlocks?: boolean;
2448 insertSpaceBeforeTypeAnnotation?: boolean;
2449 semicolons?: SemicolonPreference;
2450 }
2451 interface UserPreferences {
2452 readonly disableSuggestions?: boolean;
2453 readonly quotePreference?: "auto" | "double" | "single";
2454 /**
2455 * If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
2456 * This affects lone identifier completions but not completions on the right hand side of `obj.`.
2457 */
2458 readonly includeCompletionsForModuleExports?: boolean;
2459 /**
2460 * If enabled, the completion list will include completions with invalid identifier names.
2461 * For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`.
2462 */
2463 readonly includeCompletionsWithInsertText?: boolean;
2464 /**
2465 * Unless this option is `false`, or `includeCompletionsWithInsertText` is not enabled,
2466 * member completion lists triggered with `.` will include entries on potentially-null and potentially-undefined
2467 * values, with insertion text to replace preceding `.` tokens with `?.`.
2468 */
2469 readonly includeAutomaticOptionalChainCompletions?: boolean;
2470 readonly importModuleSpecifierPreference?: "auto" | "relative" | "non-relative";
2471 /** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
2472 readonly importModuleSpecifierEnding?: "auto" | "minimal" | "index" | "js";
2473 readonly allowTextChangesInNewFiles?: boolean;
2474 readonly lazyConfiguredProjectsFromExternalProject?: boolean;
2475 readonly providePrefixAndSuffixTextForRename?: boolean;
2476 readonly allowRenameOfImportPath?: boolean;
2477 readonly includePackageJsonAutoImports?: "auto" | "on" | "off";
2478 }
2479 interface CompilerOptions {
2480 allowJs?: boolean;
2481 allowSyntheticDefaultImports?: boolean;
2482 allowUnreachableCode?: boolean;
2483 allowUnusedLabels?: boolean;
2484 alwaysStrict?: boolean;
2485 baseUrl?: string;
2486 charset?: string;
2487 checkJs?: boolean;
2488 declaration?: boolean;
2489 declarationDir?: string;
2490 disableSizeLimit?: boolean;
2491 downlevelIteration?: boolean;
2492 emitBOM?: boolean;
2493 emitDecoratorMetadata?: boolean;
2494 experimentalDecorators?: boolean;
2495 forceConsistentCasingInFileNames?: boolean;
2496 importHelpers?: boolean;
2497 inlineSourceMap?: boolean;
2498 inlineSources?: boolean;
2499 isolatedModules?: boolean;
2500 jsx?: JsxEmit | ts.JsxEmit;
2501 lib?: string[];
2502 locale?: string;
2503 mapRoot?: string;
2504 maxNodeModuleJsDepth?: number;
2505 module?: ModuleKind | ts.ModuleKind;
2506 moduleResolution?: ModuleResolutionKind | ts.ModuleResolutionKind;
2507 newLine?: NewLineKind | ts.NewLineKind;
2508 noEmit?: boolean;
2509 noEmitHelpers?: boolean;
2510 noEmitOnError?: boolean;
2511 noErrorTruncation?: boolean;
2512 noFallthroughCasesInSwitch?: boolean;
2513 noImplicitAny?: boolean;
2514 noImplicitReturns?: boolean;
2515 noImplicitThis?: boolean;
2516 noUnusedLocals?: boolean;
2517 noUnusedParameters?: boolean;
2518 noImplicitUseStrict?: boolean;
2519 noLib?: boolean;
2520 noResolve?: boolean;
2521 out?: string;
2522 outDir?: string;
2523 outFile?: string;
2524 paths?: MapLike<string[]>;
2525 plugins?: PluginImport[];
2526 preserveConstEnums?: boolean;
2527 preserveSymlinks?: boolean;
2528 project?: string;
2529 reactNamespace?: string;
2530 removeComments?: boolean;
2531 references?: ProjectReference[];
2532 rootDir?: string;
2533 rootDirs?: string[];
2534 skipLibCheck?: boolean;
2535 skipDefaultLibCheck?: boolean;
2536 sourceMap?: boolean;
2537 sourceRoot?: string;
2538 strict?: boolean;
2539 strictNullChecks?: boolean;
2540 suppressExcessPropertyErrors?: boolean;
2541 suppressImplicitAnyIndexErrors?: boolean;
2542 useDefineForClassFields?: boolean;
2543 target?: ScriptTarget | ts.ScriptTarget;
2544 traceResolution?: boolean;
2545 resolveJsonModule?: boolean;
2546 types?: string[];
2547 /** Paths used to used to compute primary types search locations */
2548 typeRoots?: string[];
2549 [option: string]: CompilerOptionsValue | undefined;
2550 }
2551 const enum JsxEmit {
2552 None = "None",
2553 Preserve = "Preserve",
2554 ReactNative = "ReactNative",
2555 React = "React"
2556 }
2557 const enum ModuleKind {
2558 None = "None",
2559 CommonJS = "CommonJS",
2560 AMD = "AMD",
2561 UMD = "UMD",
2562 System = "System",
2563 ES6 = "ES6",
2564 ES2015 = "ES2015",
2565 ESNext = "ESNext"
2566 }
2567 const enum ModuleResolutionKind {
2568 Classic = "Classic",
2569 Node = "Node"
2570 }
2571 const enum NewLineKind {
2572 Crlf = "Crlf",
2573 Lf = "Lf"
2574 }
2575 const enum ScriptTarget {
2576 ES3 = "ES3",
2577 ES5 = "ES5",
2578 ES6 = "ES6",
2579 ES2015 = "ES2015",
2580 ES2016 = "ES2016",
2581 ES2017 = "ES2017",
2582 ES2018 = "ES2018",
2583 ES2019 = "ES2019",
2584 ES2020 = "ES2020",
2585 ESNext = "ESNext"
2586 }
2587}
2588declare namespace ts.server.protocol {
2589
2590 interface TextInsertion {
2591 newText: string;
2592 /** The position in newText the caret should point to after the insertion. */
2593 caretOffset: number;
2594 }
2595
2596 interface TodoCommentDescriptor {
2597 text: string;
2598 priority: number;
2599 }
2600
2601 interface TodoComment {
2602 descriptor: TodoCommentDescriptor;
2603 message: string;
2604 position: number;
2605 }
2606
2607 enum OutliningSpanKind {
2608 /** Single or multi-line comments */
2609 Comment = "comment",
2610 /** Sections marked by '// #region' and '// #endregion' comments */
2611 Region = "region",
2612 /** Declarations and expressions */
2613 Code = "code",
2614 /** Contiguous blocks of import declarations */
2615 Imports = "imports"
2616 }
2617
2618 enum HighlightSpanKind {
2619 none = "none",
2620 definition = "definition",
2621 reference = "reference",
2622 writtenReference = "writtenReference"
2623 }
2624
2625 enum ScriptElementKind {
2626 unknown = "",
2627 warning = "warning",
2628 /** predefined type (void) or keyword (class) */
2629 keyword = "keyword",
2630 /** top level script node */
2631 scriptElement = "script",
2632 /** module foo {} */
2633 moduleElement = "module",
2634 /** class X {} */
2635 classElement = "class",
2636 /** var x = class X {} */
2637 localClassElement = "local class",
2638 /** interface Y {} */
2639 interfaceElement = "interface",
2640 /** type T = ... */
2641 typeElement = "type",
2642 /** enum E */
2643 enumElement = "enum",
2644 enumMemberElement = "enum member",
2645 /**
2646 * Inside module and script only
2647 * const v = ..
2648 */
2649 variableElement = "var",
2650 /** Inside function */
2651 localVariableElement = "local var",
2652 /**
2653 * Inside module and script only
2654 * function f() { }
2655 */
2656 functionElement = "function",
2657 /** Inside function */
2658 localFunctionElement = "local function",
2659 /** class X { [public|private]* foo() {} } */
2660 memberFunctionElement = "method",
2661 /** class X { [public|private]* [get|set] foo:number; } */
2662 memberGetAccessorElement = "getter",
2663 memberSetAccessorElement = "setter",
2664 /**
2665 * class X { [public|private]* foo:number; }
2666 * interface Y { foo:number; }
2667 */
2668 memberVariableElement = "property",
2669 /** class X { constructor() { } } */
2670 constructorImplementationElement = "constructor",
2671 /** interface Y { ():number; } */
2672 callSignatureElement = "call",
2673 /** interface Y { []:number; } */
2674 indexSignatureElement = "index",
2675 /** interface Y { new():Y; } */
2676 constructSignatureElement = "construct",
2677 /** function foo(*Y*: string) */
2678 parameterElement = "parameter",
2679 typeParameterElement = "type parameter",
2680 primitiveType = "primitive type",
2681 label = "label",
2682 alias = "alias",
2683 constElement = "const",
2684 letElement = "let",
2685 directory = "directory",
2686 externalModuleName = "external module name",
2687 /**
2688 * <JsxTagName attribute1 attribute2={0} />
2689 */
2690 jsxAttribute = "JSX attribute",
2691 /** String literal */
2692 string = "string"
2693 }
2694
2695 export interface TypeAcquisition {
2696 /**
2697 * @deprecated typingOptions.enableAutoDiscovery
2698 * Use typeAcquisition.enable instead.
2699 */
2700 enableAutoDiscovery?: boolean;
2701 enable?: boolean;
2702 include?: string[];
2703 exclude?: string[];
2704 [option: string]: string[] | boolean | undefined;
2705 }
2706
2707 export interface FileExtensionInfo {
2708 extension: string;
2709 isMixedContent: boolean;
2710 scriptKind?: ScriptKind;
2711 }
2712
2713 export type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]> | PluginImport[] | ProjectReference[] | null | undefined;
2714
2715 interface JSDocTagInfo {
2716 name: string;
2717 text?: string;
2718 }
2719
2720 /**
2721 * Type of objects whose values are all of the same type.
2722 * The `in` and `for-in` operators can *not* be safely used,
2723 * since `Object.prototype` may be modified by outside code.
2724 */
2725 interface MapLike<T> {
2726 [index: string]: T;
2727 }
2728
2729 export interface PluginImport {
2730 name: string;
2731 }
2732
2733 export interface ProjectReference {
2734 /** A normalized path on disk */
2735 path: string;
2736 /** The path as the user originally wrote it */
2737 originalPath?: string;
2738 /** True if the output of this reference should be prepended to the output of this project. Only valid for --outFile compilations */
2739 prepend?: boolean;
2740 /** True if it is intended that this reference form a circularity */
2741 circular?: boolean;
2742 }
2743}
2744declare namespace ts {
2745 // these types are empty stubs for types from services and should not be used directly
2746 export type ScriptKind = never;
2747 export type WatchFileKind = never;
2748 export type WatchDirectoryKind = never;
2749 export type PollingWatchKind = never;
2750 export type IndentStyle = never;
2751 export type JsxEmit = never;
2752 export type ModuleKind = never;
2753 export type ModuleResolutionKind = never;
2754 export type NewLineKind = never;
2755 export type ScriptTarget = never;
2756}
2757import protocol = ts.server.protocol;
2758export = protocol;
2759export as namespace protocol;
\No newline at end of file