Skip to content

Conversation

JoshuaBatty
Copy link
Member

@JoshuaBatty JoshuaBatty commented Sep 22, 2025

Description

  • Update SourceEngine::get_or_create_source_buffer to replace the cached buffer when the caller supplies different text.
  • Fixes an LSP bug where diagnostics/token spans stayed stuck on the initial buffer, causing erroneous results after text edits.

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@JoshuaBatty JoshuaBatty requested a review from a team as a code owner September 22, 2025 06:34
@JoshuaBatty JoshuaBatty self-assigned this Sep 22, 2025
@JoshuaBatty JoshuaBatty added bug Something isn't working language server LSP server compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen labels Sep 22, 2025
@JoshuaBatty JoshuaBatty requested review from a team and IGI-111 September 22, 2025 06:35
@JoshuaBatty JoshuaBatty enabled auto-merge (squash) September 22, 2025 07:00
Copy link
Contributor

@tritao tritao left a comment

Choose a reason for hiding this comment

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

Seems good, but I wonder if overall it would make sense to update the design in the future so we create a new source id every time we update the contents of the source buffer, to prevent spans pointing to outdated locations.

@JoshuaBatty JoshuaBatty merged commit dfb8214 into master Sep 22, 2025
43 checks passed
@JoshuaBatty JoshuaBatty deleted the josh/lsp_bug branch September 22, 2025 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen language server LSP server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants