usernamehw / vscode-error-lens

VSCode extension that enhances display of errors and warnings.
https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens
MIT License
588 stars 32 forks source link

Feature: Support a Code Lens to show the error above the line (#74 ) #202

Closed duncanawoods closed 5 months ago

duncanawoods commented 5 months ago

See https://github.com/usernamehw/vscode-error-lens/issues/74#issuecomment-2041204436

Things to consider:

  1. I have been too literal and called the feature Code Lens in the settings. Technically correctly... but it will be too confusing given the existing features are called Error Lens. Maybe better to call it Lens Above Code and make existing settings that refer to message to be Inline Message or Right Aligned Message or some such. I'm sure you have brighter ideas.
  2. The number of settings is already a little overhwhelming so I feel guilty about adding even more!
  3. I have left the default with both the Lens Above Code and the Right Aligned Message active but I imagine only one should be visible on first run.
  4. I have tried to integrate it in the same fashion as the the other features to initialise/dispose, handle state/config and process diagnostics with the same helper functions. I will likely have missed something though.
  5. I don't know much about vscode extensions so the event handling, initialisation and dispose are where I will have likely ballsed up.
duncanawoods commented 5 months ago
usernamehw commented 5 months ago

Please, lets not do webview as a part of this PR. 1 Feature - 1 PR.

duncanawoods commented 5 months ago

Sure no problem.

Are you interested in either of these things?

usernamehw commented 5 months ago

Code lens looks like a good feature to have. I'll review it this week.

Webview - not sure. Is it possible to drag-n-drop webview editors into a separate window (2nd monitor, for example) in latest VSCode version?

duncanawoods commented 5 months ago

Yep. With 1.85+ you can tear the tab out and float it or move it to another screen. This is a possible advantage over the built in Problems View which shares a window with the terminal so you can only see one or the other.

The only oddity is where windows appear on restarts. The view position we can pass to createWebviewPanel is limited to ViewColumn so if the user has e.g. redocked the window above their code, it won't restore to the same position. If it was the only tab in a pane in will leave a hole in the layout where it used to be. I've not looked into whether it can be moved after creation to restore it's position. Doesn't feel like extensions should have to save state and restore window positions though :shrug:.

usernamehw commented 5 months ago

What's the meaning of Unicode 2800 "braille pattern blank"? Does it have some sort of accessibility purpose here?

duncanawoods commented 5 months ago

I was having issues creating white space padding. The vscode Code Lens text rendering compresses white space and I found white space adjacent to symbols/emoji rendered with unpredictable width such that first one | second one could look like first one|second one. I believe I tried \u{00A0} before reaching for a less common white-space character that always rendered with the same width but I'm now doubting myself.

I'm can't replicate any issue where even a normal space isn't sufficient so I have replaced it.

There may be some rendering subtleties e.g. the specific characters/emoji adjacent to the white space, content of the message, lenses from other tools or possibly something in the theme. I'm noticing the ellipses character is rendering much more nicely than it was. It would sometimes be so compressed to be barely distinguishable from a single period ..