Skip to content

Inlay hints added to wrong buffer when original buffer is not active (lsp-javascript, lsp-rust) #3459

@shivjm

Description

@shivjm

Thank you for the bug report

  • I am using the latest version of lsp-mode related packages.
  • I checked FAQ and Troubleshooting sections
  • You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

#3455 inherited a bug from #3404 where it’s possible for inlay hints to be added to the wrong buffer. For example, watch the Magit buffer in this recording:

Inlay hints are incorrectly added to the active (Magit) buffer instead of the relevant buffer

This is happening because the handler for the async request is operating on whatever the active buffer is.

Steps to reproduce

These two steps must be performed in quick succession:

  1. Open a JavaScript or Rust file while having lsp-javascript-display-hints or lsp-rust-analyzer-server-display-hints (respectively) set to t.
  2. Immediately switch to another buffer.

Expected behavior

Inlay hints are added to the buffer they belong to.

Which Language Server did you use?

lsp-javascript
lsp-rust

OS

Windows

Error callstack

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions