LSP Servers
codeflow integrates with your LSP servers.
codeflow integrates with your Language Server Protocol (LSP) to help the LLM interacts with your codebase. It uses diagnostics to provide feedback to the LLM. And go-to-definition and find-references to help navigate your codebase.
Built-in
codeflow comes with several built-in LSP servers for popular languages:
LSP Server | Extensions | Requirements |
---|---|---|
typescript | .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts | typescript dependency in project |
eslint | .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts, .vue | eslint dependency in project |
gopls | .go | go command available |
ruby-lsp | .rb, .rake, .gemspec, .ru | ruby and gem commands available |
pyright | .py, .pyi | pyright dependency installed |
elixir-ls | .ex, .exs | elixir command available |
zls | .zig, .zon | zig command available |
csharp | .cs | .NET SDK installed |
vue | .vue | Auto-installs for Vue projects |
rust | .rs | rust-analyzer command available |
clangd | .c, .cpp, .cc, .cxx, .c++, .h, .hpp, .hh, .hxx, .h++ | Auto-installs for C/C++ projects |
LSP servers are automatically enabled when one of the above file extensions are detected and the requirements are met.
How It Works
When codeflow opens a file, it:
- Checks the file extension against all enabled LSP servers.
- Starts the appropriate LSP server if not already running.
Configure
You can customize LSP servers through the lsp
section in your codeflow config.
{ "$schema": "https://codeflow.ai/config.json", "lsp": {}}
Each LSP server supports the following:
Property | Type | Description |
---|---|---|
disabled | boolean | Set this to true to disable the LSP server |
command | string[] | The command to start the LSP server |
extensions | string[] | File extensions this LSP server should handle |
env | object | Environment variables to set when starting server |
initialization | object | Initialization options to send to the LSP server |
Let’s look at some examples.
Disabling LSP servers
To disable a specific LSP server, set disabled
to true
:
{ "$schema": "https://codeflow.ai/config.json", "lsp": { "typescript": { "disabled": true } }}
Custom LSP servers
You can add custom LSP servers by specifying the command and file extensions:
{ "$schema": "https://codeflow.ai/config.json", "lsp": { "custom-lsp": { "command": ["custom-lsp-server", "--stdio"], "extensions": [".custom"] } }}