Skip to content
New issue

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

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

Already on GitHub? # to your account

assistant/codecompanion-nvim: init #707

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ArmandoCIII
Copy link
Contributor

Adding codecompanion.nvim plugin for a more customizable coding assistant experience.

Basic functionality (adding/changing adapters, chat buffer, inline, buffer, prompt library) have been tested and work, however, another set of eyes would be nice as well for other implemented functions. I will continue testing, but any help (from anyone) to speed up testing would be appreciated.

closes issue #671

Sanity Checking

  • I have updated the changelog as per my changes
  • I have tested, and self-reviewed my code
  • My changes fit guidelines found in hacking nvf
  • Style and consistency
    • I ran Alejandra to format my code (nix fmt)
    • My code conforms to the editorconfig configuration of the project
    • My changes are consistent with the rest of the codebase
  • If new changes are particularly complex:
    • My code includes comments in particularly complex areas
    • I have added a section in the manual
    • (For breaking changes) I have included a migration guide
  • Package(s) built:
    • .#nix (default package)
    • .#maximal - due to unrelated issue regarding programs.mnw.plugins
    • .#docs-html (manual, must build)
    • .#docs-linkcheck (optional, please build if adding links)
  • Tested on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin

Add a 👍 reaction to pull requests you find important.

@ArmandoCIII ArmandoCIII requested a review from NotAShelf as a code owner March 12, 2025 01:01
github-actions bot pushed a commit that referenced this pull request Mar 12, 2025
Copy link

🚀 Live preview deployed from bafa6cb

View it here:

Debug Information

Triggered by: ArmandoCIII

HEAD at: feature/codecompanion-nvim

Reruns: 407


[nezia1](https://github.com/nezia1):
[nezia1](https://github.com/nezia1)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a mistake and I will fix this. Before doing so, I'll wait to see if there are any changes requested throughout the rest of the code.

Copy link
Owner

@NotAShelf NotAShelf left a comment

Choose a reason for hiding this comment

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

I've requested a few stylistic changes. Looks good overall, but two things I want to mention are:

  1. If the enums are not likely to change, please in-line the lists. I understand that some formatters, like nixfmt, prefer unfolding lists but I find them to be distracting. They also introduce an uglier syntax.

  2. For option descriptions, there also seems to be some inconsistency, i.e., some of the descriptions have periods at the end, but others don't. I'd appreciate if you could make sure that they remain consistent.

Nothing else comes to mind, thank you for your efforts.

Comment on lines +74 to +78
show_header_separator = mkEnableOption "show header separators in the chat buffer? Set this to false if you're using an external markdown formatting plugin.";
show_references = mkEnableOption "show references (from slash commands and variables) in the chat buffer." // {default = true;};
show_settings = mkEnableOption "show LLM settings at the top of the chat buffer.";
show_token_count = mkEnableOption "show the token count for each response." // {default = true;};
start_in_insert_mode = mkEnableOption "open the chat buffer in insert mode.";
Copy link
Owner

Choose a reason for hiding this comment

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

Those will yield some grammatically incorrect descriptions. mkEnableOption function is a wrapper around mkOption which automatically prepends "Whether to enable" to the description you pass it. It will produce, for examaple

"Whether to enable show references"

in the documentation. Additionally, I'd appreciate if you could make sure that the description lines do not exceed 80 characters per line. If it is longer, you may use multi-line strings. For example:

show_header_separator = mkEnableOption ''
	show header separators in the chat buffer?
	
	Set this to false if you're using an external
	markdown formatting plugin.
'';

vim = {
startPlugins = [
"plenary-nvim"
"nvim-treesitter"
Copy link
Owner

Choose a reason for hiding this comment

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

There isn't a toggle for plenary, but you may instead explicitly enable the treesitter module when this plugin is enabled. That should be preferred over putting dependencies in startPlugins in ways that cannot be overriden.


opts = {
show_default_actions = mkEnableOption "show the default actions in the action palette?" // {default = true;};
show_default_prompt_library = mkEnableOption "show the default prompt library in the action palette?" // {default = true;};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@NotAShelf For situations where the mkEnableOption has // {default = true;};, what is the preferred way to reduce the line size? Should I change this to a mkOption type = bool instead?

Copy link
Owner

@NotAShelf NotAShelf Mar 12, 2025

Choose a reason for hiding this comment

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

The description can be a multi-line string regardless.

mkEnableOption "" // {
  default = true;
  description = ''
    lines
    more lines
  '';
}

is how its usually done in nvf, but a boolean mkOption is fine too.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants