zed icon indicating copy to clipboard operation
zed copied to clipboard

Diagnostics inline message not going away after fix

Open jader-rubini opened this issue 1 year ago • 5 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

I noticed in the last few days that my inline diagnostics messages aren't going away anymore after I apply the fixes, not even after I save the file again. The only way to make them go is closing the buffer and reopening again, which is not a great experience when you're working iteratively.

In the example below, it should have gone after I provided the second argument, but it's still there.

Screenshot 2024-08-12 at 18 30 44

Environment

Zed: v0.147.2 (Zed) OS: macOS 14.5.0 Memory: 16 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log

jader-rubini avatar Aug 12 '24 21:08 jader-rubini

I'm experiencing the same thing with typescript lsp.

Zed 0.160.7 MacOS 14.6.1 (Apple M1 Pro)

Screenshot 2024-11-11 at 10 01 08 PM

dlants avatar Nov 12 '24 06:11 dlants

I have the same issue with Rust 🦀 and Rust-Analyzer LSP.

Here is my current workaround for this:

Config:

{
    "context": "Editor",
    "bindings": {
       "cmd-s": ["workspace::SendKeystrokes", "cmd-s escape"]
    }
}
  1. ⚠️ So, let's say there is a file with an error and a diagnostic message showing inline after editor::GoToDiagnostic command.
  2. 🛠️ I fix the error.
  3. 💾 I press cmd-s to save the file. All diagnostic inline messages go away (both fixed the unfixed ones).
  4. 🔁 I have to press the hotkey assigned to editor::GoToDiagnostic again to move on.

bofm avatar Dec 19 '24 09:12 bofm

I also tried to do "alt-o": ["workspace::SendKeystrokes", "cmd-s escape alt-o"] where alt-o is bound to editor::GoToDiagnostic. But it didn't work because the key combination hits much faster than the language server rechecks and clears the diagnostic error for the fixed code. Some kind of delay before re-running the editor::GoToDiagnostic is required.

bofm avatar Dec 19 '24 09:12 bofm

Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and we will keep it open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, we'll close it in 7 days. Thanks for your help!

github-actions[bot] avatar Apr 23 '25 07:04 github-actions[bot]

The inline diagnostic messages now disappear after save.

bofm avatar Apr 25 '25 07:04 bofm

I agree with @bofm, this looks like its fixed now. The diagnostic disappears when navigating away from it and when saving.

Environment Zed: 0.201.8 OS: macOS 15.6.1 Memory: 36 GiB Architecture: aarch64

Have tested on with Rust and Go with these examples.

Rust

use std::convert::From;

#[derive(Debug)]
struct Number {
    value: i32,
}

impl From<i32> for Number {
    fn from(item: i32) -> Self {
        Number { value: item }
    }
}

fn main() {
    let num = Number::from("30");
    println!("My number is {:?}", num);
}

Go

package main

import "fmt"

func intSeq() func() int32 {
	i := 0
	return func() int {
		i++
		return i
	}
}

func main() {
	nextInt := intSeq()

	fmt.Println(nextInt())
	fmt.Println(nextInt())
	fmt.Println(nextInt())

	newInts := intSeq()
	fmt.Println(newInts())
}

Tested by doing

  • Open the file, go to the error with editor: go to diagnostic.
  • Fix the error and save.
  • The diagnostic disappears, there are different behaviors, my guess is that this is because the LSPs operate differently. Both disappear when fixing the error though
    • For Go it disappears as soon as I start removing 32 from int32.
    • For Rust it disappears after saving.

@jader-rubini Can you retest?

mikalsande avatar Aug 30 '25 07:08 mikalsande