[PR #3242] feat: support astro lsp #10575

Closed
opened 2026-02-16 18:15:16 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/3242

State: closed
Merged: Yes


Summary

Adds Astro language server for .astro files.

Changes

• Added Astro LSP configuration (packages/opencode/src/lsp/server.ts)
• Auto-installs @astrojs/language-server when not available
• Resolves TypeScript SDK path from project's node_modules (required by Astro LSP)
• Passes typescript.tsdk initialization option to enable TypeScript features
• Registered .astro file extension (packages/opencode/src/lsp/language.ts)
• Updated LSP documentation (packages/web/src/content/docs/lsp.mdx)

Technical Details

The Astro language server requires the typescript.tsdk initialization option pointing to TypeScript's library directory
Related

Testing

Astro project

LSP Attachment Log - filtered log on editing .astro extension file

INFO  2025-10-17T12:13:46 +3ms service=lsp serverIds=deno, typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd, svelte, astro, jdtls enabled LSP servers
INFO  2025-10-17T12:14:47 +7ms service=lsp serverID=astro spawned lsp server
INFO  2025-10-17T12:14:47 +0ms service=lsp.client serverID=astro starting client
INFO  2025-10-17T12:14:47 +1ms service=lsp.client serverID=astro sending initialize
INFO  2025-10-17T12:14:47 +447ms service=lsp.client serverID=astro initialized
INFO  2025-10-17T12:14:47 +1ms service=lsp.client serverID=astro  textDocument/didOpen
INFO  2025-10-17T12:14:49 +766ms service=lsp.client serverID=astro  textDocument/publishDiagnostics
INFO  2025-10-17T12:14:49 +74ms service=lsp.client serverID=astro  textDocument/publishDiagnostics
INFO  2025-10-17T12:14:59 +0ms service=lsp serverID=typescript spawned lsp server
INFO  2025-10-17T12:14:59 +0ms service=lsp.client serverID=typescript starting client
INFO  2025-10-17T12:14:59 +0ms service=lsp.client serverID=typescript sending initialize
INFO  2025-10-17T12:14:59 +0ms service=lsp.client serverID=typescript initialized
INFO  2025-10-17T12:14:59 +1ms service=lsp.client serverID=typescript  textDocument/didOpen
INFO  2025-10-17T12:14:59 +0ms service=lsp.client serverID=typescript  textDocument/didOpen
INFO  2025-10-17T12:14:59 +4ms service=lsp.client serverID=typescript  textDocument/publishDiagnostics
INFO  2025-10-17T12:14:59 +11ms service=lsp.client serverID=typescript token=66713253-ea61-45a6-94da-94f60d552f76 window/workDoneProgress/create
INFO  2025-10-17T12:15:01 +87ms service=lsp.client serverID=typescript  textDocument/publishDiagnostics
INFO  2025-10-17T12:17:12 +39ms service=lsp.client serverID=typescript token=865ff6ee-1293-4766-9365-4482aacde6c1 window/workDoneProgress/create
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/3242 **State:** closed **Merged:** Yes --- ## Summary Adds Astro language server for .astro files. ## Changes • Added Astro LSP configuration (packages/opencode/src/lsp/server.ts) • Auto-installs @astrojs/language-server when not available • Resolves TypeScript SDK path from project's node_modules (required by Astro LSP) • Passes typescript.tsdk initialization option to enable TypeScript features • Registered .astro file extension (packages/opencode/src/lsp/language.ts) • Updated LSP documentation (packages/web/src/content/docs/lsp.mdx) ## Technical Details The Astro language server requires the typescript.tsdk initialization option pointing to TypeScript's library directory Related - [LSP code](https://github.com/withastro/language-tools/blob/main/packages/vscode/src/client.ts#L69) - [Issue](https://github.com/withastro/language-tools/issues/559) ## Testing ### Astro project LSP Attachment Log - filtered log on editing .astro extension file ``` INFO 2025-10-17T12:13:46 +3ms service=lsp serverIds=deno, typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd, svelte, astro, jdtls enabled LSP servers INFO 2025-10-17T12:14:47 +7ms service=lsp serverID=astro spawned lsp server INFO 2025-10-17T12:14:47 +0ms service=lsp.client serverID=astro starting client INFO 2025-10-17T12:14:47 +1ms service=lsp.client serverID=astro sending initialize INFO 2025-10-17T12:14:47 +447ms service=lsp.client serverID=astro initialized INFO 2025-10-17T12:14:47 +1ms service=lsp.client serverID=astro textDocument/didOpen INFO 2025-10-17T12:14:49 +766ms service=lsp.client serverID=astro textDocument/publishDiagnostics INFO 2025-10-17T12:14:49 +74ms service=lsp.client serverID=astro textDocument/publishDiagnostics INFO 2025-10-17T12:14:59 +0ms service=lsp serverID=typescript spawned lsp server INFO 2025-10-17T12:14:59 +0ms service=lsp.client serverID=typescript starting client INFO 2025-10-17T12:14:59 +0ms service=lsp.client serverID=typescript sending initialize INFO 2025-10-17T12:14:59 +0ms service=lsp.client serverID=typescript initialized INFO 2025-10-17T12:14:59 +1ms service=lsp.client serverID=typescript textDocument/didOpen INFO 2025-10-17T12:14:59 +0ms service=lsp.client serverID=typescript textDocument/didOpen INFO 2025-10-17T12:14:59 +4ms service=lsp.client serverID=typescript textDocument/publishDiagnostics INFO 2025-10-17T12:14:59 +11ms service=lsp.client serverID=typescript token=66713253-ea61-45a6-94da-94f60d552f76 window/workDoneProgress/create INFO 2025-10-17T12:15:01 +87ms service=lsp.client serverID=typescript textDocument/publishDiagnostics INFO 2025-10-17T12:17:12 +39ms service=lsp.client serverID=typescript token=865ff6ee-1293-4766-9365-4482aacde6c1 window/workDoneProgress/create ```
yindo added the pull-request label 2026-02-16 18:15:16 -05:00
yindo closed this issue 2026-02-16 18:15:16 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10575