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