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