Skip to content

Conversation

@Sysix
Copy link
Member

@Sysix Sysix commented Oct 14, 2025

Now the language server can use the primary span for the diagnostic. This was not possible before.
The idea came from @camc314 in a previous PR, when I refactored away the MessageWithPosition struct

Use the message span, it is already the primary span

@github-actions github-actions bot added A-editor Area - Editor and Language Server C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Oct 14, 2025
Copy link
Member Author

Sysix commented Oct 14, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Sysix Sysix requested a review from Copilot October 14, 2025 18:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the language server's diagnostic handling to prioritize primary spans when creating LSP diagnostic ranges. Previously, the code always used the first available span for positioning, but now it searches for and uses the primary span when available, falling back to the first span if no primary span exists.

  • Enhanced diagnostic positioning logic to use primary spans for more accurate error reporting
  • Added fallback mechanism for cases where no spans are available
  • Improved the accuracy of diagnostic range reporting in the language server

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Sysix Sysix changed the title refactor(language_server): use primary span, if available, for Diagnostic's Range refactor(language_server): use Message span for Diagnostic's Range Oct 14, 2025
@Sysix Sysix force-pushed the 10-14-refactor_language_server_use_primary_span_if_available_for_diagnostic_s_range branch from 70e1e36 to 1c7fb41 Compare October 14, 2025 18:40
@Sysix Sysix requested a review from Copilot October 14, 2025 18:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Sysix Sysix marked this pull request as ready for review October 14, 2025 18:43
@Sysix Sysix requested a review from camc314 as a code owner October 14, 2025 18:43
@Sysix Sysix force-pushed the 10-14-refactor_language_server_use_primary_span_if_available_for_diagnostic_s_range branch from 1c7fb41 to 3fec678 Compare October 15, 2025 18:04
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Oct 15, 2025
Copy link
Contributor

camc314 commented Oct 15, 2025

Merge activity

…14600)

~~Now the language server can use the primary span for the diagnostic. This was not possible before.
The idea came from @camc314 in a previous PR, when I refactored away the `MessageWithPosition` struct~~

Use the message span, it is already the primary span
@graphite-app graphite-app bot force-pushed the 10-14-refactor_language_server_use_primary_span_if_available_for_diagnostic_s_range branch from 3fec678 to 9a589ca Compare October 15, 2025 21:09
@graphite-app graphite-app bot merged commit 9a589ca into main Oct 15, 2025
21 checks passed
@graphite-app graphite-app bot deleted the 10-14-refactor_language_server_use_primary_span_if_available_for_diagnostic_s_range branch October 15, 2025 21:12
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-editor Area - Editor and Language Server C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants