Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/dora/test/lsp-provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ describe('LSPProvider', () => {
provider = new LSPProvider({ projectPath: process.cwd() })
await provider.connect()

// Call on a position that doesn't have a symbol (no LSP servers connected)
// Use an extension that doesn't match any LSP server to avoid triggering server spawn
const result = await provider.callTool('lsp_references', {
file: 'test.ts',
file: 'test.notreal',
line: 0,
character: 0,
})
Expand Down
48 changes: 44 additions & 4 deletions packages/lsp/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,53 @@ src/

## Supported Language Servers

### Core Languages

| Server | ID | Extensions | Root Detection |
|--------|-----|------------|----------------|
| TypeScript | `typescript` | .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts | package-lock.json, bun.lockb, bun.lock, yarn.lock, pnpm-lock.yaml |
| Deno | `deno` | .ts, .tsx, .js, .jsx, .mjs | deno.json, deno.jsonc |
| Vue | `vue` | .vue | package.json, package-lock.json, bun.lockb, bun.lock, pnpm-lock.yaml, yarn.lock |
| Oxlint | `oxlint` | .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts, .vue, .astro, .svelte | .oxlintrc.json, package-lock.json, bun.lockb, bun.lock, pnpm-lock.yaml, yarn.lock, package.json |
| ESLint | `eslint` | .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts, .vue | package-lock.json, bun.lockb, bun.lock, pnpm-lock.yaml, yarn.lock |
| Svelte | `svelte` | .svelte | package-lock.json, bun.lockb, bun.lock, pnpm-lock.yaml, yarn.lock |
| Astro | `astro` | .astro | package-lock.json, bun.lockb, bun.lock, pnpm-lock.yaml, yarn.lock |
| Pyright | `pyright` | .py, .pyi | pyproject.toml, setup.py, requirements.txt, pyrightconfig.json |
| Gopls | `gopls` | .go | go.work, go.mod, go.sum |
| Rust Analyzer | `rust-analyzer` | .rs | Cargo.toml, Cargo.lock |
| Kotlin | `kotlin` | .kt, .kts | build.gradle.kts, build.gradle, settings.gradle.kts, settings.gradle, pom.xml |
| Dart | `dart` | .dart | pubspec.yaml, pubspec.lock |
| Prisma | `prisma` | .prisma | schema.prisma, prisma/schema.prisma |

### Linters

| Server | ID | Extensions | Root Detection |
|--------|-----|------------|----------------|
| Biome | `biome` | .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts, .json, .jsonc, .vue, .astro, .svelte, .css, .graphql, .gql, .html | biome.json, biome.jsonc, package-lock.json, bun.lockb, bun.lock, pnpm-lock.yaml, yarn.lock |
| Oxlint | `oxlint` | .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts, .vue, .astro, .svelte | .oxlintrc.json, package-lock.json, bun.lockb, bun.lock, pnpm-lock.yaml, yarn.lock, package.json |
| ESLint | `eslint` | .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts, .vue | package-lock.json, bun.lockb, bun.lock, pnpm-lock.yaml, yarn.lock |
| Rubocop | `rubocop` | .rb, .rake, .gemspec, .ru | Gemfile, Gemfile.lock |

### Additional Languages

| Server | ID | Extensions/Filenames | Root Detection | Auto-Download |
|--------|-----|----------------------|----------------|---------------|
| Prisma | `prisma` | .prisma | schema.prisma, prisma/schema.prisma | npm |
| YAML | `yaml` | .yaml, .yml | package-lock.json | npm |
| Bash | `bash` | .sh, .bash, .zsh, .ksh | (project root) | npm |
| Dockerfile | `dockerfile` | .dockerfile, Dockerfile*, Containerfile* | (project root) | npm |
| PHP | `php` | .php | composer.json, composer.lock, .php-version | npm |
| ElixirLS | `elixir-ls` | .ex, .exs | mix.exs, mix.lock | GitHub + Mix |
| ZLS | `zls` | .zig, .zon | build.zig | GitHub |
| C# | `csharp` | .cs | .sln, .csproj, global.json | dotnet tool |
| F# | `fsharp` | .fs, .fsi, .fsx, .fsscript | .sln, .fsproj, global.json | dotnet tool |
| SourceKit | `sourcekit` | .swift | Package.swift | (system only) |
| Clangd | `clangd` | .c, .cpp, .cc, .cxx, .c++, .h, .hpp, .hh, .hxx, .h++ | compile_commands.json, compile_flags.txt, .clangd, CMakeLists.txt, Makefile | GitHub |
| JDTLS | `jdtls` | .java | pom.xml, build.gradle, build.gradle.kts, .project, .classpath | Eclipse |
| LuaLS | `lua-ls` | .lua | .luarc.json, .luarc.jsonc, .luacheckrc, .stylua.toml, stylua.toml, selene.toml, selene.yml | GitHub |
| OCaml | `ocaml` | .ml, .mli | dune-project, dune-workspace, .merlin, opam | (system only) |
| TerraformLS | `terraform` | .tf, .tfvars | .terraform.lock.hcl, terraform.tfstate | GitHub |
| TexLab | `texlab` | .tex, .bib | .latexmkrc, latexmkrc, .texlabroot, texlabroot | GitHub |
| Gleam | `gleam` | .gleam | gleam.toml | (system only) |

**Note:** Dockerfile server also matches files named `Dockerfile` or `Containerfile` (without extension).

## Adding a New Server

Expand Down Expand Up @@ -142,10 +176,16 @@ await manager.shutdown()
### Server Utilities

```typescript
import { getServerById, getServersForExtension } from '@pleaseai/code-lsp'
import { getServerById, getServersForExtension, getServersForFile, getServersForFilename } from '@pleaseai/code-lsp'

const server = getServerById('typescript')
const servers = getServersForExtension('.ts')

// For files like Dockerfile that don't have extensions
const dockerServers = getServersForFilename('Dockerfile')

// Best practice: use getServersForFile which checks both extension and filename
const allServers = getServersForFile('/path/to/Dockerfile')
```

## Configuration
Expand Down
2 changes: 2 additions & 0 deletions packages/lsp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,8 @@ export {
EslintServer,
getServerById,
getServersForExtension,
getServersForFile,
getServersForFilename,
GoplsServer,
KotlinServer,
LSP_SERVERS,
Expand Down
Loading