UNPKG

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