pddl-workspace
Version:
43 lines (42 loc) • 1.87 kB
TypeScript
import { DocumentPositionResolver } from "../DocumentPositionResolver";
import { DomainInfo } from "../DomainInfo";
import { PddlBracketNode } from "../parser";
/** Syntax injector pushes code injections to the `domainInfo`. */
export interface SyntaxInjector {
process(domainInfo: DomainInfo, positionResolver: DocumentPositionResolver): void;
}
export declare abstract class BaseSyntaxInjector implements SyntaxInjector {
abstract process(domainInfo: DomainInfo, positionResolver: DocumentPositionResolver): void;
/**
* Resolves the relative position within/around the `referenceNode`
* @param referenceNode syntax tree node around which the code should be injected
* @param positionResolver document position resolver
* @param options relative position around the reference node
* @returns offset in the document
*/
protected getOffset(referenceNode: PddlBracketNode, positionResolver: DocumentPositionResolver, options: {
position: InjectionPosition;
}): number;
private getOffsetRelativeTo;
}
export declare enum InjectionPosition {
/** Insert in front of the reference node */
OutsideStart = 0,
/** Insert inside the reference token - just after the opening token, e.g. after `:types` */
InsideStart = 1,
/** Insert in front of the closing bracket. */
InsideEnd = 2,
/** Insert after the closing bracket of the reference ndoe. */
OutsideEnd = 3
}
export declare enum RelativePosition {
Before = 0,
After = 1
}
/** Ordered list of syntax injectors. They are processed in the order of insertion into this list. */
export declare class SyntaxInjectors {
private readonly injectors;
constructor(injectors?: SyntaxInjector[]);
process(domainInfo: DomainInfo, positionResolver: DocumentPositionResolver): void;
add(injector: SyntaxInjector): void;
}