Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid using this at all costs #6

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion denops/aider/aiderCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const aiderCommand = {
async addCurrentFile(denops: Denops): Promise<void> {
const bufnr = await fn.bufnr(denops, "%");
if (await getTerminalBufferNr(denops) === undefined) {
await this.run(denops);
await aiderCommand.run(denops);
}
const bufType = await fn.getbufvar(denops, bufnr, "&buftype");
if (bufType === "terminal") {
Expand Down
20 changes: 10 additions & 10 deletions denops/aider/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const buffer = {
): Promise<void | undefined | boolean> {
const aiderBufnr = await getTerminalBufferNr(denops);
if (aiderBufnr) {
await this.openFloatingWindow(denops, aiderBufnr);
await buffer.openFloatingWindow(denops, aiderBufnr);
return true;
}

Expand All @@ -136,7 +136,7 @@ export const buffer = {
is.Number,
);

await this.openFloatingWindow(
await buffer.openFloatingWindow(
denops,
bufnr,
);
Expand All @@ -149,7 +149,7 @@ export const buffer = {
if (bufnr === undefined) {
return;
}
await this.openFloatingWindow(denops, bufnr);
await buffer.openFloatingWindow(denops, bufnr);

await feedkeys(denops, "G");
await feedkeys(denops, '"qp');
Expand Down Expand Up @@ -213,12 +213,12 @@ export const buffer = {
return;
}

await this.openFloatingWindow(denops, bufnr);
await buffer.openFloatingWindow(denops, bufnr);

const openBufferType = await this.getOpenBufferType(denops);
const openBufferType = await buffer.getOpenBufferType(denops);
openBufferType === "floating"
? await this.sendPromptFromFloatingWindow(denops)
: await this.sendPromptFromSplitWindow(denops);
? await buffer.sendPromptFromFloatingWindow(denops)
: await buffer.sendPromptFromSplitWindow(denops);
},
async sendPrompt(
denops: Denops,
Expand All @@ -229,8 +229,8 @@ export const buffer = {
await denops.cmd("bdelete!");

openBufferType === "floating"
? this.sendPromptFromFloatingWindow(denops)
: this.sendPromptFromSplitWindow(denops);
? buffer.sendPromptFromFloatingWindow(denops)
: buffer.sendPromptFromSplitWindow(denops);

return;
},
Expand Down Expand Up @@ -264,7 +264,7 @@ export const buffer = {
await n.nvim_create_buf(denops, false, true),
is.Number,
);
await this.openFloatingWindow(
await buffer.openFloatingWindow(
denops,
bufnr,
);
Expand Down
4 changes: 2 additions & 2 deletions denops/aider/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ export async function main(denops: Denops): Promise<void> {
}
const prompt = `/add ${path}`;
await v.r.set(denops, "q", prompt);
await this.sendPromptWithInput();
await denops.dispatcher.sendPromptWithInput();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この書き方できるんだ…。
すべてがオブジェクトだからできるのか 🤔

},
async addWeb(url: unknown): Promise<void> {
if (url === "") {
return;
}
const prompt = `/web ${url}`;
await v.r.set(denops, "q", prompt);
await this.sendPromptWithInput();
await denops.dispatcher.sendPromptWithInput();
},
async exit(): Promise<void> {
const bufnr = await getTerminalBufferNr(denops);
Expand Down