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