LSP for Copilot
LSP for Copilot bridges VS Code's Language Server Protocol engine with GitHub Copilot Chat, exposing 13 semantic code-navigation tools that Copilot can call on its own — or that you can invoke explicitly with Instead of relying on text search or guesswork, Copilot can now jump to definitions, trace call hierarchies, inspect types, find implementations, and more — using the same language servers that power your editor's Go to Definition, Find References, and hover tooltips. ✨ Why?Out of the box, Copilot Chat reads files and searches text. That works — until it doesn't:
This extension fixes all of that. Every tool wraps a real LSP request, so the answers are precise, up-to-date, and language-aware. 📦 InstallationFrom the VS Code MarketplaceSearch for "LSP for Copilot" in the Extensions view ( From a
|
| Tool | Chat ref | Description |
|---|---|---|
| Go to Definition | #definition |
Jump to where a symbol is defined |
| Go to Declaration | #declaration |
Jump to the declared type contract (.d.ts, header file, etc.) |
| Go to Type Definition | #typeDef |
Jump to where a variable's type is defined |
| Find Implementations | #impl |
Find all implementations of an interface or abstract symbol |
Search & Discovery
| Tool | Chat ref | Description |
|---|---|---|
| Find References | #references |
Find every usage of a symbol across the workspace |
| Document Symbols | #symbols |
List all symbols (functions, classes, variables…) in a file |
| Workspace Symbols | #wsSymbols |
Search for symbols by name across the entire project |
| Find Symbol by Name | #findSym |
Locate a symbol by name, then optionally chain an LSP action |
Inspection
| Tool | Chat ref | Description |
|---|---|---|
| Hover Information | #hover |
Get type signatures, docs, and parameter info |
| Inlay Hints | #inlayHints |
Reveal inferred types, parameter labels, and return types |
| Diagnostics | #diagnostics |
Get errors, warnings, and lint results for a file |
Hierarchies
| Tool | Chat ref | Description |
|---|---|---|
| Call Hierarchy | #callHierarchy |
Show who calls a function (incoming) or what it calls (outgoing) |
| Type Hierarchy | #typeHierarchy |
Show supertypes and subtypes of a class or interface |
🚀 Usage
Automatic (just chat)
Copilot will discover and call these tools on its own when it needs code intelligence. Just ask naturally:
"Where is the
DatabaseConnectionclass defined?""What calls the
processPaymentfunction?""Show me all implementations of the
Loggerinterface.""Are there any type errors in
server.ts?"
Explicit #tool references
You can also force a specific tool by referencing it in chat:
#findSym Find the "handleRequest" function in src/server.ts and show its references
#symbols List everything in src/models/user.ts
#callHierarchy Who calls authenticate() in src/auth.ts?
#diagnostics Check src/index.ts for errors
The power tool: #findSym
#findSym is the most versatile tool — it resolves a symbol by name (no need to know exact line numbers), then chains any follow-up action:
#findSym symbolName="UserService" action="implementation" → find all implementations
#findSym symbolName="fetchData" action="references" → find all call sites
#findSym symbolName="Config" action="hover" → get type info & docs
#findSym symbolName="parse" action="callHierarchy_incoming"→ who calls parse()?
🌐 Language Support
This extension works with any language that has a VS Code language server. That includes, but is not limited to:
| Language | Language Server |
|---|---|
| TypeScript / JavaScript | Built-in TS server |
| Python | Pylance / Pyright |
| Rust | rust-analyzer |
| C / C++ | clangd / C/C++ extension |
| Go | gopls |
| Java | Eclipse JDT.LS |
| C# | OmniSharp / C# Dev Kit |
| And many more… | Any LSP-compliant server |
Note: The quality of results depends on the language server. Some servers support all LSP features; others support a subset.
🔧 Development
git clone https://github.com/your-org/lsp-for-copilot.git
cd lsp-for-copilot
npm install
Scripts
| Script | Description |
|---|---|
npm run build |
Production build (minified, tree-shaken via esbuild) |
npm run watch |
Dev build with file watching |
npm run typecheck |
TypeScript type checking |
npm run lint |
ESLint |
npm run test |
Run integration tests |
npm run package |
Package as .vsix |
Debug
Press F5 in VS Code to launch the Extension Development Host with the extension loaded.
Architecture
src/
├── extension.ts # Activation entry point — registers all 13 tools
├── types.ts # Shared TypeScript interfaces
├── tools/
│ ├── index.ts # Tool registration hub
│ ├── findSymbol.ts # ⭐ Composite name→position→action tool
│ ├── goToDefinition.ts # LSP textDocument/definition
│ ├── findReferences.ts # LSP textDocument/references
│ ├── hover.ts # LSP textDocument/hover
│ ├── declaration.ts # LSP textDocument/declaration
│ ├── typeDefinition.ts # LSP textDocument/typeDefinition
│ ├── implementation.ts # LSP textDocument/implementation
│ ├── documentSymbols.ts# LSP textDocument/documentSymbol
│ ├── workspaceSymbols.ts# LSP workspace/symbol
│ ├── callHierarchy.ts # LSP callHierarchy/*
│ ├── typeHierarchy.ts # LSP typeHierarchy/*
│ ├── diagnostics.ts # VS Code diagnostics collection
│ └── inlayHints.ts # LSP textDocument/inlayHint
└── utils/
└── lsp.ts # Shared LSP helpers (retries, formatting, snippets)
📄 License
MIT