Skip to content

Merge ERRORS and HINTS in LSP computeDiagnostics - #9665

Closed
emilianbold wants to merge 1 commit into
apache:masterfrom
emilianbold:fix-9548-lsp-diagnostics-merge
Closed

emilianbold wants to merge 1 commit into
apache:masterfrom
emilianbold:fix-9548-lsp-diagnostics-merge

Conversation

@emilianbold

Copy link
Copy Markdown
Member

When both kinds were requested, the HINTS assignment overwrote the ERRORS list instead of merging into it, so compilation errors never reached the client. Make the result list mutable and accumulate both kinds with addAll.

Assisted-by: Z.ai GLM Latest


^Add meaningful description above

Click to collapse/expand PR instructions

By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -

  • are all your own work, and you have the right to contribute them.
  • are contributed solely under the terms and conditions of the Apache License 2.0 (see section 5 of the license for more information).

LLMs, Commit messages and PR description:

  • Please make sure (eg. git log) that all commits have a valid name and email address for you in the Author field.
  • LLM assisted commits should be attributed with an Assisted-by: MODEL_NAME MODEL_VERSION line appended to the commit message.
    • Please mention coding assistance in the PR description too (eg. by adding the same Assisted-by line from above)
    • Please describe the changes in your own words - we'd like to know you understand the changes being made!

If you're a first time contributor, see the Contributing guidelines for more information.

If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.

PR approval and merge checklist:

  1. Was this PR correctly labeled, did the right tests run? When did they run?
  2. Is this PR squashed?
  3. Are author name / email address correct? Are co-authors correctly listed? Do the commit messages need updates?
  4. Does the PR title and description still fit after the Nth iteration? Is the description sufficient to appear in the release notes?

If this PR targets the delivery branch: don't merge. (full wiki article)

When both kinds were requested, the HINTS assignment overwrote the
ERRORS list instead of merging into it, so compilation errors never
reached the client. Make the result list mutable and accumulate both
kinds with addAll.

Assisted-by: Z.ai GLM Latest
@emilianbold emilianbold self-assigned this Oct 5, 2026
@emilianbold emilianbold added ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) LSP [ci] enable Language Server Protocol tests labels Oct 5, 2026
@emilianbold
emilianbold requested a balanced review from Copilot October 5, 2026 05:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The new aggregation duplicates errors because computeDiags already returns merged diagnostics.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Updates LSP diagnostic collection to combine requested error and hint results.

Changes:

  • Uses a mutable result list.
  • Appends diagnostics from each requested kind.
File Description
TextDocumentServiceImpl.java Changes diagnostic result aggregation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 2153 to +2157
if (types.contains(ErrorProvider.Kind.ERRORS)) {
result = computeDiags(uri, -1, ErrorProvider.Kind.ERRORS, originalVersion, docHolder);
result.addAll(computeDiags(uri, -1, ErrorProvider.Kind.ERRORS, originalVersion, docHolder));
}
if (types.contains(ErrorProvider.Kind.HINTS)) {
result = computeDiags(uri, -1, ErrorProvider.Kind.HINTS, originalVersion, docHolder);
result.addAll(computeDiags(uri, -1, ErrorProvider.Kind.HINTS, originalVersion, docHolder));
@emilianbold

Copy link
Copy Markdown
Member Author

The issue is invalid. Closing PR.

@emilianbold emilianbold closed this Oct 5, 2026
@emilianbold
emilianbold deleted the fix-9548-lsp-diagnostics-merge branch October 5, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) LSP [ci] enable Language Server Protocol tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants