Skip to content

Commit

Permalink
Add low level API; setDirect
Browse files Browse the repository at this point in the history
  • Loading branch information
uga-rosa committed Feb 4, 2024
1 parent 26c6cd9 commit 6ce4fb7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions denops/denippet/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,21 @@ export function main(denops: Denops): void {
}
},

setDirect(prefixU: unknown, bodyU: unknown, filetypesU: unknown): void {
const prefix = u.ensure(prefixU, is.ArrayOf(is.String));
const body = u.ensure(bodyU, is.String);
const filetypes = u.ensure(filetypesU, is.ArrayOf(is.String));
const snippet: NormalizedSnippet = {
id: loader.getId(),
filetypes,
prefix,
prefix_regexp: [],
body,
description: "",
};
loader.set([snippet]);
},

async expandable(): Promise<boolean> {
const { body } = await searchSnippet(loader);
return body != null;
Expand Down

0 comments on commit 6ce4fb7

Please sign in to comment.