Skip to content

refactor: deprecate LSPDocumentSymbolFeature.matchesPsiElement, which the Structure view no longer needs - #2288

Merged
lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:refactor/deprecate-matches-psi-element
Nov 26, 2026
Merged

lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:refactor/deprecate-matches-psi-element

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Deprecates LSPDocumentSymbolFeature.matchesPsiElement for removal. Nothing changes in behaviour: DocumentSymbolData.equals still calls it, so a client that overrides it keeps its behaviour in this release, and gets a deprecation warning before it stops being called.

Why

Since 0.20.0 (#1531), the Structure view selects the DocumentSymbolData that contains the caret, because findAcceptableElement returns it. StructureViewComponent.visitPathForElementSelection then compares document symbols with each other; this was checked in the bytecode of 2024.2 and 2026.3. Matching a document symbol with a PSI element, which this method does for equals, is reached only when a symbol is compared with the file's PsiFile. See #2285.

Changes

  • @Deprecated(since = "0.30.2", forRemoval = true) and an @deprecated Javadoc on matchesPsiElement, in the style of the other deprecations of 0.30.0.
  • DocumentSymbolData.equals keeps calling it, with @SuppressWarnings("removal") and a comment saying why.
  • docs/LSPApi.md marks the method deprecated.
Before After
matchesPsiElement is public API with no deprecation Deprecated for removal; still called, so the behaviour is unchanged

The next step, for 0.31.0 in #2285: tests that pin the Structure view's selection, then an equals that compares document symbols only, after which this method is no longer called.

Part of #2285

… the Structure view no longer needs

Since 0.20.0 (redhat-developer#1531), the Structure view selects the DocumentSymbolData that
contains the caret, and compares document symbols with each other. Matching a
document symbol with a PSI element is reached only when a symbol is compared
with the file's PsiFile.

The method is deprecated for removal, and still called by
DocumentSymbolData.equals, so a client that overrides it keeps its behaviour in
this release. Making equals compare document symbols only follows in redhat-developer#2285.

Part of redhat-developer#2285
@lagergren lagergren added this to the 0.30.2 milestone Nov 26, 2026
@lagergren lagergren added the debt label Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Documentation
    • Marked symbol-to-PSI matching as deprecated and slated for removal. The existing matching behavior remains unchanged.

The change deprecates matchesPsiElement for removal and updates its API documentation. DocumentSymbolData.equals continues to call the method, with a removal-warning suppression.

Changes: Document symbol matching

Layer / File(s) Summary
Deprecate matching and document compatibility
src/main/java/com/redhat/devtools/lsp4ij/client/features/LSPDocumentSymbolFeature.java, src/main/java/com/redhat/devtools/lsp4ij/features/documentSymbol/DocumentSymbolData.java, docs/LSPApi.md
matchesPsiElement is deprecated since 0.30.2 and marked for removal. The documentation describes the Structure View behavior. DocumentSymbolData.equals continues to call the method, with a removal-warning suppression.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Refactor

Merge Risk: Minimal · up to 54f48

This change deprecates matchesPsiElement and updates the documentation. Behavior is unchanged in this release, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: deprecating LSPDocumentSymbolFeature.matchesPsiElement, and gives the reason that the Structure view no longer needs it. The changeset matches this. The title is long …
Description check Passed The description states the purpose of the change. It deprecates matchesPsiElement for removal, explains that behavior is unchanged because DocumentSymbolData.equals still calls it, and lists the edits…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: deprecating LSPDocumentSymbolFeature.matchesPsiElement, and gives the reason that the Structure view no longer needs it. The changeset matches this. The title is long (104 characters) but remains specific and readable.

Full details: Description check

Explanation

The description states the purpose of the change. It deprecates matchesPsiElement for removal, explains that behavior is unchanged because DocumentSymbolData.equals still calls it, and lists the edits to the source and docs/LSPApi.md. It matches the changeset.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3962e245-e373-46fe-aea7-5098fa9fe1c0
Commits

Reviewing files that changed from the base of the PR and between 0bd5652 and 54f485f.

Files selected for processing: 3

  • docs/LSPApi.md
  • src/main/java/com/redhat/devtools/lsp4ij/client/features/LSPDocumentSymbolFeature.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/documentSymbol/DocumentSymbolData.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@codecov

codecov Bot commented Nov 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.42%. Comparing base (0bd5652) to head (54f485f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2288      +/-   ##
==========================================
- Coverage   58.43%   58.42%   -0.02%     
==========================================
  Files         846      846              
  Lines       36455    36455              
  Branches     7545     5721    -1824     
==========================================
- Hits        21304    21300       -4     
- Misses      12152    12154       +2     
- Partials     2999     3001       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lagergren

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lagergren

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lagergren
lagergren merged commit 6c6a167 into redhat-developer:main Nov 26, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant