Skip to content

Commit

Permalink
Update: ハードコードしていたtomlファイル読み込みをforで処理する
Browse files Browse the repository at this point in the history
  • Loading branch information
yasunori0418 committed Dec 28, 2023
1 parent f7458c2 commit b24451c
Showing 1 changed file with 13 additions and 48 deletions.
61 changes: 13 additions & 48 deletions config/dpp/dpp/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,54 +56,19 @@ export class Config extends BaseConfig {

const tomlDir: string = await vars.globals.get(denops, "toml_dir");
const tomls: Toml[] = [];
tomls.push(
await dpp.extAction(denops, context, options, "toml", "load", {
path: `${tomlDir}/dpp.toml`,
options: {
lazy: false,
},
}) as Toml,
);
tomls.push(
await dpp.extAction(denops, context, options, "toml", "load", {
path: `${tomlDir}/no_lazy.toml`,
options: {
lazy: false,
},
}) as Toml,
);
tomls.push(
await dpp.extAction(denops, context, options, "toml", "load", {
path: `${tomlDir}/treesitter.toml`,
options: {
lazy: true,
},
}) as Toml,
);
tomls.push(
await dpp.extAction(denops, context, options, "toml", "load", {
path: `${tomlDir}/tools.toml`,
options: {
lazy: true,
},
}) as Toml,
);
tomls.push(
await dpp.extAction(denops, context, options, "toml", "load", {
path: `${tomlDir}/denops.toml`,
options: {
lazy: true,
},
}) as Toml,
);
tomls.push(
await dpp.extAction(denops, context, options, "toml", "load", {
path: `${tomlDir}/ddu.toml`,
options: {
lazy: true,
},
}) as Toml,
);

for (const tomlFile of Deno.readDirSync(tomlDir)) {
if (typeof tomlFile.name === "undefined") continue;
const isLazy = !["dpp.toml", "no_lazy.toml"].includes(tomlFile.name);
tomls.push(
await dpp.extAction(denops, context, options, "toml", "load", {
path: `${tomlDir}/${tomlFile.name}`,
options: {
lazy: isLazy,
},
}) as Toml,
);
}

const recordPlugins: Record<string, Plugin> = {};
const ftplugins: Record<string, string> = {};
Expand Down

0 comments on commit b24451c

Please sign in to comment.