feat: Add Deno LSP support - #1048
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for Deno projects via LSP integration, using the built-in deno lsp command. The implementation follows established patterns from other language servers in the codebase, particularly TypeScript, given Deno's JavaScript/TypeScript compatibility. The language server is marked as experimental and requires explicit configuration to avoid conflicts with the TypeScript language server for .ts files.
Changes:
- Added
DenoLanguageServerclass with npm-based auto-installation fallback when Deno isn't found on PATH - Registered Deno as an experimental language in the
Languageenum with appropriate file matchers (.ts,.tsx,.js,.jsx) - Added comprehensive tests including symbol lookup and cross-file reference tests with realistic Deno code samples
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/solidlsp/language_servers/deno_language_server.py | Main Deno LSP implementation with dependency management and LSP protocol handlers |
| src/solidlsp/ls_config.py | Language enum registration, file matchers, and experimental flag configuration |
| test/solidlsp/deno/test_deno_basic.py | Basic Deno language server tests for symbol lookup and references |
| test/serena/test_serena_agent.py | Integration tests for Serena agent with Deno support |
| test/resources/repos/deno/test_repo/* | Test repository with valid Deno code using JSR and Deno.land imports |
| pyproject.toml | Added pytest marker for Deno tests |
| README.md | Added Deno to supported languages list |
| docs/01-about/020_programming-languages.md | Documented Deno support with setup notes |
| CHANGELOG.md | Added entry for Deno support |
|
Need to explore the possibility of auto-detection based on the deno.json / deno.jsonc file. |
|
This commit (615bce2) adds a small universal code to the general logic of the project. |
Inside `case self.DENO`, mypy narrows self to Literal['deno'], so self.TYPESCRIPT is not accessible. Use Language.TYPESCRIPT instead.
There was a problem hiding this comment.
Thank you for the contribution! Only minor comments, except the one on the language detection mechanism
@opcode81 pls see my comment there. We may either fully address it ourselves on this branch, after my proposal has been implemented, or the author wants to perform the refactoring, or we merge it without the refactoring and postpone it.
|
|
||
| # Resolve conflicts between languages that share file extensions. | ||
| # Languages can declare project markers that give them precedence over another language. | ||
| for language in list(language_counts): |
| markers, overrides = override | ||
| if overrides not in language_counts: | ||
| continue | ||
| if any(os.path.exists(os.path.join(repo_path, m)) for m in markers): |
There was a problem hiding this comment.
here we rather need a method in Language, like get_conflicting_languages_to_have_preference_over(repo_path) -> list[Language]
The long function name is an indication that we lack a proper abstraction for the new concept introduced by this PR: not an experimental language but an actual conflict between viable alternatives that can only be resolved by looking into the project. While a full refactoring may be out of scope for this contribution (unless you would like to do that, in which case, go ahead!), at least we shouldn't expose the markers as part of the public interface. It should be internal to Language. The new method should also get a detailed docstring, explaining why it's needed
There was a problem hiding this comment.
The autodetection should then also be tested, using the new method on the typescipt and the deno test repos
|
|
||
| Auto-detected when deno.json, deno.jsonc, or deno.lock is found in the project root. | ||
|
|
||
| You can pass the following entries in ls_specific_settings["deno"]: |
There was a problem hiding this comment.
we document all extra settings in our docs, pls extend it there too
| @pytest.mark.deno | ||
| class TestDenoLanguageServer: | ||
| @pytest.mark.parametrize("language_server", [Language.DENO], indirect=True) | ||
| def test_find_symbol(self, language_server: SolidLanguageServer) -> None: |
There was a problem hiding this comment.
could you pls add a test making sure request_hover works? We found that some LS have problems with this, making it worth testing. I will extend our guide on LS support implementation accordingly
|
@nktkas ping |
fee8b1c to
d165272
Compare
420a0ba to
016ccbe
Compare
ee32c5e to
ebe7646
Compare
|
Deno support was added with #1778 |
Summary
Add support for https://deno.com/ projects.
Deno
deno lsp.ts,.tsx,.js,.jsxfilesdeno.json,deno.jsonc, ordeno.lockis found in the project root (replaces TypeScript LS)Changes
src/solidlsp/language_servers/deno_language_server.pysrc/solidlsp/ls_config.py,pyproject.tomlsrc/serena/util/inspection.pytest/solidlsp/deno/test_deno_basic.py,test/serena/test_serena_agent.py,test/resources/repos/deno/test_repo/*README.md,docs/01-about/020_programming-languages.md,CHANGELOG.md