Contributing
May 31, 2026 · View on GitHub
Thank you for considering contributing to telegram.nvim!
Development Setup
git clone https://github.com/ChuYanLon/telegram.nvim.git
cd telegram.nvim
pnpm install
Project Structure
├── lua/telegram/ # Neovim Lua frontend
│ ├── init.lua # Entry point, message handling, WS routing
│ ├── ui.lua # UI rendering (popups, keymaps, virtual scroll)
│ ├── server.lua # Async HTTP client (vim.net.request or curl fallback)
│ ├── ws.lua # WebSocket client (subprocess, reconnect)
│ ├── auth.lua # Authentication flow
│ ├── config.lua # Configuration, highlight groups
│ ├── editor.lua # Input editor component
│ ├── tools.lua # Extensible tool system (@ key)
│ ├── github.lua # GitHub PR and issue commands
│ └── render/ # Message rendering pipeline
│ ├── init.lua
│ ├── text.lua
│ ├── code.lua
│ ├── link.lua
│ ├── media.lua
│ └── other.lua
├── src/ # TypeScript backend (tsx runtime)
│ ├── server.ts # Express + WebSocket server
│ ├── client.ts # TelegramLSPClient orchestrator
│ ├── types.ts # Shared TS interfaces
│ ├── tdlib.ts # libtdjson path auto-detection
│ ├── auth.ts # AuthManager (phone → code → 2FA)
│ ├── format.ts # Message formatting
│ ├── resolve.ts # Sender resolution caching
│ └── updates.ts # WebSocket update dispatcher
├── bin/ # Helper scripts (tg-ws-helper.ts)
├── plugin/tg.lua # Plugin loader
└── tests/ # Vitest tests (FakeTdClient)
Code Style
- Lua: Follow existing patterns. Use tabs for indentation. No semicolons.
- TypeScript: Full type annotations. Use
_instead of@typefor TDLib objects. - Keep functions focused and well-named. Avoid unnecessary comments.
- No build step —
tsxruns TypeScript directly from source.
Making Changes
- Fork the repo and create a branch from
main(e.g.fix/login-crash) - Make your changes
- Test locally:
pnpm testto verify tests passpnpm typecheckto verify TypeScript typespnpm startto check the backend starts
- Commit and push
- Open a Pull Request targeting the
mainbranch - CI will run automatically on your PR (test only — run
pnpm typechecklocally before pushing)
Commit Messages
Use concise, descriptive commit messages in English. Focus on the "why" rather than the "what".
License
By contributing, you agree that your contributions will be licensed under the MIT License.