@arkts/language-plugin
Version:
ArkTS Volar Language Plugin.
50 lines (49 loc) • 2.29 kB
text/typescript
import { LanguagePlugin } from "@volar/language-core";
import { TsmLanguagePlugin, TsmVirtualCode } from "ts-macro";
import * as ts from "typescript";
import * as ets from "ohos-typescript";
import { URI } from "vscode-uri";
//#region src/ets-code.d.ts
declare class ETSVirtualCode extends TsmVirtualCode {
readonly filePath: string;
constructor(filePath: string, sourceFile: ts.SourceFile, languageId: string, plugins: TsmLanguagePlugin[]);
}
type ETSMacroPlugin = Omit<TsmLanguagePlugin, "resolveVirtualCode"> & {
resolveVirtualCode?(virtualCode: ETSVirtualCode): void;
};
//#endregion
//#region src/$$this-fixer-plugin.d.ts
declare function $$thisFixerPlugin(): ETSMacroPlugin;
//#endregion
//#region src/es-object-plugin.d.ts
declare function ESObjectPlugin(): ETSMacroPlugin;
//#endregion
//#region src/language-plugin.d.ts
interface ETSLanguagePluginOptions {
/**
* Paths excluded from virtual code. It is very useful when you want to disable files in the `openharmony` & `hms` sdk.
*/
excludePaths?: string[];
/**
* The path to the `tsdk`.
*
* Declaration files located within the `tsdk`, such as type declarations in the `lib.dom.d.ts`, are
* incompatible with the `openharmony` & `hms` sdk and can interfere with it. A series of diagnostics
* should be specified for the `tsdk` path to eliminate incompatibility.
*/
tsdk?: string;
}
/**
* This {@linkcode ETSLanguagePlugin} is used to create the virtual code for the ETS and TS files.
*
* It supports the typescript-plugin-side & language-server-side.
*
* @see Structure of the virtual code: https://github.com/ohosvscode/arkTS/issues/36#issuecomment-2977236063
* @param tsOrEts If passed {@linkcode ets} means current mode is language-server-side, otherwise is typescript-plugin-side.
* @param options - The options for the plugin. See: {@linkcode ETSLanguagePluginOptions}
*/
declare function ETSLanguagePlugin(tsOrEts: typeof ts, options?: ETSLanguagePluginOptions): LanguagePlugin<URI | string>;
declare function ETSLanguagePlugin(tsOrEts: typeof ets, options?: ETSLanguagePluginOptions): LanguagePlugin<URI | string>;
//#endregion
export { $$thisFixerPlugin, ESObjectPlugin, ETSLanguagePlugin, type ETSLanguagePluginOptions, type ETSMacroPlugin, ETSVirtualCode };
//# sourceMappingURL=index.d.cts.map