1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 06:40:05 +08:00
SpaceVim/bundle/dein.vim/denops/@ddu-sources/dein.ts
2022-06-15 23:59:27 +08:00

47 lines
991 B
TypeScript
Vendored

import {
BaseSource,
Item,
} from "https://deno.land/x/ddu_vim@v0.8.0/types.ts";
import { Denops } from "https://deno.land/x/ddu_vim@v0.8.0/deps.ts";
import { ActionData } from "https://deno.land/x/ddu_kind_file@v0.2.0/file.ts";
type Params = Record<string, never>;
type Dein = {
name: string;
path: string;
};
export class Source extends BaseSource<Params> {
kind = "file";
gather(args: {
denops: Denops;
sourceParams: Params;
}): ReadableStream<Item<ActionData>[]> {
return new ReadableStream({
async start(controller) {
const deins = Object.values(
await args.denops.call("dein#get") as Record<string, Dein>,
);
const items = deins.map((dein) => {
return {
word: dein.name,
action: {
path: dein.path,
},
};
});
controller.enqueue(items);
controller.close();
},
});
}
params(): Params {
return {};
}
}