561aa6891f
Big bang migration to Deno 🤯
19 lines
493 B
TypeScript
19 lines
493 B
TypeScript
import { matchBefore } from "../../syscall/silverbullet-syscall/editor.ts";
|
|
import { listCommands } from "../../syscall/silverbullet-syscall/system.ts";
|
|
|
|
export async function commandComplete() {
|
|
let prefix = await matchBefore("\\{\\[[^\\]]*");
|
|
if (!prefix) {
|
|
return null;
|
|
}
|
|
let allCommands = await listCommands();
|
|
|
|
return {
|
|
from: prefix.from + 2,
|
|
options: Object.keys(allCommands).map((commandName) => ({
|
|
label: commandName,
|
|
type: "command",
|
|
})),
|
|
};
|
|
}
|