From a5e471a0c346e24697baec7b41edc47488716f19 Mon Sep 17 00:00:00 2001 From: kamecha Date: Wed, 29 Nov 2023 01:44:47 +0900 Subject: [PATCH 1/4] =?UTF-8?q?ddu=E3=81=AE=E3=82=BD=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E3=81=8B=E3=82=89=E3=82=82api=E3=81=AEtokenFile=E3=81=AE?= =?UTF-8?q?=E3=83=91=E3=82=B9=E8=A8=AD=E5=AE=9A=E3=82=92=E8=A1=8C=E3=81=86?= =?UTF-8?q?=E3=82=88=E3=81=86=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- denops/@ddu-sources/channel.ts | 16 +++++++++++++++- denops/@ddu-sources/channel_rec.ts | 9 ++++++++- denops/traqvim/deps.ts | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/denops/@ddu-sources/channel.ts b/denops/@ddu-sources/channel.ts index ca8a98a..be6c188 100644 --- a/denops/@ddu-sources/channel.ts +++ b/denops/@ddu-sources/channel.ts @@ -1,12 +1,26 @@ -import { dduVim, Denops, helper } from "../traqvim/deps.ts"; +import { + dduVim, + dduVimSource, + Denops, + ensureString, + helper, + vars, +} from "../traqvim/deps.ts"; import { ActionData } from "../@ddu-kinds/channel.ts"; import { channelsRecursive, searchChannelUUID } from "../traqvim/model.ts"; import { Channel } from "../traqvim/type.d.ts"; +import { api } from "../traqvim/api.ts"; type Params = Record; export class Source extends dduVim.BaseSource { kind = "channel"; + async onInit(args: dduVimSource.OnInitArguments): Promise { + const path = await vars.globals.get(args.denops, "traqvim#token_file_path"); + ensureString(path); + api.tokenFilePath = path; + return Promise.resolve(); + } override gather(args: { denops: Denops; sourceOptions: dduVim.SourceOptions; diff --git a/denops/@ddu-sources/channel_rec.ts b/denops/@ddu-sources/channel_rec.ts index f939420..8d54701 100644 --- a/denops/@ddu-sources/channel_rec.ts +++ b/denops/@ddu-sources/channel_rec.ts @@ -1,7 +1,8 @@ -import { dduVim, Denops } from "../traqvim/deps.ts"; +import { dduVim, dduVimSource, Denops, ensureString, vars } from "../traqvim/deps.ts"; import { ActionData } from "../@ddu-kinds/channel.ts"; import { channelsRecursive, getUnreadChannels } from "../traqvim/model.ts"; import { Channel, UnreadChannel } from "../traqvim/type.d.ts"; +import { api } from "../traqvim/api.ts"; type Params = { type: "all" | "unread"; @@ -9,6 +10,12 @@ type Params = { export class Source extends dduVim.BaseSource { kind = "channel"; + async onInit(args: dduVimSource.OnInitArguments): Promise { + const path = await vars.globals.get(args.denops, "traqvim#token_file_path"); + ensureString(path); + api.tokenFilePath = path; + return Promise.resolve(); + } gather(args: { denops: Denops; sourceParams: Params; diff --git a/denops/traqvim/deps.ts b/denops/traqvim/deps.ts index 90cb94c..a8c8296 100644 --- a/denops/traqvim/deps.ts +++ b/denops/traqvim/deps.ts @@ -13,4 +13,5 @@ export * as vars from "https://deno.land/x/denops_std@v4.0.0/variable/mod.ts"; export * as helper from "https://deno.land/x/denops_std@v4.0.0/helper/mod.ts"; export * as ddcVim from "https://deno.land/x/ddc_vim@v3.4.0/types.ts"; export * as dduVim from "https://deno.land/x/ddu_vim@v1.13.0/types.ts"; +export * as dduVimSource from "https://deno.land/x/ddu_vim@v1.13.0/base/source.ts"; export * as traq from "https://esm.sh/@traptitech/traq@3.11.0-3"; From 0918b4c11b0623b9e2c7634a070375ca2a3130fa Mon Sep 17 00:00:00 2001 From: kamecha Date: Wed, 29 Nov 2023 01:51:44 +0900 Subject: [PATCH 2/4] format --- denops/@ddu-sources/channel_rec.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/denops/@ddu-sources/channel_rec.ts b/denops/@ddu-sources/channel_rec.ts index 8d54701..ba71a01 100644 --- a/denops/@ddu-sources/channel_rec.ts +++ b/denops/@ddu-sources/channel_rec.ts @@ -1,4 +1,10 @@ -import { dduVim, dduVimSource, Denops, ensureString, vars } from "../traqvim/deps.ts"; +import { + dduVim, + dduVimSource, + Denops, + ensureString, + vars, +} from "../traqvim/deps.ts"; import { ActionData } from "../@ddu-kinds/channel.ts"; import { channelsRecursive, getUnreadChannels } from "../traqvim/model.ts"; import { Channel, UnreadChannel } from "../traqvim/type.d.ts"; From 3a9b4d6abdb5c5abcc4b8b8179e511b282242eea Mon Sep 17 00:00:00 2001 From: kamecha Date: Wed, 29 Nov 2023 02:11:44 +0900 Subject: [PATCH 3/4] =?UTF-8?q?ddc=E3=81=A7=E3=82=82api=E3=81=AEtokenFileP?= =?UTF-8?q?ath=E3=81=AE=E5=88=9D=E6=9C=9F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- denops/@ddc-sources/stamp.ts | 10 +++++++++- denops/traqvim/deps.ts | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/denops/@ddc-sources/stamp.ts b/denops/@ddc-sources/stamp.ts index 989f0ed..c548a41 100644 --- a/denops/@ddc-sources/stamp.ts +++ b/denops/@ddc-sources/stamp.ts @@ -1,10 +1,18 @@ -import { ddcVim, Denops, traq } from "../traqvim/deps.ts"; +import { ddcVim, ddcVimSource, Denops, ensureString, traq, vars } from "../traqvim/deps.ts"; import { getStamps } from "../traqvim/model.ts"; +import { api } from "../traqvim/api.ts"; type Params = Record; export class Source extends ddcVim.BaseSource { + async onInit(args: ddcVimSource.OnInitArguments): Promise { + const path = await vars.globals.get(args.denops, "traqvim#token_file_path"); + ensureString(path); + api.tokenFilePath = path; + return Promise.resolve(); + } + override async gather(): Promise { const stamps: traq.Stamp[] = await getStamps(); return stamps diff --git a/denops/traqvim/deps.ts b/denops/traqvim/deps.ts index a8c8296..c484380 100644 --- a/denops/traqvim/deps.ts +++ b/denops/traqvim/deps.ts @@ -12,6 +12,7 @@ export * as fn from "https://deno.land/x/denops_std@v4.0.0/function/mod.ts"; export * as vars from "https://deno.land/x/denops_std@v4.0.0/variable/mod.ts"; export * as helper from "https://deno.land/x/denops_std@v4.0.0/helper/mod.ts"; export * as ddcVim from "https://deno.land/x/ddc_vim@v3.4.0/types.ts"; +export * as ddcVimSource from "https://deno.land/x/ddc_vim@v3.4.0/base/source.ts"; export * as dduVim from "https://deno.land/x/ddu_vim@v1.13.0/types.ts"; export * as dduVimSource from "https://deno.land/x/ddu_vim@v1.13.0/base/source.ts"; export * as traq from "https://esm.sh/@traptitech/traq@3.11.0-3"; From 4d4fb4823891f6bd4c8318662579fb26d9445e22 Mon Sep 17 00:00:00 2001 From: kamecha Date: Wed, 29 Nov 2023 02:13:09 +0900 Subject: [PATCH 4/4] format --- denops/@ddc-sources/stamp.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/denops/@ddc-sources/stamp.ts b/denops/@ddc-sources/stamp.ts index c548a41..388e8f1 100644 --- a/denops/@ddc-sources/stamp.ts +++ b/denops/@ddc-sources/stamp.ts @@ -1,4 +1,11 @@ -import { ddcVim, ddcVimSource, Denops, ensureString, traq, vars } from "../traqvim/deps.ts"; +import { + ddcVim, + ddcVimSource, + Denops, + ensureString, + traq, + vars, +} from "../traqvim/deps.ts"; import { getStamps } from "../traqvim/model.ts"; import { api } from "../traqvim/api.ts";