feat: adding multiple files

### Added

- **Smart Scope Resolution** — Tree-sitter + indentation context for
selections
  - `resolve_selection_context()` in `scope/init.lua` handles partial
functions,
    whole functions, multi-function spans, indent blocks, and whole-file
selections
  - Enclosing function automatically sent as context when selecting code
inside one
  - Whole-file selection (>=80% of lines) triggers project tree as
context
  - Indentation-based fallback when Tree-sitter is unavailable

- **Explain-to-Document Intent** — "explain" prompts generate
documentation
  - Detects prompts like "explain this", "tell me about", "what does",
"question"
  - Generates documentation comments and inserts them above selected
code
  - Shows notification if nothing is selected
  - Updated intent action from "none" to "insert" for explain intent

- **Granular LLM Status Notifications** — Real-time progress reporting
  - Inline virtual text and floating status window show current stage
  - Stages: "Reading context...", "Searching index...", "Gathering
context...",
    "Recalling patterns...", "Building prompt...", "Sending to
[provider]...",
    "Processing response...", "Generating patch...", "Applying code..."
  - `update_inline_status()` in `thinking_placeholder.lua`
  - `update_stage()` in `thinking.lua`

- **Thinking Placeholder Positioning** — "Implementing..." appears above
selection
  - Uses `virt_lines_above = true` on extmark at selection start line
  - Dynamic status text updates during LLM processing

### Changed

- **Providers reduced to Copilot and Ollama only**
  - Removed Claude, OpenAI, and Gemini provider integrations
  - Deleted `llm/openai.lua` and `llm/gemini.lua`
  - Cleaned `llm/init.lua`, `config/defaults.lua`, `types.lua`,
`credentials.lua`,
    `cost/init.lua`, and `events/queue.lua` of all references
  - `valid_providers` now only includes "copilot" and "ollama"

- **Removed timer-based delayed processing** — Prompts are processed
instantly
  - Removed `timer` field, `timeout_ms`, and timer setup/cancellation
from `worker.lua`

- **Removed chat/agent/split window UI**
  - Deleted `ui/chat.lua`, `windows.lua`, `ui/switcher.lua`
  - Removed `CoderOpen`, `CoderClose`, `CoderToggle` commands
  - Removed window management from `autocmds.lua`, `inject.lua`,
`executor.lua`
  - Removed auto-open companion file logic

- **Commands removed from menu** (code retained with TODOs for
re-enabling)
  - `CoderAddApiKey`, `CoderRemoveApiKey`, `CoderBrain`,
`CoderFeedback`,
    `CoderMemories`, `CoderForget`, `CoderProcess`
  - Subcommands `process`, `status`, `memories`, `forget`,
`llm-feedback-good`,
    `llm-feedback-bad`, `add-api-key`, `remove-api-key` removed from
completion

### Fixed

- Fixed `patch.lua` syntax error — missing `if` wrapper around
SEARCH/REPLACE block
- Fixed `CoderModel` require path typo
(`codetyper.adapters.config.credentials`
  → `codetyper.config.credentials`)
- Fixed `thinking_placeholder` extmark placement appearing after
selection
  instead of above it
This commit is contained in:
2026-03-18 23:05:26 -04:00
parent f110a3ed25
commit e57209a1f8
32 changed files with 1284 additions and 3414 deletions

View File

@@ -9,22 +9,16 @@ local utils = require("codetyper.support.utils")
---@param code string Generated code
---@param prompt_type string Type of prompt (refactor, add, document, etc.)
function M.inject_code(target_path, code, prompt_type)
local window = require("codetyper.adapters.nvim.windows")
-- Normalize the target path
target_path = vim.fn.fnamemodify(target_path, ":p")
-- Get target buffer
local target_buf = window.get_target_buf()
if not target_buf or not vim.api.nvim_buf_is_valid(target_buf) then
-- Try to find buffer by path
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
local buf_name = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(buf), ":p")
if buf_name == target_path then
target_buf = buf
break
end
-- Try to find buffer by path
local target_buf = nil
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
local buf_name = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(buf), ":p")
if buf_name == target_path then
target_buf = buf
break
end
end
@@ -144,16 +138,13 @@ end
function M.inject_add(bufnr, code)
local lines = vim.split(code, "\n", { plain = true })
-- Get cursor position in target window
local window = require("codetyper.adapters.nvim.windows")
local target_win = window.get_target_win()
-- Try to find a window displaying this buffer to get cursor position
local insert_line
if target_win and vim.api.nvim_win_is_valid(target_win) then
local cursor = vim.api.nvim_win_get_cursor(target_win)
local wins = vim.fn.win_findbuf(bufnr)
if #wins > 0 then
local cursor = vim.api.nvim_win_get_cursor(wins[1])
insert_line = cursor[1]
else
-- Append at end
insert_line = vim.api.nvim_buf_line_count(bufnr)
end