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

autocmd User AiderOpen #10

Merged
merged 7 commits into from
Sep 10, 2024
Merged

autocmd User AiderOpen #10

merged 7 commits into from
Sep 10, 2024

Conversation

tsukimizake
Copy link
Contributor

@tsukimizake tsukimizake commented Sep 10, 2024

  • Aiderバッファを開くときにUser AiderOpen autocmdを射出するようになります 🐕
  • これを利用したkeymap設定方法をREADMEに追加します
  • floatingのデフォルトkeymapは思い切って消してしまっています(異論あればrevertします)
  • 各bufferコマンドの後に1回だけautocmdを射出しようとするとsendPromptFromFloatingWindowなどのprivateであるべき関数がbuffer内にあってexportされているのがとても邪魔だったので外に出しています
    • 見た目差分多いですが cedbd36 でのこのリファクタ以外はemitが増えてkeymapが消えただけです

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced new configuration options for the Aider plugin, enhancing user experience with key mappings and terminal interactions.
    • Added utility functions to improve buffer type checks, streamlining the interaction with Aider buffers.
  • Bug Fixes

    • Resolved issues related to window positioning and display settings for the Aider plugin.
  • Documentation

    • Updated the README.md to reflect new configuration settings and usage instructions for the Aider plugin.

Copy link
Contributor

coderabbitai bot commented Sep 10, 2024

Walkthrough

The changes introduce enhancements to the Aider plugin configuration in both Vimscript and Lua formats, adding new settings for key mappings and window dimensions. The buffer.ts file has been refactored to improve buffer management, including new utility functions for checking buffer types. The aiderCommand.ts file has been updated to reflect a modular structure by accessing functions through the buffer object. Overall, the modifications streamline the plugin's functionality and improve its organization.

Changes

Files Change Summary
README.md Added new configuration settings for Aider plugin, including augroup, autocmd, and key mappings in both Vimscript and Lua formats.
denops/aider/aiderCommand.ts Modified import statements and changed the access method for checkIfTerminalBuffer, now a method of the buffer object.
denops/aider/buffer.ts Redefined openFloatingWindow, restructured exitAiderBuffer, added checkIfAiderBuffer and checkIfTerminalBuffer, and enhanced event handling.
denops/aider/utils.ts Updated import and invocation of checkIfAiderBuffer to reference it as a method of the buffer object.

Possibly related PRs

🐰 In the code where rabbits hop,
New settings bloom and never stop.
With buffers checked and windows bright,
Aider's charm is pure delight!
So let us code and play all day,
In Neovim's world, we dance and sway! 🌼

Tip

Announcements
  • The review status is no longer posted as a separate comment when there are no actionable or nitpick comments. In such cases, the review status is included in the walkthrough comment.
  • We have updated our review workflow to use the Anthropic's Claude family of models. Please share any feedback in the discussion post on our Discord.
  • Possibly related PRs: Walkthrough comment now includes a list of potentially related PRs to help you recall past context. Please share any feedback in the discussion post on our Discord.
  • Suggested labels: CodeRabbit can now suggest labels by learning from your past PRs in the walkthrough comment. You can also provide custom labeling instructions in the UI or configuration file.
  • Possibly related PRs, automatic label suggestions based on past PRs, learnings, and possibly related issues require data opt-in (enabled by default).

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2fd59ec and 9b71324.

Files selected for processing (1)
  • README.md (2 hunks)
Additional context used
LanguageTool
README.md

[typographical] ~18-~18: Consider adding a comma here.
Context: .../denops.vim) ## Settings ### vimscript Please add the following settings to your vimr...

(PLEASE_COMMA)

Additional comments not posted (2)
README.md (2)

36-45: LGTM!

The new augroup and autocmd for handling the User AiderOpen event in Vimscript are correctly implemented.

The s:AiderOpenHandler function is also correctly implemented and sets up the necessary key mappings for the buffer.


51-78: LGTM!

The new configuration block for the lazy.nvim plugin manager in Lua is correctly implemented and provides a comprehensive setup for the aider.vim plugin.

The global variables and key mappings are correctly defined, and the autocmd for handling the User AiderOpen event mirrors the functionality defined in the Vimscript section.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

" Set key mappings for the buffer
execute 'tnoremap <buffer=' . a:args.buf . '> <Esc> <C-\><C-n>'
execute 'nnoremap <buffer=' . a:args.buf . '> <Esc> :AiderHide<CR>'
endfunction
Copy link
Contributor Author

@tsukimizake tsukimizake Sep 10, 2024

Choose a reason for hiding this comment

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

vimscriptの設定は自分のlua設定をaiderくんに翻訳してもらっただけなのでできればマージ前に試しておいてほしい(他力本願)

Copy link
Owner

Choose a reason for hiding this comment

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

a:args.bufのところが動かないので(あとフォークされたリポジトリに切り替える方法がよくわからなかった)、マージしてから直します。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

なんかgit remote addとかする必要があるかもしれねえ ( ;´。 `;)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
README.md (1)

18-18: Consider adding a comma after "Settings" to improve readability.

-## Settings  ### vimscript
+## Settings,  ### vimscript
Tools
LanguageTool

[typographical] ~18-~18: Consider adding a comma here.
Context: .../denops.vim) ## Settings ### vimscript Please add the following settings to your vimr...

(PLEASE_COMMA)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2fd59ec and 9b71324.

Files selected for processing (1)
  • README.md (2 hunks)
Additional context used
LanguageTool
README.md

[typographical] ~18-~18: Consider adding a comma here.
Context: .../denops.vim) ## Settings ### vimscript Please add the following settings to your vimr...

(PLEASE_COMMA)

Additional comments not posted (2)
README.md (2)

36-45: LGTM!

The new augroup and autocmd for handling the User AiderOpen event in Vimscript are correctly implemented.

The s:AiderOpenHandler function is also correctly implemented and sets up the necessary key mappings for the buffer.


51-78: LGTM!

The new configuration block for the lazy.nvim plugin manager in Lua is correctly implemented and provides a comprehensive setup for the aider.vim plugin.

The global variables and key mappings are correctly defined, and the autocmd for handling the User AiderOpen event mirrors the functionality defined in the Vimscript section.

Copy link
Owner

@nekowasabi nekowasabi left a comment

Choose a reason for hiding this comment

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

@tsukimizake
LGTM!!

" Set key mappings for the buffer
execute 'tnoremap <buffer=' . a:args.buf . '> <Esc> <C-\><C-n>'
execute 'nnoremap <buffer=' . a:args.buf . '> <Esc> :AiderHide<CR>'
endfunction
Copy link
Owner

Choose a reason for hiding this comment

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

a:args.bufのところが動かないので(あとフォークされたリポジトリに切り替える方法がよくわからなかった)、マージしてから直します。

```

### lua (lazy.nvim)
Please add the following settings to your lazy settings.
Copy link
Owner

Choose a reason for hiding this comment

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

追記ありがとうございます ( ;´ワ `;)つ☆

@@ -132,12 +60,14 @@ export const buffer = {
): Promise<void | undefined | boolean> {
const aiderBufnr = await getAiderBufferNr(denops);
if (aiderBufnr) {
await buffer.openFloatingWindow(denops, aiderBufnr);
await openFloatingWindow(denops, aiderBufnr);
await emit(denops, "User", "AiderOpen");
Copy link
Owner

Choose a reason for hiding this comment

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

emit()知らなかった

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🐕 🚀

@nekowasabi nekowasabi merged commit fe4295a into nekowasabi:main Sep 10, 2024
1 check passed
@coderabbitai coderabbitai bot mentioned this pull request Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants