Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>LSP Language Model ToolsNew to Visual Studio Code? Get it now.
LSP Language Model Tools

LSP Language Model Tools

Graydon Hoare

|
4 installs
| (0) | Free
Exposes LSP (Language Server Protocol) methods as Language Model Tools for AI agents in VS Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

NOTE: this extension was written almost entirely by Claude Opus 4.5 with light human review. It is pretty much pure boilerplate derived from the LSP spec and the Language Model API docs, but still worth giving a quick read through.

LSP Language Model Tools

A VS Code extension that exposes Language Server Protocol (LSP) methods to Copilot-agent-in-VS-Code using the VS Code Language Model Tools API, enabling Copilot to ask any LSP provider semantic questions (lists of symbols, type and call graph relationships, etc.)

This is similar to extensions like sehejjain.lsp-mcp-bridge except it doesn't bother doing through an MCP bridge (and requiring an LSP-to-MCP bridge). VS Code already runs LSPs itself and has direct access to LSP methods, and also already has an API for exposing functions to Copilot; so this extension just routes one of those into the other (transforming structured data types from LSP into text summaries for the LLM to consume).

Features

This extension registers 25 LSP-based tools with VS Code's Language Model API:

Navigation Tools

  • lsp_get_definition - Find where a symbol is defined
  • lsp_get_declaration - Find symbol declarations (separate from definition in languages like C/C++)
  • lsp_get_type_definition - Find the type definition of a variable
  • lsp_get_implementation - Find implementations of interfaces/abstract methods
  • lsp_get_references - Find all references to a symbol

Code Intelligence Tools

  • lsp_get_hover - Get hover information (type info, documentation)
  • lsp_get_signature_help - Get function signature help at call sites
  • lsp_get_completion - Get code completion suggestions
  • lsp_get_code_actions - Get available quick fixes and refactorings
  • lsp_get_code_lens - Get code lens annotations

Symbol Tools

  • lsp_get_document_symbols - Get all symbols in a document
  • lsp_get_workspace_symbols - Search for symbols across the workspace
  • lsp_get_document_highlights - Find all occurrences in current document

Hierarchy Tools

  • lsp_get_call_hierarchy - Get incoming/outgoing call relationships
  • lsp_get_type_hierarchy - Get supertypes and subtypes of a class

Structure Tools

  • lsp_get_folding_ranges - Get code folding ranges
  • lsp_get_selection_ranges - Get smart selection expansion ranges
  • lsp_get_semantic_tokens - Get semantic token information

Document Feature Tools

  • lsp_get_document_links - Get clickable links in a document
  • lsp_get_document_colors - Get color information from CSS/etc.
  • lsp_get_inlay_hints - Get inlay hints (type annotations, parameter names)
  • lsp_get_linked_editing_ranges - Get ranges that should be edited together

Formatting Tools

  • lsp_format_document - Get formatting edits for a document
  • lsp_format_range - Get formatting edits for a specific range

Utility Tools

  • lsp_prepare_rename - Check if a symbol can be renamed

Usage

Once installed, these tools become available to Copilot in VS Code. You can reference them in chat using their tool reference names (e.g., #lspDefinition, #lspReferences).

Example Usage in Chat

Find all references to the function at line 42: #lspReferences
What's the type of the variable at position 10,5? #lspHover

Requirements

  • VS Code 1.95.0 or higher
  • Language servers for your programming languages (e.g., TypeScript, Python, etc.)

Extension Settings

This extension does not add any VS Code settings. All tools work automatically with whatever language servers you have installed.

How It Works

The extension uses VS Code's built-in commands that wrap LSP functionality:

  • vscode.executeDefinitionProvider
  • vscode.executeReferenceProvider
  • vscode.executeHoverProvider
  • And many more...

These commands communicate with the language servers running for your open files and return the results in a format suitable for AI agents.

Position and Range Parameters

All tools use 0-based line and character positions (matching LSP convention):

  • line: 0-based line number
  • character: 0-based character offset on the line

Ranges are specified with:

  • startLine, startCharacter: Start position (inclusive)
  • endLine, endCharacter: End position (exclusive)

Building from Source

npm install
npm run compile

To package:

npx vsce package

License

MIT

Contributing

I'm fairly busy and this is an extension you could regenerate yourself with an evening's effort but I'll take occasional fixes if I have time.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft