source: trip-planner-front/node_modules/typescript/lib/protocol.d.ts@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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