11# LSP CLI
22
33[ ![ PyPI] ( https://img.shields.io/pypi/v/lsp-cli.svg )] ( https://pypi.org/project/lsp-cli/ )
4- [ ![ Python] ( https://img.shields.io/badge/Python-3.12 +-blue.svg )] ( https://python.org )
4+ [ ![ Python] ( https://img.shields.io/badge/Python-3.13 +-blue.svg )] ( https://python.org )
55[ ![ License] ( https://img.shields.io/badge/License-MIT-green.svg )] ( LICENSE )
66
77A powerful command-line interface for the [ ** Language Server Agent Protocol (LSAP)** ] ( https://github.com/lsp-client/LSAP ) . ` lsp-cli ` provides a bridge between traditional [ Language Server Protocol (LSP)] ( https://microsoft.github.io/language-server-protocol/ ) servers and high-level agentic workflows, offering structured data access and a robust background server management system.
@@ -16,7 +16,19 @@ Built on top of [lsp-client](https://github.com/lsp-client/lsp-client) and [LSAP
1616- ** 🧩 LSAP Integration** : Leverages the Language Server Agent Protocol for structured, agent-friendly responses with built-in pagination and text-based location finding.
1717- ** ⚡ Async-First** : Built with ` anyio ` and ` asyncer ` for high-performance concurrent operations.
1818
19- ## Installation
19+ ## Supported Languages
20+
21+ ` lsp-cli ` currently supports the following languages:
22+
23+ | Language | Language Server |
24+ | :-------------------------- | :--------------------------- |
25+ | ** Python** | ` basedpyright ` |
26+ | ** Go** | ` gopls ` |
27+ | ** Rust** | ` rust-analyzer ` |
28+ | ** TypeScript / JavaScript** | ` typescript-language-server ` |
29+ | ** Deno** | ` deno ` |
30+
31+ More supported languages coming very soon!
2032
2133``` bash
2234uv tool install lsp-cli
@@ -32,13 +44,13 @@ Find where a symbol is defined:
3244
3345``` bash
3446# Using line scope
35- lsp definition main.py --scope 10
47+ lsp definition --locate main.py: 10
3648
3749# Using text search to locate the symbol
38- lsp definition main.py --find " my_function<HERE>"
50+ lsp definition --locate " main.py@ my_function<HERE>"
3951
4052# Find declaration instead of definition
41- lsp def models.py --scope 25 --decl
53+ lsp definition --locate models.py: 25 --decl
4254```
4355
4456### Get Symbol Information
@@ -47,10 +59,10 @@ Get detailed information about a symbol at a specific location:
4759
4860``` bash
4961# Get symbol info at line 15
50- lsp symbol main.py --scope 15
62+ lsp symbol --locate main.py: 15
5163
5264# Find and get symbol info
53- lsp sym utils.py --find " UserClass<HERE>"
65+ lsp symbol --locate " utils.py@ UserClass<HERE>"
5466```
5567
5668### Find References
@@ -59,16 +71,16 @@ Find all references to a symbol:
5971
6072``` bash
6173# Find references to a symbol at line 20
62- lsp reference models.py --scope 20
74+ lsp reference --locate models.py: 20
6375
6476# Find references with text search
65- lsp ref models.py --find " UserClass<HERE>"
77+ lsp reference --locate " models.py@ UserClass<HERE>"
6678
6779# Show more context lines around each reference
68- lsp reference app.py --scope 10 --context-lines 5
80+ lsp reference --locate app.py: 10 --context-lines 5
6981
7082# Find implementations instead of references
71- lsp reference interface.py --scope 15 --impl
83+ lsp reference --locate interface.py: 15 --impl
7284```
7385
7486### Search Workspace Symbols
@@ -107,23 +119,25 @@ Get documentation and type information for a symbol:
107119
108120``` bash
109121# Get hover info at a specific line
110- lsp hover main.py --scope 42
122+ lsp hover --locate main.py: 42
111123
112124# Find symbol and get hover info
113- lsp hover models.py --find " process_data<HERE>"
125+ lsp hover --locate " models.py@ process_data<HERE>"
114126```
115127
116128## Commands
117129
118- | Command | Description | Alias |
119- | ------------ | ------------------------------------------------------- | ----- |
120- | ` definition ` | Find symbol definition, declaration, or type definition | ` def ` |
121- | ` hover ` | Get hover information (type info, documentation) | - |
122- | ` reference ` | Find symbol references or implementations | ` ref ` |
123- | ` outline ` | Get a structured symbol outline for a file | - |
124- | ` symbol ` | Get detailed symbol information at a specific location | ` sym ` |
125- | ` search ` | Search for symbols across the entire workspace by name | - |
126- | ` server ` | Manage background LSP server processes | - |
130+ | Command | Description |
131+ | ------------ | ------------------------------------------------------- |
132+ | ` definition ` | Find symbol definition, declaration, or type definition |
133+ | ` hover ` | Get hover information (type info, documentation) |
134+ | ` reference ` | Find symbol references or implementations |
135+ | ` outline ` | Get a structured symbol outline for a file |
136+ | ` symbol ` | Get detailed symbol information at a specific location |
137+ | ` search ` | Search for symbols across the entire workspace by name |
138+ | ` rename ` | Rename a symbol across the workspace |
139+ | ` server ` | Manage background LSP server processes |
140+ | ` locate ` | Parse and verify a location string |
127141
128142## Server Management
129143
@@ -146,40 +160,31 @@ The manager starts automatically when you run any analysis command.
146160
147161### Locating Symbols
148162
149- LSP CLI offers flexible ways to locate symbols in your code:
163+ LSP CLI uses a unified ` locate ` string syntax ( ` -L ` or ` -- locate` ) to specify positions in your code. The format is ` <file_path>[:<scope>][@<find>] ` .
150164
151- 1 . ** Line-based** : Use ` --scope ` with a line number (1-based)
165+ 1 . ** Line-based** : Specify a line number (1-based)
152166
153167 ``` bash
154- lsp definition main.py --scope 42
168+ lsp definition --locate main.py: 42
155169 ```
156170
1571712 . ** Range-based** : Specify a line range
158172
159173 ``` bash
160- lsp symbol utils.py --scope 10,20
174+ lsp symbol --locate utils.py: 10,20
161175 ```
162176
163- 3 . ** Text-based** : Use ` --find ` to search for text with a marker
177+ 3 . ** Text-based** : Search for text with a cursor marker ` <HERE> ` or ` <|> `
164178
165179 ``` bash
166- lsp hover app.py --find " my_function<HERE>()"
167- # The <HERE> marker indicates the cursor position
180+ lsp hover --locate " app.py@my_function<HERE>()"
168181 ```
169182
1701834 . ** Symbol path** : Navigate using symbol hierarchy
171184 ``` bash
172- lsp definition models.py --scope " UserClass.get_name"
185+ lsp definition --locate models.py: UserClass.get_name
173186 ```
174187
175- ### Markdown Output
176-
177- For better readability or integration with documentation tools:
178-
179- ``` bash
180- lsp hover main.py --scope 10 --markdown
181- ```
182-
183188### Working with Results
184189
185190Pagination for large result sets:
@@ -197,21 +202,23 @@ lsp search "config" --max-items 50 --start-index 50
197202Enable debug mode to see detailed logs:
198203
199204``` bash
200- lsp --debug definition main.py --scope 10
205+ lsp --debug definition --locate main.py: 10
201206```
202207
203208## Configuration
204209
205210` lsp-cli ` can be configured via environment variables or a ` config.toml ` file.
206211
207212- ** Config File** : ` ~/.config/lsp-cli/config.toml ` (on Linux) or ` ~/Library/Application Support/lsp-cli/config.toml ` (on macOS).
208- - ** Environment Variables** : Prefix with ` LSP_ ` (e.g., ` LSP_LOG_DIR=/tmp/logs ` ).
213+ - ** Environment Variables** : Prefix with ` LSP_ ` (e.g., ` LSP_LOG_LEVEL=DEBUG ` ).
209214
210215### Available Settings
211216
212217Create a ` config.toml ` file at the location above with the following options:
213218
214219``` toml
220+ # config.toml
221+
215222# Enable debug mode (verbose logging)
216223debug = false
217224
0 commit comments