mirror of
https://github.com/duhanbalci/dexpr.git
synced 2026-07-02 00:29:15 +00:00
initial commit
This commit is contained in:
61
editor/dist/index.d.ts
vendored
Normal file
61
editor/dist/index.d.ts
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
import { Extension } from '@codemirror/state';
|
||||
import { Completion } from '@codemirror/autocomplete';
|
||||
import { LRLanguage, HighlightStyle } from '@codemirror/language';
|
||||
|
||||
type DexprType = "String" | "Number" | "Boolean" | "NumberList" | "StringList" | "Object";
|
||||
interface FunctionInfo {
|
||||
name: string;
|
||||
signature: string;
|
||||
doc?: string;
|
||||
}
|
||||
interface MethodInfo {
|
||||
name: string;
|
||||
signature: string;
|
||||
doc?: string;
|
||||
}
|
||||
interface FieldInfo {
|
||||
name: string;
|
||||
type: DexprType;
|
||||
}
|
||||
interface VariableInfo {
|
||||
name: string;
|
||||
type: DexprType;
|
||||
doc?: string;
|
||||
fields?: FieldInfo[];
|
||||
}
|
||||
/**
|
||||
* Language metadata — generated by Rust `LanguageInfo::to_json()`,
|
||||
* extended with host-registered functions/methods/variables.
|
||||
*/
|
||||
interface DexprLanguageInfo {
|
||||
functions: FunctionInfo[];
|
||||
methods: Partial<Record<DexprType, MethodInfo[]>>;
|
||||
variables?: VariableInfo[];
|
||||
}
|
||||
declare const KEYWORDS: Completion[];
|
||||
declare function dexprCompletion(info: DexprLanguageInfo): Extension;
|
||||
|
||||
declare const dexprLanguage: LRLanguage;
|
||||
|
||||
declare const dexprHighlightStyle: HighlightStyle;
|
||||
declare function dexprHighlighting(): Extension;
|
||||
|
||||
interface DexprConfig extends DexprLanguageInfo {
|
||||
/** Include default syntax highlighting theme (default: true) */
|
||||
highlighting?: boolean;
|
||||
}
|
||||
/**
|
||||
* All-in-one dexpr language support for CodeMirror 6.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* import { dexpr } from "codemirror-lang-dexpr";
|
||||
*
|
||||
* // languageInfo comes from Rust's LanguageInfo::to_json()
|
||||
* // extended with host-registered functions/methods/variables
|
||||
* const extensions = [basicSetup, dexpr(languageInfo)];
|
||||
* ```
|
||||
*/
|
||||
declare function dexpr(config: DexprConfig): Extension;
|
||||
|
||||
export { type DexprConfig, type DexprLanguageInfo, type DexprType, type FieldInfo, type FunctionInfo, KEYWORDS, type MethodInfo, type VariableInfo, dexpr, dexprCompletion, dexprHighlightStyle, dexprHighlighting, dexprLanguage };
|
||||
Reference in New Issue
Block a user