feat(lsp-api): Fix interface definition [LNG-298] (#1027)

* Fix interface definition

* Fix comment
This commit is contained in:
InversionSpaces 2023-12-19 17:01:34 +01:00 committed by GitHub
parent 33a2ca87e0
commit 5bc01a9c02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,52 +1,65 @@
export interface TokenLocation { export interface TokenLocation {
name: string, name: string;
startLine: number, startLine: number;
startCol: number, startCol: number;
endLine: number, endLine: number;
endCol: number endCol: number;
} }
export interface TokenInfo { export interface TokenInfo {
location: TokenLocation, location: TokenLocation;
type: string type: string;
} }
export interface TokenLink { export interface TokenLink {
current: TokenLocation, current: TokenLocation;
definition: TokenLocation definition: TokenLocation;
} }
export interface TokenImport { export interface TokenImport {
current: TokenLocation, current: TokenLocation;
path: string path: string;
} }
export interface ErrorInfo { export interface ErrorInfo {
infoType: "error", infoType: "error";
start: number, start: number;
end: number, end: number;
message: string, message: string;
location: string | null location: string | null;
} }
export interface WarningInfo { export interface WarningInfo {
infoType: "warning", infoType: "warning";
start: number, start: number;
end: number, end: number;
message: string, message: string;
location: string | null location: string | null;
} }
export interface CompilationResult { export interface CompilationResult {
errors: ErrorInfo[], errors: ErrorInfo[];
warnings: WarningInfo[], warnings: WarningInfo[];
locations: TokenLink[], locations: TokenLink[];
importLocations: TokenImport[], importLocations: TokenImport[];
tokens: TokenInfo[] tokens: TokenInfo[];
} }
/*
* Imports configuration for the compiler.
* Structure:
* {
* "<compiled-path-prefix-1>": {
* "<import-path-prefix-1>": ["<import-path-1>", "<import-path-2>"],
* ...
* }
* ...
* }
*/
export type Imports = Record<string, Record<string, string[]>>;
export class Compiler { export class Compiler {
compile(path: string, imports: string[]): Promise<CompilationResult>; compile(path: string, imports: Imports): Promise<CompilationResult>;
} }
export var AquaLSP: Compiler; export var AquaLSP: Compiler;