Skip to content

EditorCode beta ​

Class of @v12-engine/editor

ts
export declare class EditorCode

The game's code, shown and not edited (E2E plan EDF6, decision 3): the files of the game's folder with the definitions found in them, one file read, searched, and opened in the code editor (VS Code stays the editor of code). What the Code panel shows, in code

A part of the editor, as it gives it (editor.code)

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the EditorCode class.

Members ​

definitions ​

ts
definitions(): readonly CodeDefinition[];

The definitions found in the file shown

files ​

ts
files(): readonly CodeFile[];

The files of the game, as load last read them. A signal

hits ​

ts
hits(): CodeHit[];

The lines of the file shown that have every word of the search (not case sensitive; the kit's matchWords): none for no search

line ​

ts
line(): number | undefined;

The line to scroll to and mark in the file shown, from 1. A signal

load ​

ts
load(): Promise<void>;

Reads the list of the game's files again. What cannot be read is said

loaded ​

ts
loaded(): boolean;

Whether load has answered once. A signal

loadScaffolds ​

ts
loadScaffolds(): Promise<void>;

Reads which folders those are

matching ​

ts
matching(): readonly CodeFile[];

The files that match the search (every one with none): by their path, or a definition in them

newWithCode ​

ts
newWithCode(kind: ScaffoldKind, id: string, name?: string, folder?: string): Promise<EditorResult<string>>;

New with code: a stub from the editor's templates written into a folder the project lists (never over a file) and opened in the code editor, and the data side made at once: a unit type or an ability is a new definition of the game's data (editor.data.make, kept by Keep; a game that lets nothing of that kind be changed has the code alone), a mission a mission of the game's campaign file where it has one. An order, a system and a panel are code alone. Done with the file from the project's root, or refused saying why, with nothing made

openInEditor ​

ts
openInEditor(path?: string | undefined, line?: number | undefined): Promise<void>;

Opens the file shown, or path, in the code editor (at a line): the game's folder first. Where there is a project

path ​

ts
path(): string | undefined;

The file shown, by its path from the game's folder. A signal

query ​

ts
query(): string;

The search words. A signal

scaffoldFolders ​

ts
scaffoldFolders(): readonly string[];

The folders the project lets new code be written into (editorFiles({ scaffold })), as last read: none by default. A signal

ts
search(query: string): void;

Searches: the files list narrows to those whose path or definitions say every word, and hits finds the lines of the file shown

show ​

ts
show(path: string, line?: number): Promise<boolean>;

Shows a file of the game, at a line. Whether it could be read (a path out of the game's folder is refused by the dev server)

showDefinition ​

ts
showDefinition(name: string): Promise<boolean>;

Shows where something of the game is defined (id: 'x') in this panel, opened: the first definition of that name. Whether one was found

text ​

ts
text(): string | undefined;

The text of the file shown: none until it is read. A signal