-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add ability to show errors inline like VS Code(error lens) #4901
Comments
@victororlyk is not precisely the same as the error lens plugin, but have you already tried pressing |
@fdionisi yeah i have, those are cool, but I don't use f keys a lot. I have keyboard with f row and it is a bit annoying to use fs i use them only when it is really needed) https://happyhackingkb.com/. So a for me i just use vim keybinding to jump to the error for me it is faster) vim remappings would help )) |
Agree. This is key feature still keeping me on JetBrains (with Inspection Lens plugin). |
Hi, any updates on this? |
any update also here? |
Hello, thank you for all the great work you have done, it is a great editor, I just need this functionality to move from vscode to zed. 🚀 |
While looking into how to implement #4901, noticed that the current `Goto next/previous diagnostic` behaved a bit weirdly. That is, when there are multiple errors that have overlapping ranges, only the first one can be chosen to be active by the `go_to_diagnostic_impl`. ### Previous behavior: https://github.com/zed-industries/zed/assets/71292737/95897675-f5ee-40e5-869f-0a40066eb8e3 Doesn't go through all the diagnostics, and going backwards and forwards doesn't show the same diagnostic always. ### New behavior: https://github.com/zed-industries/zed/assets/71292737/81f7945a-7ad8-4a34-b286-cc2799b10500 Should always go through the diagnostics in a consistent manner. Release Notes: * Improved the behavioral consistency of "Go to Next/Previous Diagnostic"
…es#11139) While looking into how to implement zed-industries#4901, noticed that the current `Goto next/previous diagnostic` behaved a bit weirdly. That is, when there are multiple errors that have overlapping ranges, only the first one can be chosen to be active by the `go_to_diagnostic_impl`. ### Previous behavior: https://github.com/zed-industries/zed/assets/71292737/95897675-f5ee-40e5-869f-0a40066eb8e3 Doesn't go through all the diagnostics, and going backwards and forwards doesn't show the same diagnostic always. ### New behavior: https://github.com/zed-industries/zed/assets/71292737/81f7945a-7ad8-4a34-b286-cc2799b10500 Should always go through the diagnostics in a consistent manner. Release Notes: * Improved the behavioral consistency of "Go to Next/Previous Diagnostic"
Any updates on this? This is really keeping from switching to Zed. |
any update on this? i would really love this, it is a great experience to see errors in the same line, and don't need to hover my mouse over the error |
This comment was marked as spam.
This comment was marked as spam.
Hey there! I haven't touched Zed's extension system yet. However, if it's possible, I'd love to give implementing this a try! If you're aware of whether this could be implemented through an extension, please let me know. :) |
I had a look at this issue but ended up just implementing some fixes around the already built-in diagnostics that you can navigate through. From that experience, I'd personally see that it would make sense to implement this as a built-in option (i.e. no extension), with implementation steps being the following:
NOTE: I'm not affiliated with Zed, but would like to see this feature implemented, so shared my thoughts regarding the implementation. |
Still want this feature, whether as an extension or building setting to opt in |
This comment was marked as spam.
This comment was marked as spam.
I would prefer if this setting was built-in into the editor with the ability to toggle it on/off. |
Subscribing for an updates. |
I am also looking forward to this one. The only missing thing to switch |
If you don't have anything to add to the conversation, you can simply "thumbs-up" the original post and click the subscribe button. There is no need to send emails and notifications to hundreds of people just to say some variation of "+1". |
Fair enough, thanks for sharing @claire-west You’re right that sending emails to everyone doesn’t contribute directly to the discussion, but it can provide the much-needed visibility and momentum to ensure the topic gets the attention and engagement it deserves. |
It is easier for us to pick out an issue with high upvote count and read through comments that actually touch on the topic at hand rather than sift through a bunch of "+1's". Sending emails to everyone does not contribute directly to the discussion, nor does it add momentum. Please do not do that and just subscribe to the issue notifications instead (as @claire-west suggested). |
I have indeed sinned, for I did utter "+1" in place of subscribing and giving proper favor unto the original post. I shall mend mine ways. Neither shall I henceforth reply to posts decrying the lack of substance, only to add naught myself. Yea, I shall refrain from such vain replies, that I may no longer contribute to the emptiness of the conversation. |
(comment on #17269)
I think the proposal on the table is that for now, we do what VS Code does, which is to show as much of the diagnostic as possible at the end of the affected line, and truncate the rest. This is not perfect, of course, but it's something. The best doesn't need to be the enemy of the good here. Perhaps an emoji vote would help to take the temperature of those watching this issue? 👍 show at least these truncated diagnostics If there were a PR that did just this and nothing else, it might help us identify and solve any other blocking design issues that come up. |
no it is perfect. there is nothing more needed. there is no need to chase for the perfection when the topic is as simple as showing errors inline that is it |
My only nit from the implementation that was on a PR is that the errors were shown below the line, rather than on the side as ErrorLens does (on the screenshot). Truncating is fine. (Personally) I don't need the entire error or traceback or whatnot. I need to be able to see easily that there's a problem in a given line. More times than not I would be able to figure out what the error is without actually looking at the message. |
Really need this feature when working on rust code. |
To add to what @bitfield said: in this image if you click on the red error text, it should simply... navigate you to the |
Just showing my support for this feature. It's standard in Sublime Text and I would love to have it in Zed too. |
I occasionally use neovim for fun projects (but Zed is my daily driver), and I really like their way of displaying multiple diagnostics in the same line. They use the squares to indicate how many diagnostics of which type are in a single line: From @SomeoneToIgnore in #17269 (comment):
If we "copy" neovims way here we have a few advantages:
I think for the implementation we could reuse a lot of the stuff that @mrnugget did in the git-blame feature. I like the spacing between the end of the line and the git blame line (not sure how its called). I would also like to expose the colors of the different inline diagnostics in the theme config. If this sounds good to you, I can dig into neovims implementation and try to replicate it in Zed. (I think) I have enough time in the winter break to implement this, if we can agree on a design before :) Feedback is very welcome! |
This breaks the code flow a lot, though. |
Yes I would love this! |
Following up on #4901 (comment): I was playing around a little bit and I imagine something like this: Screen.Recording.2024-12-10.at.23.27.33.movObviously this needs a ton of work; it would be great to get some feedback here (especially from the Zed team). I'm happy to implement any design that you suggest and I'm happy to iterate on different designs ideas with you to figure out what works best :) I personally like the neovim way for inline diagnostics, but my personal opinion shouldn't matter here - we just need a starting point to iterate on in imo. |
That looks very good! I'm not even sure if I would change anything 😅 |
Would love to see this integrated and available for use, looks great! |
@nilskch That looks great! I was planning on spending some time over the holidays looking into replacing my earlier PR with the same git blame approach. Have you pushed that branch anywhere, I’d love to give it a whirl! |
Hey @davisp, not yet. I just wanted to check if I can implement something that I'd like. I also wanted to wait for a yes/no from the Zed team before I spend more time on this and eventually waste their time with a PR for a feature that they do not even want. I can tidy up the stuff that I did next week and push it to a branch. Would be awesome if we could make this work, I'm happy to help you on a V2 of your PR! |
@nilskch Just bumping this before the holidays in case you forgot. I should have some free time over the holidays to look at this so any leg up I can get would be awesome. No worries if not, we can always compare notes after the holidays and combine efforts then. |
Hey @davisp, I created a draft PR in my fork (nilskch#1) to share what I did so far. It's not much and just the bare minimum to test some designs. I left a few comments with a few ideas. I tweaked the text sizes slightly and I think this looks super nice and I would love to see this in Zed! Super happy that you want to give it a twirl!! :) Feel free to ping me if you want me to take a look (maybe on Discord since I don't want to spam 35 people? My Discord name is @mrnugget @SomeoneToIgnore sorry for tagging you directly, but could you give us a short yea or nay from the maintainers perspective on this before you go your well earned holiday? If you don't like this design we don't want to bother you with a PR and don't waste time on this... |
I spent some time hacking on this today and have gotten it to a place where I'm gonna start actually using it (though I've already been using it to hack on itself... which is kinda weird to be honest). I attempted to duplicate what it vaguely looks like neovim does. I don't use neovim and I'm not gonna bother installing it. But I basically just ran with 1 box per diagnostic, properly colored, topping out a (currently hardcoded) max of 5 box indicators with a + when there's more than five diagnostics on a line. The + is colored as a hint which seems to be a terrible choice. Also for some reason multple boxes end up being a few pixels different in height for some reason. I haven't got a clue why that is and nothing I tried fixed it. So it is what it is for now. I should also note, that the speed in the gif I uploaded has pretty much been my experience regardless of what I was working on. The The branch I've been working on (courtesy of @nilskch, thank you for kickstarting this!) is by no means ready to be merged. Right now the logic is just plopped into the huge prepaint method. Cleaning that up is obviously straightforward so I'm not too worried about it. We'll also want to add configurability as right now its currently reading a couple inline git blame settings. This also doesn't react very well to being mixed with inline git blame. I was hoping that'd just be magical but unfortunately they just both attempt to draw to the same location on screen. Edit to add a link to the branch in case anyone else wants to give it a whirl: https://github.com/davisp/zed/tree/davisp/nilskch/feat-inline-diagnostics Also, steps to actually run this branch if you're curious:
I haven't got any experience with the Linux or Windows ports so no idea if its that easy on those platforms. |
So I ended up coming down with the flu or something which means I'm in no condition to Think Real Hard. However, it turns out that tweaking UI elements in a thing I barely understand in 5m compiler loops is a perfect cure to the boredom of being sick. I'm not entirely sure if it was from a fever dream or not, but I also came up with an idea on how to display the extended diagnostics by hovering over the indicator to activate the diagnostic group using the existing machinery. I'm attaching another gif that shows how that works. Right now it's just a basic hover-to-activate ESC-to-deactivate sort of interaction similar to cycling through them with F8. At this point I'm fairly happy with things. The biggest missing piece at this point is probably the lack of configuration and tests (I still have no idea how to test these sorts of things). I may try and figure that out later today but more likely it'll be later this week. Ope! Edit to add I've also rebased this onto current main and code is on my branch as per usual: |
Does this actually work with any language servers or only Rust? |
@thejus-r It's not Rust specific. It should work just fine as long as the language server generates diagnostics. Below is a Python snippet for comparison. |
Check for existing issues
Describe the feature
It would be really nice to have ability to see the error inline without need to hover or go with cursor to that place.
I really love this extension, but I think it would be nice to have in the code of editor
If applicable, add mockups / screenshots to help present your vision of the feature
No response
The text was updated successfully, but these errors were encountered: