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