A Language Server Protocol (LSP) implementation for code snippet completion, designed to integrate with the Helix editor and other LSP-compatible editors.
- LSP-Compliant - Full support for the Language Server Protocol
- TOML Configuration - Simple TOML format for snippet definitions
- Helix Integration - Optimized for the Helix editor
- Case-Sensitive Matching - Configurable snippet matching
- Debug Logging - Built-in debugging capabilities
- Multiple Installation Methods - Easy install scripts for Linux, macOS, and Windows
Linux/macOS:
cd Snippets
./install.shWindows (PowerShell):
cd Snippets
.\install.ps1For development:
cd Snippets
./install-dev.shSee INSTALL.md for detailed instructions.
The tool looks for snippets at ~/.config/helix/snippets.toml
Example snippets file:
forloop=for i in 0..10 do
ifblock=if condition then
// code
endifRun the language server:
snippetsEnable debug logging:
SNIPPETS_DEBUG=1 snippetsThe project consists of:
- Types.fs - Core data types and configuration
- TomlParser.fs - TOML snippet file parsing
- SnippetMatcher.fs - Snippet matching and ranking
- CompletionProvider.fs - LSP completion item generation
- LspProtocol.fs - LSP protocol implementation
- JsonRpc.fs - JSON-RPC message handling
- MessageHandler.fs - Message routing and processing
- Program.fs - Server entry point
dotnet builddotnet testdotnet publish -c Release- .NET 10.0 or later
- F# 8.0 or later
After the snippets .NET tool is instealled you can configure Helix to use this server for Markdown files, by writing the following at ~/.config/helix/languages.toml
[language-server.snippets]
command = "snippets"
[[language]]
name = "markdown"
file-types = ["md"]
language-servers = ["snippets"]The completions are triggered by the character :. The snippet file should be at ~/.config/helix/snippets.toml. Example content:
:eq=≡
:neq=≢
:and=∧
:or=∨
:implies=⇒
:follows=⇐The project includes comprehensive tests for:
- TOML parsing
- Snippet matching
- Completion provider logic
- JSON-RPC message handling
Run tests with:
dotnet testSNIPPETS_DEBUG- Set to1to enable debug logging (default: depends on config)
MIT License - see LICENSE file for details
Contributions are welcome! Please feel free to submit issues and pull requests.
