Open
Conversation
(allowing the principle upon which the Vue.js implementation is based to be applied to similar cases)
Implement Astro language server support using the new CompanionLanguageServer abstraction from PR oraios#829. This replaces the earlier standalone implementation to properly integrate with the companion server pattern. Key changes: - AstroLanguageServer extends CompanionLanguageServer - AstroTypeScriptServer as companion for TypeScript/JS handling in .astro files - Uses @astrojs/ts-plugin for TypeScript server integration - Proper initialization sequence matching Vue implementation pattern - Cross-file reference support through domain file indexing Test infrastructure: - Added test repository with sample Astro components - Basic tests for language server startup and symbol extraction - Symbol retrieval tests for TypeScript integration - Added 'astro' pytest marker 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix tuple unpacking for get_all_symbols_and_roots() in test files - Fix ref-count tracking bug in companion_ls.py when file already open 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove set() deduplication that caused ref_count leaks when same file was indexed multiple times across companion patterns. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add Astro entry to CHANGELOG.md with detailed description of dual-server architecture and CompanionLanguageServer abstraction - Document Vue refactoring that uses CompanionLanguageServer base class - Add Astro and Vue to README.md supported languages list 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update astro to ^5.16.6 (fixes CVE-2025-55303, CVE-2025-64525, CVE-2025-61925) - Update @astrojs/language-server to ^2.16.2 (valid npm version) - Update typescript to ~5.7.3 (valid version) - Use astro/tsconfigs/strict preset (removes redundant strict: true) - Add include/exclude fields per Astro best practices 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
feat: Add Astro language server support (based on CompanionLanguageServer)
…ll_symbol_tree
When querying a single file via request_full_symbol_tree(), the method was
returning the root symbols directly without wrapping them in a File symbol.
This broke find_referencing_symbols() for file-as-module patterns like Astro
components, where the file itself IS the symbol (e.g., Layout.astro = Layout).
The directory query path (lines 1188-1213) correctly creates a File symbol
wrapper with kind=SymbolKind.File, but the single file path did not.
This fix applies the same File symbol wrapper pattern to single file queries:
- Uses _open_file_context to get file data
- Creates UnifiedSymbolInformation with kind=File
- Sets proper range, location, and parent-child relationships
This enables find_referencing_symbols("Layout", "src/layouts/Layout.astro")
to correctly find the Layout symbol in Astro components.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
fix: correct astro language server default version to 2.16.2
Contributor
|
@dansasser thank you for the PR. Just wanted to say that I haven't forgotten this, but since it's a fairly large change it will still take me some time to find time to review it properly. We just have many higher priority issues at the moment. |
Author
|
@MischaPanch I understand completely. Thank you for taking the time to consider it. I love this project and use it everyday in my workflow. I'm more than happy to contribute to it or help maintain it in any way I can. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Astro Language Server Support
Summary
This PR adds support for Astro framework files using the
CompanionLanguageServerabstraction introduced in #829. The implementation follows the same dual-server architecture pattern used by Vue, where the domain-specific language server (Astro LS) handles.astrofiles while a companion TypeScript language server handles definitions, references, and rename operations for TypeScript/JavaScript code.Motivation
Astro is a popular web framework for building content-focused websites. Like Vue, Astro components contain embedded TypeScript/JavaScript in their frontmatter section, requiring coordination between the Astro-specific language server and TypeScript tooling for full IDE functionality.
Architecture
Dual Language Server Design
Key Components
CompanionLanguageServer(from #829)AstroLanguageServerCompanionLanguageServer@astrojs/language-serverfor Astro file handlingAstroTypeScriptServerTypeScriptLanguageServer@astrojs/ts-pluginfor Astro file understanding.astrofiles with language ID "astro" for plugin recognitionEmbeddedLanguageConfigtypescript_companion.pycreate_typescript_companion_config()- Standard TS config factoryprefer_non_node_modules_definition()- Definition prioritization logicFiles Changed
New Files
src/solidlsp/language_servers/astro_language_server.pysrc/solidlsp/companion_ls.pysrc/solidlsp/embedded_language_config.pysrc/solidlsp/typescript_companion.pytest/solidlsp/astro/__init__.pytest/solidlsp/astro/test_astro_basic.pytest/solidlsp/astro/test_astro_symbol_retrieval.pytest/resources/repos/astro/test_repo/Modified Files
src/solidlsp/ls_config.pyASTROtoLanguageenum, file matchers, LS class mappingsrc/solidlsp/language_servers/vue_language_server.pyCompanionLanguageServer(net -162 lines)src/solidlsp/language_servers/typescript_language_server.pyexecutable_pathparameter for custom TS server locationspyproject.tomlastropytest markertest/solidlsp/vue/test_vue_*.py@pytest.mark.vuemarkers (4 files)CHANGELOG.mdREADME.mdTest Repository Structure
Test Coverage
test_astro_basic.pytest_ls_is_runningtest_astro_document_symbols.astrofrontmatter (Props interface)test_typescript_document_symbolstest_find_definition_within_typescripttest_find_references_within_typescripttest_typescript_server_startstest_dual_server_definition_lookuptest_astro_file_with_frontmattertest_layout_astro_with_props_interfacetest_astro_symbol_retrieval.pytest_get_containing_symbol_in_typescript.tsfiles within Astro projecttest_find_references_to_typescript_exporttest_go_to_definition_from_typescripttest_format_utils_symbolsRuntime Dependencies
Automatically installed on first use:
@astrojs/language-server@2.16.8- Astro LSPtypescript@5.9.3- TypeScript SDKtypescript-language-server@5.1.3- TS LSP for companion serverConfigurable via
ls_specific_settingsinserena_config.yml:Relationship to #829
This PR depends on the
CompanionLanguageServerabstraction from #829:The base class handles:
If #829 is merged first, this PR may need a rebase to resolve conflicts in shared files.
Breaking Changes
None. This is purely additive.
Checklist
.cmdsuffix handling)CHANGELOG Entry
Already added to CHANGELOG.md:
Replaces #884 (closed) with proper
CompanionLanguageServer-based implementation per maintainer guidance.