Extend LSP capabilities: 17 protocol features via TreeSitter adapter#387
Merged
Extend LSP capabilities: 17 protocol features via TreeSitter adapter#387
Conversation
Add 22 new tests (96 → 118 total) covering gaps in mock adapter unit tests (findReferences, formatRange), server-layer LSP4J wiring for all 14 capabilities, and integration tests for signatureHelp, rangeFormatting, and inlayHint. Update KDoc across XtcCompilerAdapter, TreeSitterAdapter, and MockXtcCompilerAdapter with per-method documentation explaining LSP capability, adapter implementations, and compiler upgrade path. Update MANUAL_TEST_PLAN.md feature matrix to reflect newly implemented features (rename, codeAction, formatting, foldingRange, documentHighlight, documentLink, signatureHelp, selectionRange) and add headless Neovim test commands to EDITOR_SETUP.md.
Feature matrices in 5 documentation files were outdated, showing many LSP capabilities as stubs/future that are now fully implemented in both the Mock and TreeSitter adapters (rename, code actions, formatting, folding ranges, document highlights, document links, signature help, selection ranges).
Contributor
Author
|
This is put up here as a browsable preview for interested bleeding edge testers, but it is not ready for review so please don't waste time on this until it is out of DRAFT mode. |
…the kdocs in the language server common api implemantation code.
- Fix findServerJar() to use PluginManagerCore instead of hardcoded IntelliJIdea2025.1 paths that broke on other IDE versions - Replace hardcoded ~/.gradle paths with gradle.gradleUserHomeDir - Fix incorrect IDE cache path (was com.jetbrains.intellij.idea, actually idea/ideaIC) - Use providers.systemProperty() for maven local repo (config cache safe) - Add warnings when using local IDE mode (brittle version mismatches) - Add cache purge instructions in build script comments - Fix ktlint violations in build.gradle.kts
- Show "Server Started" notification only once per IDE session using AtomicBoolean guard (LSP4IJ may spawn multiple concurrent instances) - Remove --enable-native-access flag (FFM API finalized in Java 22, unnecessary on our target Java 25, may trigger experimental alerts) - Document LSP4IJ multi-spawn race condition with issue references: lsp4e#512 (same bug, fixed in PR #520), lsp4ij#888 (related)
- JreProvisioner now logs the full resolution chain: all registered JDKs with versions, which are suitable, and what was selected - New configureSandboxLogging task pre-seeds log-categories.xml to enable INFO-level logging for org.xtclang in the sandbox IDE
FFM API is finalized since Java 22. Since the project targets Java 25, this flag is no longer needed anywhere. Removed from editor setup docs and Gradle JVM args.
The LSP server runs out-of-process and its logs were only visible in IntelliJ's LSP4IJ panel. Now the runIde task starts a daemon thread that tails ~/.xtc/logs/lsp-server.log and streams lines to the Gradle console with a [lsp-server] prefix. The thread is interrupted in doLast to prevent it lingering in the Gradle daemon. Also enhances runIde startup logging with version matrix, IDE cache layer details, sandbox status, and reset commands. Updates the README with sandbox architecture documentation and corrects the outdated LSP architecture diagram.
Enable the test task for the IntelliJ plugin module with JUnit Jupiter and AssertJ. Extract JAR resolution into a testable companion function and widen JreProvisioner filesystem methods to internal for testing. LspServerJarResolutionTest verifies bin/xtc-lsp-server.jar lookup across correct and incorrect plugin directory layouts (5 tests). JreProvisionerTest covers findCachedJava() layouts, directory flattening, and failure marker lifecycle (11 tests).
- Fix getSignatureHelp returning null: the grammar parses `name(args)` as generic_type (not call_expression) since it can't distinguish calls from type expressions without semantic analysis. Handle both node types. - Fix argument node lookup: use correct grammar name "arguments" instead of "argument_list". - Strengthen signature help tests to assert non-null results with exact label/parameter checks instead of silently passing on null. - Fix British English spellings: linearise->linearize, recognises->recognizes. - Fix unpaired symbol warnings: wrap `$"` and `$|` in backticks in KDoc. - Fix pre-existing ktlint indentation issues.
Expand test coverage from 42 to 68 active tests across all LSP features: - SignatureHelp: +11 tests (no-arg, 3-arg active param tracking, overloads, nested inner/outer calls, cross-method, 5-param, open-paren, unknown method) - CallPatternParsing: +3 tests (new expression, declaration site, bare ref) - CompletionsAtCallSite: +2 tests (sibling methods, multi-class symbols) - SelectionRangesAtCallSite: +3 tests (call arg, nested arg, multi-position) - Completions: +1 test (method names from compiled source) - Definition: +2 tests (method from call site, class from type usage) - DocumentHighlights: +1 test (method across declaration + calls) - FoldingRanges: +1 test (deeply nested declarations) - FindReferences: +1 test (method refs across declaration + calls) Add SLF4J logger with logged() helper for verbose test output showing full adapter return values (signatures, locations, highlights, ranges).
ggleyzer
approved these changes
Feb 10, 2026
The lang build (LSP server, IntelliJ plugin, tree-sitter) works but is not yet ready to be enabled by default on this branch.
Deferring the @NotNull and import changes to the next iteration.
Contributor
Author
This is now complete and no longer draft. I will merge after a final round of sanity checking. |
…on catalog - Add centralized ktlint configuration in lang root build: pin engine version from version catalog, auto-format before check so developers never see formatting-only failures - Add lang- prefix to all lang-only version catalog entries for clear scoping (lang-kotlin, lang-ktlint, lang-lsp4j, lang-intellij-*, lang-zig, etc.) - Restructure libs.versions.toml: alphabetical sorting within sections, clear section headers, tree-sitter deps in own section - Add debug-adapter subproject with DAP server scaffold (XtcDebugServer, XtcDebugServerLauncher, logback config) - Fix redundant libs.versions.lang.zig.get() call in tree-sitter build
07d5038 to
1b8e040
Compare
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.
Summary
This PR extends the XTC language server with comprehensive LSP protocol support, backed by an incremental tree-sitter parser with full XTC grammar coverage.
Key achievements
.xfiles fromlib_*parse successfully with the tree-sitter grammarlibs.versions.toml, grouped all IntelliJ-specific versions togetherLSP feature matrix
What's not yet implemented (next steps)
.and:(requires type inference)Build & infrastructure changes
runIdeTest plan
lsp-server:test— all TreeSitterAdapter, MockAdapter, and integration tests passlsp-server:ktlintCheck— no style violationsintellij-plugin:compileKotlin— plugin builds cleanly with version catalog referencesjavatools:test— existing tests unaffectedrunIdelaunches IntelliJ with working LSP features (hover, completion, go-to-definition, etc.)