Skip to content
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

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

Merged
merged 14 commits into from
Apr 14, 2024

Conversation

duncanawoods
Copy link

See #74 (comment)

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
Copy link
Author

duncanawoods commented Apr 9, 2024

  • renamed the Code Lens to Lens Above Code which should be clear enough
  • added an experimental web view described here Feature: Show error above/below the line #74 (comment) that behaves like the Status Bar feature with some advantages.
  • I experienced some infinite event loops when I had logs visible. If the extension code does anything that changes the content of a window it triggers it's own onchange events. I see there is some commented out code for throttling events that looks related. I have excluded output windows using the document uri which fixed what I saw.
  • I have added an output channel called Error Lens Debug for easier debugging of the extension once it's installed

@usernamehw
Copy link
Owner

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

@duncanawoods
Copy link
Author

Sure no problem.

Are you interested in either of these things?

@usernamehw
Copy link
Owner

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
Copy link
Author

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 🤷.

@usernamehw
Copy link
Owner

usernamehw commented Apr 13, 2024

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

@duncanawoods
Copy link
Author

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 ..

@usernamehw usernamehw merged commit a52869b into usernamehw:master Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants