@@ -50,67 +50,83 @@ Go to the CopilotChat.nvim in your GitHub account, select your branch, and click
5050
5151![ structure.drawio] ( https://github.com/CopilotC-Nvim/CopilotChat.nvim/assets/5115805/e7517736-0152-47a3-8cb9-36a5dffcb6cc )
5252
53- ### Main components
53+ ### Core
5454
55- - [ init.lua] ( /lua/CopilotChat/init.lua ) : This file initializes Copilot Chat
56- plugin. It includes functions for appending to the chat window, showing help,
57- completing, getting selection, opening and closing the chat window, asking
58- questions to the Copilot model, resetting the chat window, enabling/disabling
59- debug, and setting up the plugin.
55+ - [ init.lua] ( /lua/CopilotChat/init.lua ) : Main module. Plugin initialization
56+ (` setup() ` ), chat lifecycle (` ask() ` , ` open() ` , ` close() ` , ` toggle() ` ,
57+ ` reset() ` ), save/load, and sticky prompt processing.
6058
61- - [ config .lua] ( /lua/CopilotChat/config .lua ) : This file contains default
62- configuration for Copilot Chat plugin .
59+ - [ client .lua] ( /lua/CopilotChat/client .lua ) : Copilot API client. Handles
60+ authentication, model listing, streaming requests, and tool call execution .
6361
64- - [ copilot.lua] ( /lua/CopilotChat/copilot.lua ) : This file contains the core
65- functionality of the Copilot. It includes functions for generating unique IDs,
66- finding configuration paths, authenticating, asking questions to the Copilot,
67- generating embeddings, and managing the running job.
62+ - [ config.lua] ( /lua/CopilotChat/config.lua ) : Default configuration schema.
6863
69- - [ chat.lua] ( /lua/CopilotChat/chat.lua ) : This file manages the chat window. It
70- includes functions for creating, validating, appending to, clearing, opening,
71- closing, and focusing on the chat window.
64+ - [ config/] ( /lua/CopilotChat/config/ ) : Sub-configs for
65+ [ functions] ( /lua/CopilotChat/config/functions.lua ) ,
66+ [ mappings] ( /lua/CopilotChat/config/mappings.lua ) ,
67+ [ prompts] ( /lua/CopilotChat/config/prompts.lua ) , and
68+ [ providers] ( /lua/CopilotChat/config/providers.lua ) .
7269
73- - [ diff.lua] ( /lua/CopilotChat/diff.lua ) : This file manages the diff window. It
74- includes functions for creating, validating, showing, and restoring the diff
75- window.
70+ - [ constants.lua] ( /lua/CopilotChat/constants.lua ) : Shared constants (plugin
71+ name, roles).
7672
77- - [ select.lua] ( /lua/CopilotChat/select.lua ) : This file contains functions for
78- selecting and processing different types of data such as visual selection,
79- unnamed register, whole buffer, current line, diagnostics, and git diff.
73+ ### Chat and UI
8074
81- - [ context .lua] ( /lua/CopilotChat/context .lua ) : This file is responsible for
82- building an outline for a buffer and finding items for a query. It uses spatial
83- distance and relatedness to rank data .
75+ - [ ui/chat .lua] ( /lua/CopilotChat/ui/chat .lua ) : Chat window management.
76+ Creating, appending to, clearing, opening, closing, and focusing the chat
77+ window. Handles fold expressions and section parsing .
8478
85- - [ actions.lua] ( /lua/CopilotChat/actions.lua ) : This file manages the actions
86- that can be performed. It includes functions for getting help actions, prompt
87- actions, and picking an action from a list of actions using ` vim.ui.select ` .
79+ - [ ui/overlay.lua] ( /lua/CopilotChat/ui/overlay.lua ) : Overlay buffer used for
80+ displaying diff previews and other transient content.
8881
89- - [ tiktoken.lua] ( /lua/CopilotChat/tiktoken.lua ) : This file manages integration
90- with Tiktoken library and is used for counting tokens. It includes functions
91- for setting up Tiktoken, checking its availability, encoding prompts, and
92- counting prompts.
82+ - [ ui/spinner.lua] ( /lua/CopilotChat/ui/spinner.lua ) : Loading spinner indicator
83+ for the chat window.
9384
94- - [ health.lua] ( /lua/CopilotChat/health.lua ) : This file checks the health of the
95- plugin by checking if commands exist, checking if Lua libraries are installed,
96- and checking if a Treesitter parsers are available.
85+ ### Features
9786
98- - [ spinner.lua] ( /lua/CopilotChat/spinner.lua ) : This file manages a spinner that
99- is used for indicating loading status in chat window.
87+ - [ prompts.lua] ( /lua/CopilotChat/prompts.lua ) : Prompt resolution, custom
88+ instruction loading, system prompt building, and sticky/resource/tool
89+ parsing from user input.
10090
101- - [ utils.lua] ( /lua/CopilotChat/utils.lua ) : This file contains utility functions
102- for creating classes, getting the log file path, checking if the current
103- version of Neovim is stable, and joining multiple async functions.
91+ - [ functions.lua] ( /lua/CopilotChat/functions.lua ) : Built-in functions/tools
92+ exposed to the LLM (e.g., file editing, searching).
10493
105- - [ debuginfo .lua] ( /lua/CopilotChat/debuginfo .lua ) : This file is used for
106- creating ` :CopilotChatDebugInfo ` command .
94+ - [ resources .lua] ( /lua/CopilotChat/resources .lua ) : Resource handling for file
95+ and URL content retrieval with caching .
10796
108- ### Integrations
97+ - [ completion.lua] ( /lua/CopilotChat/completion.lua ) : Completion source for the
98+ chat window (` @tools ` , ` /prompts ` , ` #resources ` , ` $models ` ).
10999
110- - [ telescope.lua] ( /lua/CopilotChat/integrations/telescope.lua ) : This file
111- integrates the Telescope plugin with CopilotChat. It includes a function for
112- picking an action from a list of actions.
100+ - [ select.lua] ( /lua/CopilotChat/select.lua ) : Selection strategies for providing
101+ context (visual selection, buffer, diagnostics, git diff, etc.).
113102
114- - [ fzflua.lua] ( /lua/CopilotChat/integrations/fzflua.lua ) : This file integrates
115- the fzf-lua plugin with CopilotChat. It includes a function for picking an
116- action from a list of actions.
103+ - [ tiktoken.lua] ( /lua/CopilotChat/tiktoken.lua ) : Token counting via native
104+ tiktoken library.
105+
106+ - [ instructions/] ( /lua/CopilotChat/instructions/ ) : System prompt templates
107+ injected into LLM conversations (edit formats, tool use instructions, custom
108+ instructions wrapper).
109+
110+ ### Utilities
111+
112+ - [ utils.lua] ( /lua/CopilotChat/utils.lua ) : General utility functions.
113+
114+ - [ utils/] ( /lua/CopilotChat/utils/ ) : Utility modules —
115+ [ class.lua] ( /lua/CopilotChat/utils/class.lua ) (OOP helper),
116+ [ curl.lua] ( /lua/CopilotChat/utils/curl.lua ) (HTTP requests),
117+ [ diff.lua] ( /lua/CopilotChat/utils/diff.lua ) (unified diff parsing and
118+ application),
119+ [ files.lua] ( /lua/CopilotChat/utils/files.lua ) (file I/O and filetype
120+ detection),
121+ [ orderedmap.lua] ( /lua/CopilotChat/utils/orderedmap.lua ) (insertion-ordered
122+ map),
123+ [ stringbuffer.lua] ( /lua/CopilotChat/utils/stringbuffer.lua ) (efficient string
124+ concatenation).
125+
126+ ### Other
127+
128+ - [ health.lua] ( /lua/CopilotChat/health.lua ) : ` :checkhealth ` integration.
129+ Verifies commands, libraries, and Treesitter parsers.
130+
131+ - [ notify.lua] ( /lua/CopilotChat/notify.lua ) : Pub/sub notification system for
132+ status and message events.
0 commit comments