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