### 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
8.8 KiB
8.8 KiB
Contributing to Codetyper.nvim
Thank you for considering contributing to Codetyper.nvim!
Table of Contents
- Code of Conduct
- Getting Started
- Development Setup
- Project Structure
- Making Changes
- Submitting Changes
- Style Guide
- Testing
- Questions
Code of Conduct
This project and everyone participating in it is governed by our commitment to creating a welcoming and inclusive environment. Please be respectful and constructive in all interactions.
Getting Started
- Fork the repository
- Clone your fork locally
- Set up the development environment
- Create a branch for your changes
- Make your changes
- Submit a pull request
Development Setup
Prerequisites
- Neovim >= 0.8.0
- Lua 5.1+ or LuaJIT
- Git
- One of: GitHub Copilot (via copilot.lua/copilot.vim) or Ollama
Local Development
-
Clone the repository:
git clone https://github.com/CarGDev/codetyper.nvim.git cd codetyper.nvim -
Create a minimal test configuration:
-- tests/minimal_init.lua vim.opt.runtimepath:append(".") require("codetyper").setup({ llm = { provider = "ollama", }, }) -
Test your changes:
nvim --clean -u tests/minimal_init.lua -
Run the full test suite:
make test
Project Structure
codetyper.nvim/
├── lua/codetyper/
│ ├── init.lua # Entry point, setup()
│ ├── inject.lua # Code injection into buffers
│ ├── parser.lua # /@ @/ tag parser
│ ├── types.lua # Lua type annotations
│ │
│ ├── config/
│ │ ├── defaults.lua # Default configuration values
│ │ ├── credentials.lua # Credential & model storage
│ │ └── preferences.lua # User preference persistence
│ │
│ ├── adapters/nvim/
│ │ ├── autocmds.lua # Autocommands (prompt processing)
│ │ ├── commands.lua # All :Coder* user commands
│ │ ├── cmp/init.lua # nvim-cmp source integration
│ │ └── ui/
│ │ ├── thinking.lua # Status window ("Thinking...")
│ │ ├── throbber.lua # Animated spinner
│ │ ├── logs.lua # Internal log viewer
│ │ ├── logs_panel.lua # Standalone logs panel
│ │ ├── context_modal.lua # File-context picker
│ │ └── diff_review.lua # Side-by-side diff review
│ │
│ ├── core/
│ │ ├── transform.lua # Visual selection -> prompt -> apply
│ │ ├── marks.lua # Extmark tracking for injection
│ │ ├── thinking_placeholder.lua # Inline virtual text status
│ │ ├── scope/init.lua # Tree-sitter + indent scope
│ │ ├── intent/init.lua # Prompt intent classifier
│ │ ├── llm/
│ │ │ ├── init.lua # Provider dispatcher
│ │ │ ├── copilot.lua # GitHub Copilot client
│ │ │ ├── ollama.lua # Ollama client (local)
│ │ │ ├── confidence.lua # Response confidence scoring
│ │ │ └── selector.lua # Provider selection logic
│ │ ├── diff/
│ │ │ ├── diff.lua # Diff utilities
│ │ │ ├── patch.lua # Patch generation + staleness
│ │ │ ├── conflict.lua # Git-style conflict resolution
│ │ │ └── search_replace.lua # SEARCH/REPLACE block parser
│ │ ├── events/queue.lua # Priority event queue
│ │ ├── scheduler/
│ │ │ ├── scheduler.lua # Event dispatch orchestrator
│ │ │ ├── worker.lua # Async LLM worker
│ │ │ ├── executor.lua # Tool execution
│ │ │ ├── loop.lua # Processing loop
│ │ │ └── resume.lua # Session resume
│ │ ├── cost/init.lua # Token usage + cost estimation
│ │ └── memory/ # Knowledge graph & pattern learning
│ │
│ ├── features/
│ │ ├── completion/ # Inline completion & suggestions
│ │ └── indexer/ # Project indexing & analysis
│ │
│ ├── support/
│ │ ├── utils.lua # General utilities
│ │ ├── logger.lua # Logging system
│ │ ├── tree.lua # Project tree generator
│ │ ├── health.lua # :checkhealth provider
│ │ ├── gitignore.lua # .gitignore management
│ │ └── langmap.lua # Language detection
│ │
│ ├── params/agents/ # Config tables for subsystems
│ └── prompts/ # System & agent prompts
│
├── plugin/codetyper.lua # Plugin loader
├── doc/codetyper.txt # Vim help documentation
├── doc/tags # Help tags
├── tests/ # Test suite
├── Makefile # Build/test/lint targets
├── README.md
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
└── llms.txt # LLM context documentation
Making Changes
Branch Naming
Use descriptive branch names:
feature/description— New featuresfix/description— Bug fixesdocs/description— Documentation updatesrefactor/description— Code refactoring
Commit Messages
Follow conventional commits:
type(scope): description
[optional body]
[optional footer]
Types:
feat— New featurefix— Bug fixdocs— Documentationstyle— Formatting, no code changerefactor— Code restructuringtest— Adding testschore— Maintenance
Examples:
feat(scope): add indentation-based fallback for scope resolution
fix(patch): handle missing if-wrapper in SEARCH/REPLACE block
docs(readme): update commands reference for current state
Submitting Changes
- Ensure your code follows the style guide
- Update documentation if needed
- Update
CHANGELOG.mdfor notable changes - Test your changes thoroughly
- Create a pull request with:
- Clear title describing the change
- Description of what and why
- Reference to any related issues
Pull Request Template
## Description
[Describe your changes]
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Refactoring
## Testing
[Describe how you tested your changes]
## Checklist
- [ ] Code follows style guide
- [ ] Documentation updated
- [ ] CHANGELOG.md updated
- [ ] All tests pass
Style Guide
Lua Style
- Use tabs for indentation
- Use
snake_casefor variables and functions - Use
PascalCasefor module names - Add type annotations with
---@param,---@return, etc. - Document public functions with LuaDoc comments
- Avoid obvious/redundant comments
---@mod module_name Module description
local M = {}
--- Description of the function
---@param name string The parameter description
---@return boolean
function M.example_function(name)
return true
end
return M
Documentation
- Keep
README.mdup to date - Update
doc/codetyper.txtfor new features - Regenerate
doc/tagsafter help file changes - Use clear, concise language
- Include examples where helpful
Testing
Running Tests
make test # Run all tests
make test-file F=x # Run a specific test file
make test-verbose # Verbose output
make lint # Run luacheck
make format # Format with stylua
Manual Testing
- Test all commands work correctly
- Test with different file types
- Test LLM integration (Copilot and Ollama)
- Test edge cases (empty files, large files, no Tree-sitter, etc.)
- Run
:checkhealth codetyper
Questions?
Feel free to:
- Open an issue for bugs or feature requests
- Start a discussion for questions
- Reach out to the maintainer
Contact
- Maintainer: cargdev
- Email: carlos.gutierrez@carg.dev
- Website: cargdev.io
Thank you for contributing!