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

Remove Unnecessary Horizontal Scroll with Word Wrap #56

Closed
karlhorky opened this issue Aug 18, 2020 · 15 comments
Closed

Remove Unnecessary Horizontal Scroll with Word Wrap #56

karlhorky opened this issue Aug 18, 2020 · 15 comments

Comments

@karlhorky
Copy link

When the error lens first appears, it creates a horizontal scroll, also if the user has word wrap set.

Kapture 2020-08-18 at 16 54 35

This problem alone is annoying, but potentially not currently fixable (I'm not sure if there are APIs for this in VS Code). I guess it's also tracked in #12 and microsoft/vscode#32856.

However, after the error lens is gone, it would be nice to at least remove the scrollbar again. If you look carefully in the gif above, changing tabs triggers this.

Can you think of any way to trigger a re-layout to remove the scrollbar again?

@karlhorky
Copy link
Author

Actually, would it be possible to completely disable the scroll like the gitlens.currentLine.scrollable option implemented at the link below?

https://github.com/eamodio/vscode-gitlens/blob/30e1d290e8f337d56596a030ff097eeabdd98eb7/src/annotations/annotations.ts#L355-L356

@karlhorky
Copy link
Author

karlhorky commented Aug 18, 2020

I can confirm that the textDecoration: 'none;position: absolute;' hack works to disable the scrollbars (although the lens text will not be wrapped - it will be cut off).

To be clear, the change would be to this code here:

const decInstanceRenderOptions: vscode.DecorationInstanceRenderOptions = {
...decorationRenderOptions,
after: {
...decorationRenderOptions.after || {},
contentText: truncateString(messagePrefix + diagnostic.message),
},
};

Diff:

 const decInstanceRenderOptions: vscode.DecorationInstanceRenderOptions = { 
 	...decorationRenderOptions, 
 	after: { 
 		...decorationRenderOptions.after || {}, 
+ 		textDecoration: 'none;position: absolute;',
 		contentText: truncateString(messagePrefix + diagnostic.message), 
 	}, 
 }; 

Maybe a setting for this?

@usernamehw
Copy link
Owner

usernamehw commented Aug 18, 2020

From the next version (not sure when it will be published yet):

"errorLens.scrollbarHackEnabled": true,

@karlhorky
Copy link
Author

Great, thanks!

@Tizoner
Copy link

Tizoner commented Nov 23, 2020

It's not working.

@usernamehw
Copy link
Owner

usernamehw commented Nov 23, 2020

@Tizoner If you are using my extension (not the one that was forked) and on the latest version 3.2.4 it should work.

@Tizoner
Copy link

Tizoner commented Nov 23, 2020

Is this forked one?
image

@usernamehw
Copy link
Owner

Any more details? What's not working? A .gif demonstrating the problem? Steps to reproduce?

@Tizoner
Copy link

Tizoner commented Nov 23, 2020

Horizontal scroll appears even with word wrap enabled.
On image below you can see both word wrap, error message that does not wrap, and resulting horizontal scroll bar.
image
This option doesn't change anything.
image

@usernamehw
Copy link
Owner

usernamehw commented Nov 23, 2020

Do you have other extensions that create inline decorations (insert text)? This hack only prevents showing scrollbar from this extension, not all extensions.

@Tizoner
Copy link

Tizoner commented Nov 23, 2020

No, I don't have other extensions that create inline decorations.
I've tested this by disabling error lens extension and doing the same steps as above without seeing appearance of the horizontal scroll bar.

@usernamehw
Copy link
Owner

Well, I have no idea why it doesn't work. You are welcome to investigate.

@karlhorky
Copy link
Author

@Tizoner hmm, strange. What version of VS Code? Still working for me with Version: 1.51.1.

Maybe try disabling all other extensions?

@Tizoner
Copy link

Tizoner commented Nov 23, 2020

Disabling of other extensions didn't help.
Here is my version of VS Code:
image

@karlhorky
Copy link
Author

@Tizoner looks pretty much the same as my version (except you're on Windows - I guess this is not an issue though).

I guess you've additionally already tried:

  1. Completely closing all VS Code windows and restarting
  2. Trying VS Code Insiders Edition

What are the settings when you ctrl-shift-P and select "Preferences: Open Settings (JSON)"? I'm guessing you have word wrap enabled...?

Can you record a gif of the behavior (eg. with ScreenToGif) and upload it here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants