LSP Setup

LSP Setup

Detects the user's OS, installs a language server for their language and writes the Copilot CLI configuration to enable go-to-definition and find-references.

Skill files3 files

references/

SKILL.md75 lines
1
---
2
name: lsp-setup
3
description: 'Enable code intelligence (go-to-definition, find-references, hover, type info) for any programming language by installing and configuring an LSP server for Copilot CLI. Detects the OS, installs the right server, and generates the JSON configuration (user-level or repo-level). Use when you need deeper code understanding and no LSP server is configured, or when the user asks to set up, install, or configure an LSP server.'
4
---
5
6
# LSP Setup for GitHub Copilot CLI
7
8
**UTILITY SKILL** — installs and configures Language Server Protocol servers for Copilot CLI.
9
USE FOR: "setup LSP", "install language server", "configure LSP for Java", "add TypeScript LSP", "enable code intelligence", "I need go-to-definition", "find references not working", "need better code understanding"
10
DO NOT USE FOR: general coding tasks, IDE/editor LSP configuration, non-Copilot-CLI setups
11
12
## Workflow
13
14
1. **Ask the language** — use `ask_user` to ask which programming language(s) the user wants LSP support for
15
2. **Detect the OS** — run `uname -s` (or check for Windows via `$env:OS` / `%OS%`) to determine macOS, Linux, or Windows
16
3. **Look up the LSP server** — read `references/lsp-servers.md` for known servers, install commands, and config snippets (for Java, also read `references/java-jdtls.md`)
17
4. **Ask scope** — use `ask_user` to ask whether the config should be user-level (`~/.copilot/lsp-config.json`) or repo-level (`.github/lsp.json`)
18
5. **Install the server** — run the appropriate install command for the detected OS
19
6. **Write the config** — merge the new server entry into the chosen config file (`~/.copilot/lsp-config.json` for user-level; `.github/lsp.json` for repo-level). Create the file if missing and preserve existing entries.
20
7. **Verify** — confirm the LSP binary is on `$PATH` and the config file is valid JSON
21
22
## Configuration Format
23
24
Copilot CLI reads LSP configuration from user-level or repo-level locations, and repo-level config takes precedence over user-level config:
25
26
- **User-level**: `~/.copilot/lsp-config.json`
27
- **Repo-level**: `.github/lsp.json` (a bare `lsp.json` at the repo root is not read: with Copilot CLI 1.0.95, `copilot lsp list` listed servers from `.github/lsp.json` but not from a root `lsp.json`)
28
29
The JSON structure:
30
31
```json
32
{
33
"lspServers": {
34
"<server-key>": {
35
"command": "<binary>",
36
"args": ["--stdio"],
37
"fileExtensions": {
38
".<ext>": "<languageId>",
39
".<ext2>": "<languageId>"
40
}
41
}
42
}
43
}
44
```
45
46
### Key rules
47
48
- `command` is the binary name (must be on `$PATH`) or an absolute path.
49
- `args` almost always includes `"--stdio"` to use standard I/O transport.
50
- `fileExtensions` maps each file extension (with leading dot) to a [Language ID](https://code.visualstudio.com/docs/languages/identifiers#_known-language-identifiers).
51
- Multiple servers can coexist in `lspServers`.
52
- When merging into an existing file, **never overwrite** other server entries — only add or update the target language key.
53
54
## Behavior
55
56
- Always use `ask_user` with `choices` when asking the user to pick a language or scope.
57
- If the language is not listed in `references/lsp-servers.md`, search the web for "<language> LSP server" and guide the user through manual configuration.
58
- If a package manager is not available (e.g. no Homebrew on macOS), suggest alternative install methods from the reference file.
59
- After installation, run `which <binary>` (or `where.exe` on Windows) to confirm the binary is accessible.
60
- Show the user the final config JSON before writing it.
61
- If the config file already exists, read it first and merge — do not clobber.
62
63
## Verification
64
65
After setup, tell the user:
66
67
1. Type `/exit` to quit Copilot CLI — this is **required** so the new LSP configuration is loaded on next launch
68
2. Re-launch `copilot` in a project with files of the configured language
69
3. Run `/lsp` to check the server status
70
4. Try code intelligence features like go-to-definition or hover
71
72
## Java
73
74
For Java semantic navigation, prefer the `lsp` tool (`goToDefinition`, `findReferences`, `hover`, `incomingCalls`) over grep/view once a server is configured. LSP is optional for Java and is not a prerequisite for build or runtime diagnostics. See `references/java-jdtls.md` for setup details and troubleshooting.
75

© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 6,373 prompts

More by @OpenSourceBuffGuy

See all
Website Clone Architect prompt image

Website Clone Architect

Reverse-engineers a website section by section, writes component specs, and hands them to parallel builder agents in git worktrees to rebuild it.

agent-skill, orchestrator, parallel-agents, multi-agent, plan-then-execute, web-development, frontend, codebase-analysis, scaffolding, css, html, nextjs, typescript, git, mcp, claude-code, for-developers, for-designers, long-form, advanced, technical-spec, task-decomposition, structured-output, design-systems, ui-ux, tool-use, checklist, report, vibe-coding

Italian Terrace Cafe Candid Portrait prompt image

Italian Terrace Cafe Candid Portrait

Generates a photorealistic candid shot of a woman in a white corset dress laughing at a sunny hotel terrace cafe, written as detailed JSON.

image-prompt, json-prompt, structured-output, photorealistic, portrait, woman, candid, fashion, cottagecore, natural-light, golden-hour, bokeh, summer, travel, cityscape, mountains, medium-shot, vibrant-colors, for-photographers, nano-banana, fashion-shoot, luxury

Night Street Photo With Leashed Cat prompt image

Night Street Photo With Leashed Cat

Generates a flash-lit night street photo of a blonde woman in a retro track jacket walking a hissing tabby cat on a leash.

image-prompt, json-prompt, nano-banana, structured-output, portrait, woman, animals, pet-portrait, night-scene, street-photography, candid, editorial, fashion, dramatic-lighting, photorealistic, vertical-format, medium-shot, graffiti, for-photographers, for-content-creators

1 view

Reviews

Loading reviews…

Discussion

Loading comments…