LSP setup for GitHub Copilot CLI
Detect the target programming language, operating system, server package, and configuration scope; install the correct LSP binary; then merge a valid lspServers JSON entry for GitHub Copilot CLI.
When to invoke
- "Set up LSP for this repository."
- "Install a language server for Java."
- "Configure TypeScript LSP for GitHub Copilot CLI."
- "Go-to-definition and find references are not working."
- "Help me make
/lsp show a running server."
Prerequisites and context
- This skill is for GitHub Copilot CLI LSP configuration, not editor or IDE LSP settings.
- Read
references/lsp-servers.md for known server binaries, install commands, and config snippets.
- The final language server
command must be on $PATH or use an absolute path.
- In interactive environments that expose
ask_user, use ask_user with choices for language and scope selection; in non-interactive environments, infer safely from repository files and document the assumption.
Procedure
- Determine the language from user input or repository files.
- Detect the OS with
uname -s, or Windows indicators such as $env:OS / %OS%.
- Read
references/lsp-servers.md and select the known LSP server, install command, binary, arguments, extensions, and language IDs.
- Choose configuration scope: user-level
~/.copilot/lsp-config.json, repo-level lsp.json, or repo-level .github/lsp.json.
- If a repo-level config already exists, keep that location; otherwise choose the requested location or document the inferred one.
- Install the server with the appropriate package manager or manual instruction.
- Read existing config first, merge only the target server entry, and preserve all other
lspServers entries.
- Validate the JSON and verify the binary with
which <binary> or where.exe <binary>.
- Tell the user to
/exit, restart copilot, run /lsp, and try hover, go-to-definition, or find-references.
Scope exclusions
This is a UTILITY SKILL for GitHub Copilot CLI only; do not use it for IDE/editor configuration. Most server entries use the literal argument "--stdio"; verify binaries with which <binary> on Unix-like systems and where.exe <binary> on Windows; the Windows command name is where.exe.
Configuration locations
| Scope |
Path |
Precedence |
Use when |
| User-level |
~/.copilot/lsp-config.json |
Lower than repo-level |
The server should be available across repositories. |
| Repo-level root |
lsp.json |
Higher than user-level |
The repository should carry its own CLI LSP configuration. |
| Repo-level GitHub |
.github/lsp.json |
Higher than user-level |
The repository keeps tool configuration under .github/. |
Configuration format
{
"lspServers": {
"<server-key>": {
"command": "<binary>",
"args": ["--stdio"],
"fileExtensions": {
".<ext>": "<languageId>",
".<ext2>": "<languageId>"
}
}
}
}
| Key |
Rule |
lspServers |
Multiple servers can coexist; never clobber unrelated entries. |
<server-key> |
Stable name for the language server, usually language or binary oriented. |
command |
Binary name on $PATH or absolute path. |
args |
Usually includes --stdio for standard I/O transport. |
fileExtensions |
Map each extension with leading dot to a valid Language ID. |
Server selection and fallback
| Situation |
Action |
Language appears in references/lsp-servers.md |
Use the documented server, install command, and config snippet. |
| Package manager missing, such as no Homebrew on macOS |
Suggest an alternative install method from the reference file. |
| Language is not listed |
Search the web for <language> LSP server, then guide manual configuration with command, args, and fileExtensions. |
| Existing config is invalid JSON |
Stop before writing; report the parse error and required repair. |
| Binary not found after install |
Check shell path, package-manager bin directory, and absolute binary path. |
Gotchas
- Restart is required: after writing LSP config, the user must type
/exit and relaunch copilot before the server is loaded.
- Repo-level config wins:
lsp.json or .github/lsp.json takes precedence over ~/.copilot/lsp-config.json.
- Do not overwrite config: merge into
lspServers; preserve existing entries and formatting as much as possible.
- Language IDs are not arbitrary: use known identifiers from the VS Code language identifier list.
Progressive disclosure and bundled resources
| Resource |
Use when |
Contains |
references/lsp-servers.md |
Always during setup |
Known language servers, install commands, config snippets, binary names, and alternatives. |
Output template
## LSP setup result — <language>
**Status:** configured | partially configured | blocked
**Scope:** user-level | repo-level root | repo-level .github
**Config file:** `<~/.copilot/lsp-config.json | lsp.json | .github/lsp.json>`
**Server key:** `<server-key>`
**Command:** `<binary>`
### Verification
- OS detected: `<uname -s | Windows>`
- Binary check: `which <binary>` or `where.exe <binary>` -> pass | fail
- JSON valid: pass | fail
- Existing entries preserved: yes | no
### Next user steps
1. Type `/exit` to quit GitHub Copilot CLI.
2. Relaunch `copilot` in a project with `<language>` files.
3. Run `/lsp` to check server status.
4. Try go-to-definition, find-references, hover, or type info.
Quality gate
References
1---2name: lsp-setup3description: Install and configure Language Server Protocol servers for GitHub Copilot CLI code intelligence, including go-to-definition, find-references, hover, and type information. Use when the user asks to set up LSP, install a language server, configure Java or TypeScript LSP, fix /lsp status, or enable deeper code understanding in Copilot CLI.4---56<!-- Generated from harness/github-copilot/skills/lsp-setup/SKILL.md by harness/claude-code/scripts/convert_from_copilot.py. Edit the source, not this file. -->78# LSP setup for GitHub Copilot CLI910Detect the target programming language, operating system, server package, and configuration scope; install the correct LSP binary; then merge a valid `lspServers` JSON entry for GitHub Copilot CLI.1112## When to invoke1314- "Set up LSP for this repository."15- "Install a language server for Java."16- "Configure TypeScript LSP for GitHub Copilot CLI."17- "Go-to-definition and find references are not working."18- "Help me make `/lsp` show a running server."1920## Prerequisites and context2122- This skill is for GitHub Copilot CLI LSP configuration, not editor or IDE LSP settings.23- Read `references/lsp-servers.md` for known server binaries, install commands, and config snippets.24- The final language server `command` must be on `$PATH` or use an absolute path.25- In interactive environments that expose `ask_user`, use `ask_user` with `choices` for language and scope selection; in non-interactive environments, infer safely from repository files and document the assumption.2627## Procedure28291. Determine the language from user input or repository files.302. Detect the OS with `uname -s`, or Windows indicators such as `$env:OS` / `%OS%`.313. Read `references/lsp-servers.md` and select the known LSP server, install command, binary, arguments, extensions, and language IDs.324. Choose configuration scope: user-level `~/.copilot/lsp-config.json`, repo-level `lsp.json`, or repo-level `.github/lsp.json`.335. If a repo-level config already exists, keep that location; otherwise choose the requested location or document the inferred one.346. Install the server with the appropriate package manager or manual instruction.357. Read existing config first, merge only the target server entry, and preserve all other `lspServers` entries.368. Validate the JSON and verify the binary with `which <binary>` or `where.exe <binary>`.379. Tell the user to `/exit`, restart `copilot`, run `/lsp`, and try hover, go-to-definition, or find-references.3839## Scope exclusions4041This is a `UTILITY` `SKILL` for GitHub Copilot CLI only; do not use it for `IDE/editor` configuration. Most server entries use the literal argument `"--stdio"`; verify binaries with `which <binary>` on Unix-like systems and `where.exe <binary>` on Windows; the Windows command name is `where.exe`.42## Configuration locations4344| Scope | Path | Precedence | Use when |45| --- | --- | --- | --- |46| User-level | `~/.copilot/lsp-config.json` | Lower than repo-level | The server should be available across repositories. |47| Repo-level root | `lsp.json` | Higher than user-level | The repository should carry its own CLI LSP configuration. |48| Repo-level GitHub | `.github/lsp.json` | Higher than user-level | The repository keeps tool configuration under `.github/`. |4950## Configuration format5152```json53{54 "lspServers": {55 "<server-key>": {56 "command": "<binary>",57 "args": ["--stdio"],58 "fileExtensions": {59 ".<ext>": "<languageId>",60 ".<ext2>": "<languageId>"61 }62 }63 }64}65```6667| Key | Rule |68| --- | --- |69| `lspServers` | Multiple servers can coexist; never clobber unrelated entries. |70| `<server-key>` | Stable name for the language server, usually language or binary oriented. |71| `command` | Binary name on `$PATH` or absolute path. |72| `args` | Usually includes `--stdio` for standard I/O transport. |73| `fileExtensions` | Map each extension with leading dot to a valid Language ID. |7475## Server selection and fallback7677| Situation | Action |78| --- | --- |79| Language appears in `references/lsp-servers.md` | Use the documented server, install command, and config snippet. |80| Package manager missing, such as no Homebrew on macOS | Suggest an alternative install method from the reference file. |81| Language is not listed | Search the web for `<language> LSP server`, then guide manual configuration with `command`, `args`, and `fileExtensions`. |82| Existing config is invalid JSON | Stop before writing; report the parse error and required repair. |83| Binary not found after install | Check shell path, package-manager bin directory, and absolute binary path. |8485## Gotchas8687- **Restart is required**: after writing LSP config, the user must type `/exit` and relaunch `copilot` before the server is loaded.88- **Repo-level config wins**: `lsp.json` or `.github/lsp.json` takes precedence over `~/.copilot/lsp-config.json`.89- **Do not overwrite config**: merge into `lspServers`; preserve existing entries and formatting as much as possible.90- **Language IDs are not arbitrary**: use known identifiers from the VS Code language identifier list.9192## Progressive disclosure and bundled resources9394| Resource | Use when | Contains |95| --- | --- | --- |96| `references/lsp-servers.md` | Always during setup | Known language servers, install commands, config snippets, binary names, and alternatives. |9798## Output template99100```markdown101## LSP setup result — <language>102103**Status:** configured | partially configured | blocked104**Scope:** user-level | repo-level root | repo-level .github105**Config file:** `<~/.copilot/lsp-config.json | lsp.json | .github/lsp.json>`106**Server key:** `<server-key>`107**Command:** `<binary>`108109### Verification110- OS detected: `<uname -s | Windows>`111- Binary check: `which <binary>` or `where.exe <binary>` -> pass | fail112- JSON valid: pass | fail113- Existing entries preserved: yes | no114115### Next user steps1161. Type `/exit` to quit GitHub Copilot CLI.1172. Relaunch `copilot` in a project with `<language>` files.1183. Run `/lsp` to check server status.1194. Try go-to-definition, find-references, hover, or type info.120```121122## Quality gate123124- [ ] The target language and OS were identified or explicitly assumed.125- [ ] `references/lsp-servers.md` was read before selecting a known server.126- [ ] Config scope was chosen among `~/.copilot/lsp-config.json`, `lsp.json`, and `.github/lsp.json`.127- [ ] Existing config was read and merged without overwriting unrelated `lspServers` entries.128- [ ] `command`, `args`, and `fileExtensions` are valid for the selected server.129- [ ] Binary availability was checked with `which <binary>` or `where.exe <binary>`.130- [ ] The final response tells the user to `/exit`, relaunch `copilot`, run `/lsp`, and test code intelligence.131132## References133134- [VS Code known language identifiers](https://code.visualstudio.com/docs/languages/identifiers#_known-language-identifiers)