2023-01-02 16:00:42 -05:00
|
|
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
2020-12-07 05:46:39 -05:00
|
|
|
|
|
|
|
// Contains types that can be used to validate and check `99_main_compiler.js`
|
|
|
|
|
2022-11-25 18:29:48 -05:00
|
|
|
import * as _ts from "./dts/typescript";
|
2020-12-07 05:46:39 -05:00
|
|
|
|
|
|
|
declare global {
|
|
|
|
namespace ts {
|
|
|
|
var libs: string[];
|
|
|
|
var libMap: Map<string, string>;
|
2022-05-17 10:59:35 -04:00
|
|
|
var base64encode: (host: ts.CompilerHost, input: string) => string;
|
2022-05-31 20:19:18 -04:00
|
|
|
var normalizePath: (path: string) => string;
|
2020-12-07 05:46:39 -05:00
|
|
|
interface SourceFile {
|
|
|
|
version?: string;
|
2022-10-21 11:20:18 -04:00
|
|
|
fileName: string;
|
2020-12-07 05:46:39 -05:00
|
|
|
}
|
|
|
|
|
2022-05-31 20:19:18 -04:00
|
|
|
interface CompilerHost {
|
|
|
|
base64encode?: (data: any) => string;
|
|
|
|
}
|
|
|
|
|
2020-12-07 05:46:39 -05:00
|
|
|
interface Performance {
|
|
|
|
enable(): void;
|
|
|
|
getDuration(value: string): number;
|
|
|
|
}
|
|
|
|
|
|
|
|
var performance: Performance;
|
2022-10-21 11:20:18 -04:00
|
|
|
|
|
|
|
namespace deno {
|
|
|
|
function setIsNodeSourceFileCallback(
|
|
|
|
callback: (sourceFile: SourceFile) => boolean,
|
|
|
|
);
|
2023-01-24 09:05:54 -05:00
|
|
|
function setNodeBuiltInModuleNames(names: string[]);
|
2022-10-21 11:20:18 -04:00
|
|
|
}
|
2020-12-07 05:46:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace ts {
|
|
|
|
export = _ts;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Object {
|
|
|
|
// deno-lint-ignore no-explicit-any
|
|
|
|
__proto__: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface DenoCore {
|
2022-05-31 20:19:18 -04:00
|
|
|
encode(value: string): Uint8Array;
|
2020-12-07 05:46:39 -05:00
|
|
|
// deno-lint-ignore no-explicit-any
|
2022-08-11 09:56:56 -04:00
|
|
|
ops: Record<string, (...args: unknown[]) => any>;
|
|
|
|
print(msg: string, stderr: boolean): void;
|
2021-02-25 14:06:06 -05:00
|
|
|
registerErrorClass(
|
|
|
|
name: string,
|
|
|
|
Ctor: typeof Error,
|
|
|
|
// deno-lint-ignore no-explicit-any
|
|
|
|
...args: any[]
|
|
|
|
): void;
|
2020-12-07 05:46:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type LanguageServerRequest =
|
2022-07-11 19:35:18 -04:00
|
|
|
| Restart
|
2020-12-07 05:46:39 -05:00
|
|
|
| ConfigureRequest
|
2021-01-31 22:30:41 -05:00
|
|
|
| FindRenameLocationsRequest
|
2022-04-25 11:23:24 -04:00
|
|
|
| GetAssets
|
2021-08-05 21:46:32 -04:00
|
|
|
| GetApplicableRefactors
|
|
|
|
| GetEditsForRefactor
|
2021-02-04 13:53:02 -05:00
|
|
|
| GetCodeFixes
|
|
|
|
| GetCombinedCodeFix
|
2021-03-15 18:01:41 -04:00
|
|
|
| GetCompletionDetails
|
2021-01-31 22:30:41 -05:00
|
|
|
| GetCompletionsRequest
|
|
|
|
| GetDefinitionRequest
|
2020-12-29 20:46:58 -05:00
|
|
|
| GetDiagnosticsRequest
|
2020-12-07 05:46:39 -05:00
|
|
|
| GetDocumentHighlightsRequest
|
2021-04-19 21:26:36 -04:00
|
|
|
| GetEncodedSemanticClassifications
|
2021-01-12 16:53:27 -05:00
|
|
|
| GetImplementationRequest
|
2021-11-22 19:08:56 -05:00
|
|
|
| GetNavigateToItems
|
2021-01-31 22:30:41 -05:00
|
|
|
| GetNavigationTree
|
2021-04-02 02:21:07 -04:00
|
|
|
| GetOutliningSpans
|
2021-01-31 22:30:41 -05:00
|
|
|
| GetQuickInfoRequest
|
2021-02-04 13:53:02 -05:00
|
|
|
| GetReferencesRequest
|
2021-02-15 21:34:09 -05:00
|
|
|
| GetSignatureHelpItemsRequest
|
2021-03-23 19:33:25 -04:00
|
|
|
| GetSmartSelectionRange
|
2021-04-19 01:11:26 -04:00
|
|
|
| GetSupportedCodeFixes
|
2021-11-22 19:09:19 -05:00
|
|
|
| GetTypeDefinitionRequest
|
2021-04-19 01:11:26 -04:00
|
|
|
| PrepareCallHierarchy
|
|
|
|
| ProvideCallHierarchyIncomingCalls
|
2022-10-15 22:39:43 -04:00
|
|
|
| ProvideCallHierarchyOutgoingCalls
|
|
|
|
| ProvideInlayHints;
|
2020-12-07 05:46:39 -05:00
|
|
|
|
|
|
|
interface BaseLanguageServerRequest {
|
|
|
|
id: number;
|
|
|
|
method: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ConfigureRequest extends BaseLanguageServerRequest {
|
|
|
|
method: "configure";
|
|
|
|
// deno-lint-ignore no-explicit-any
|
|
|
|
compilerOptions: Record<string, any>;
|
|
|
|
}
|
|
|
|
|
2021-01-31 22:30:41 -05:00
|
|
|
interface FindRenameLocationsRequest extends BaseLanguageServerRequest {
|
|
|
|
method: "findRenameLocations";
|
|
|
|
specifier: string;
|
|
|
|
position: number;
|
|
|
|
findInStrings: boolean;
|
|
|
|
findInComments: boolean;
|
|
|
|
providePrefixAndSuffixTextForRename: boolean;
|
|
|
|
}
|
|
|
|
|
2022-04-25 11:23:24 -04:00
|
|
|
interface GetAssets extends BaseLanguageServerRequest {
|
|
|
|
method: "getAssets";
|
2020-12-15 14:34:39 -05:00
|
|
|
}
|
|
|
|
|
2021-08-05 21:46:32 -04:00
|
|
|
interface GetApplicableRefactors extends BaseLanguageServerRequest {
|
|
|
|
method: "getApplicableRefactors";
|
|
|
|
specifier: string;
|
|
|
|
range: ts.TextRange;
|
|
|
|
kind: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface GetEditsForRefactor extends BaseLanguageServerRequest {
|
|
|
|
method: "getEditsForRefactor";
|
|
|
|
specifier: string;
|
|
|
|
range: ts.TextRange;
|
|
|
|
refactorName: string;
|
|
|
|
actionName: string;
|
|
|
|
}
|
|
|
|
|
2021-02-04 13:53:02 -05:00
|
|
|
interface GetCodeFixes extends BaseLanguageServerRequest {
|
|
|
|
method: "getCodeFixes";
|
|
|
|
specifier: string;
|
|
|
|
startPosition: number;
|
|
|
|
endPosition: number;
|
|
|
|
errorCodes: string[];
|
|
|
|
}
|
|
|
|
|
|
|
|
interface GetCombinedCodeFix extends BaseLanguageServerRequest {
|
|
|
|
method: "getCombinedCodeFix";
|
|
|
|
specifier: string;
|
|
|
|
// deno-lint-ignore ban-types
|
|
|
|
fixId: {};
|
|
|
|
}
|
|
|
|
|
2021-03-15 18:01:41 -04:00
|
|
|
interface GetCompletionDetails extends BaseLanguageServerRequest {
|
|
|
|
method: "getCompletionDetails";
|
|
|
|
args: {
|
|
|
|
specifier: string;
|
|
|
|
position: number;
|
|
|
|
name: string;
|
|
|
|
source?: string;
|
2022-07-11 19:35:18 -04:00
|
|
|
preferences?: ts.UserPreferences;
|
|
|
|
data?: ts.CompletionEntryData;
|
2021-03-15 18:01:41 -04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-01-31 22:30:41 -05:00
|
|
|
interface GetCompletionsRequest extends BaseLanguageServerRequest {
|
|
|
|
method: "getCompletions";
|
|
|
|
specifier: string;
|
|
|
|
position: number;
|
2021-03-15 18:01:41 -04:00
|
|
|
preferences: ts.GetCompletionsAtPositionOptions;
|
2021-01-31 22:30:41 -05:00
|
|
|
}
|
|
|
|
|
2020-12-29 20:46:58 -05:00
|
|
|
interface GetDiagnosticsRequest extends BaseLanguageServerRequest {
|
|
|
|
method: "getDiagnostics";
|
2021-01-22 05:03:16 -05:00
|
|
|
specifiers: string[];
|
2020-12-07 05:46:39 -05:00
|
|
|
}
|
|
|
|
|
2021-01-31 22:30:41 -05:00
|
|
|
interface GetDefinitionRequest extends BaseLanguageServerRequest {
|
|
|
|
method: "getDefinition";
|
2020-12-07 05:46:39 -05:00
|
|
|
specifier: string;
|
|
|
|
position: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface GetDocumentHighlightsRequest extends BaseLanguageServerRequest {
|
|
|
|
method: "getDocumentHighlights";
|
|
|
|
specifier: string;
|
|
|
|
position: number;
|
|
|
|
filesToSearch: string[];
|
|
|
|
}
|
|
|
|
|
2021-04-19 21:26:36 -04:00
|
|
|
interface GetEncodedSemanticClassifications
|
|
|
|
extends BaseLanguageServerRequest {
|
|
|
|
method: "getEncodedSemanticClassifications";
|
|
|
|
specifier: string;
|
|
|
|
span: ts.TextSpan;
|
|
|
|
}
|
|
|
|
|
2021-01-31 22:30:41 -05:00
|
|
|
interface GetImplementationRequest extends BaseLanguageServerRequest {
|
|
|
|
method: "getImplementation";
|
2020-12-07 05:46:39 -05:00
|
|
|
specifier: string;
|
|
|
|
position: number;
|
|
|
|
}
|
|
|
|
|
2021-11-22 19:08:56 -05:00
|
|
|
interface GetNavigateToItems extends BaseLanguageServerRequest {
|
|
|
|
method: "getNavigateToItems";
|
|
|
|
search: string;
|
|
|
|
maxResultCount?: number;
|
|
|
|
fileName?: string;
|
|
|
|
}
|
|
|
|
|
2021-01-31 22:30:41 -05:00
|
|
|
interface GetNavigationTree extends BaseLanguageServerRequest {
|
|
|
|
method: "getNavigationTree";
|
2020-12-07 05:46:39 -05:00
|
|
|
specifier: string;
|
|
|
|
}
|
2020-12-08 05:36:13 -05:00
|
|
|
|
2021-04-02 02:21:07 -04:00
|
|
|
interface GetOutliningSpans extends BaseLanguageServerRequest {
|
|
|
|
method: "getOutliningSpans";
|
|
|
|
specifier: string;
|
|
|
|
}
|
|
|
|
|
2021-01-31 22:30:41 -05:00
|
|
|
interface GetQuickInfoRequest extends BaseLanguageServerRequest {
|
|
|
|
method: "getQuickInfo";
|
2021-01-12 16:53:27 -05:00
|
|
|
specifier: string;
|
|
|
|
position: number;
|
|
|
|
}
|
|
|
|
|
2021-01-31 22:30:41 -05:00
|
|
|
interface GetReferencesRequest extends BaseLanguageServerRequest {
|
|
|
|
method: "getReferences";
|
2020-12-29 19:58:20 -05:00
|
|
|
specifier: string;
|
|
|
|
position: number;
|
|
|
|
}
|
2021-02-04 13:53:02 -05:00
|
|
|
|
2021-02-15 21:34:09 -05:00
|
|
|
interface GetSignatureHelpItemsRequest extends BaseLanguageServerRequest {
|
|
|
|
method: "getSignatureHelpItems";
|
|
|
|
specifier: string;
|
|
|
|
position: number;
|
|
|
|
options: ts.SignatureHelpItemsOptions;
|
|
|
|
}
|
|
|
|
|
2021-03-23 19:33:25 -04:00
|
|
|
interface GetSmartSelectionRange extends BaseLanguageServerRequest {
|
|
|
|
method: "getSmartSelectionRange";
|
|
|
|
specifier: string;
|
|
|
|
position: number;
|
|
|
|
}
|
|
|
|
|
2021-02-04 13:53:02 -05:00
|
|
|
interface GetSupportedCodeFixes extends BaseLanguageServerRequest {
|
|
|
|
method: "getSupportedCodeFixes";
|
|
|
|
}
|
2021-04-19 01:11:26 -04:00
|
|
|
|
2021-11-22 19:09:19 -05:00
|
|
|
interface GetTypeDefinitionRequest extends BaseLanguageServerRequest {
|
|
|
|
method: "getTypeDefinition";
|
|
|
|
specifier: string;
|
|
|
|
position: number;
|
|
|
|
}
|
|
|
|
|
2021-04-19 01:11:26 -04:00
|
|
|
interface PrepareCallHierarchy extends BaseLanguageServerRequest {
|
|
|
|
method: "prepareCallHierarchy";
|
|
|
|
specifier: string;
|
|
|
|
position: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ProvideCallHierarchyIncomingCalls
|
|
|
|
extends BaseLanguageServerRequest {
|
|
|
|
method: "provideCallHierarchyIncomingCalls";
|
|
|
|
specifier: string;
|
|
|
|
position: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ProvideCallHierarchyOutgoingCalls
|
|
|
|
extends BaseLanguageServerRequest {
|
|
|
|
method: "provideCallHierarchyOutgoingCalls";
|
|
|
|
specifier: string;
|
|
|
|
position: number;
|
|
|
|
}
|
2022-06-27 13:43:43 -04:00
|
|
|
|
2022-10-15 22:39:43 -04:00
|
|
|
interface ProvideInlayHints extends BaseLanguageServerRequest {
|
|
|
|
method: "provideInlayHints";
|
|
|
|
specifier: string;
|
|
|
|
span: ts.TextSpan;
|
|
|
|
preferences?: ts.UserPreferences;
|
|
|
|
}
|
|
|
|
|
2022-07-11 19:35:18 -04:00
|
|
|
interface Restart extends BaseLanguageServerRequest {
|
2022-06-27 13:43:43 -04:00
|
|
|
method: "restart";
|
|
|
|
}
|
2020-12-07 05:46:39 -05:00
|
|
|
}
|