Skip to content

Latest commit

 

History

History
127 lines (86 loc) · 4.68 KB

File metadata and controls

127 lines (86 loc) · 4.68 KB

Contributing to CopilotChat.nvim

Where do I go from here?

If you've noticed a bug or have a feature request, make sure to check our Issues page to see if someone else in the community has already created a ticket. If not, go ahead and make one!

Fork & create a branch

If this is something you think you can fix, then fork CopilotChat.nvim and create a branch with a descriptive name.

A good branch name would be (where issue #325 is the ticket you're working on):

git checkout -b 325-add-japanese-localization

Make sure to check Structure first to understand the project structure.

Implement your fix or feature

At this point, you're ready to make your changes! Feel free to ask for help; everyone is a beginner at first. You can also ask in our Discord server, see README.

Make a Pull Request

At this point, you should switch back to your main branch and make sure it's up to date with CopilotChat.nvim's main branch:

git remote add upstream git@github.com:CopilotC-Nvim/CopilotChat.nvim.git
git checkout main
git pull upstream main

Then update your feature branch from your local copy of master and push your branch to your GitHub account:

git checkout 325-add-japanese-localization
git rebase main
git push --set-upstream origin 325-add-japanese-localization

Go to the CopilotChat.nvim in your GitHub account, select your branch, and click the "Pull Request" button.

Structure

structure.drawio

Core

  • init.lua: Main module. Plugin initialization (setup()), chat lifecycle (ask(), open(), close(), toggle(), reset()), save/load, and sticky prompt processing.

  • client.lua: Copilot API client. Handles authentication, model listing, streaming requests, and tool call execution.

  • config.lua: Default configuration schema.

  • config/: Sub-configs for functions, mappings, prompts, and providers.

  • constants.lua: Shared constants (plugin name, roles).

Chat and UI

  • ui/chat.lua: Chat window management. Creating, appending to, clearing, opening, closing, and focusing the chat window. Handles fold expressions and section parsing.

  • ui/overlay.lua: Overlay buffer used for displaying diff previews and other transient content.

  • ui/spinner.lua: Loading spinner indicator for the chat window.

Features

  • prompts.lua: Prompt resolution, custom instruction loading, system prompt building, and sticky/resource/tool parsing from user input.

  • functions.lua: Built-in functions/tools exposed to the LLM (e.g., file editing, searching).

  • resources.lua: Resource handling for file and URL content retrieval with caching.

  • completion.lua: Completion source for the chat window (@tools, /prompts, #resources, $models).

  • select.lua: Selection strategies for providing context (visual selection, buffer, diagnostics, git diff, etc.).

  • tiktoken.lua: Token counting via native tiktoken library.

  • instructions/: System prompt templates injected into LLM conversations (edit formats, tool use instructions, custom instructions wrapper).

Utilities

Other

  • health.lua: :checkhealth integration. Verifies commands, libraries, and Treesitter parsers.