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

After formatting JSON you need to scroll left to see the formatted result #48051

Closed
mackaaij opened this Issue Apr 17, 2018 · 14 comments

Comments

Projects
None yet
8 participants
@mackaaij

mackaaij commented Apr 17, 2018

Issue Type: Bug

After formatting text as JSON, the small preview in the top right shows the JSON neatly formatted. The main window is empty but does show line numbers.

Workaround: Scroll left or switch back and forth between screens to see the formatted JSON.

VS Code version: Code 1.22.2 (3aeede7, 2018-04-12T16:32:53.389Z)
OS version: Darwin x64 17.5.0

System Info
Item Value
CPUs Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz (4 x 3100)
Load (avg) 3, 3, 3
Memory (System) 16.00GB (0.42GB free)
Process Argv /Applications/Visual Studio Code.app/Contents/MacOS/Electron
Screen Reader no
VM 0%
Extensions (7)
Extension Author (truncated) Version
xml Dot 1.9.2
beautify Hoo 1.3.0
githistory don 0.4.0
mssql ms- 1.3.1
python ms- 2018.3.1
PowerShell ms- 1.6.0
team ms- 1.133.0
@vscodebot

This comment has been minimized.

Show comment
Hide comment
@vscodebot

vscodebot bot Apr 17, 2018

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

vscodebot bot commented Apr 17, 2018

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@jrieken

This comment has been minimized.

Show comment
Hide comment
@jrieken

jrieken Apr 17, 2018

Member

the small preview in the top right shows the JSON neatly

Do you mean the mini-map?

Member

jrieken commented Apr 17, 2018

the small preview in the top right shows the JSON neatly

Do you mean the mini-map?

@jrieken

This comment has been minimized.

Show comment
Hide comment
@jrieken

jrieken Apr 17, 2018

Member

Also, can you share the file with us and does this reproduce when running with extensions?

Member

jrieken commented Apr 17, 2018

Also, can you share the file with us and does this reproduce when running with extensions?

@mackaaij

This comment has been minimized.

Show comment
Hide comment
@mackaaij

mackaaij Apr 17, 2018

Yep the mini-map in the top right. I can't reproduce it with just a tiny line of JSON. How can I send you a longer string that I don't want to send via GitHub?

mackaaij commented Apr 17, 2018

Yep the mini-map in the top right. I can't reproduce it with just a tiny line of JSON. How can I send you a longer string that I don't want to send via GitHub?

@jrieken

This comment has been minimized.

Show comment
Hide comment
@jrieken

jrieken Apr 17, 2018

Member

You could mail it to me, but before that. How large (in MB) is that file? Is it hitting our limits?

Member

jrieken commented Apr 17, 2018

You could mail it to me, but before that. How large (in MB) is that file? Is it hitting our limits?

@mackaaij

This comment has been minimized.

Show comment
Hide comment
@mackaaij

mackaaij Apr 17, 2018

1388 characters according to vscode so you'll be fine :) It's a line of JSON I pasted from a log file.

mackaaij commented Apr 17, 2018

1388 characters according to vscode so you'll be fine :) It's a line of JSON I pasted from a log file.

@jrieken

This comment has been minimized.

Show comment
Hide comment
@jrieken

jrieken Apr 18, 2018

Member

Ok, please send to jrieken[at]microsoft.com. Thanks

Member

jrieken commented Apr 18, 2018

Ok, please send to jrieken[at]microsoft.com. Thanks

@mackaaij

This comment has been minimized.

Show comment
Hide comment
@mackaaij

mackaaij commented Apr 18, 2018

Done!

@jrieken

This comment has been minimized.

Show comment
Hide comment
@jrieken

jrieken Apr 18, 2018

Member

Hm, works for me. After hitting format I see that the file as 58 lines, the only slightly weird thing is that most content is scrolled horizontally and line 19 is mostly visible. Scrolling left shows all content for me..

Member

jrieken commented Apr 18, 2018

Hm, works for me. After hitting format I see that the file as 58 lines, the only slightly weird thing is that most content is scrolled horizontally and line 19 is mostly visible. Scrolling left shows all content for me..

@mackaaij

This comment has been minimized.

Show comment
Hide comment
@mackaaij

mackaaij Apr 18, 2018

Ah that seems to be a better description indeed. I don't see line 19 but indeed, if I scroll left I see all content. So no refresh is needed but something like scroll left and top would be nice.

mackaaij commented Apr 18, 2018

Ah that seems to be a better description indeed. I don't see line 19 but indeed, if I scroll left I see all content. So no refresh is needed but something like scroll left and top would be nice.

@mackaaij mackaaij changed the title from Formatting JSON requires a refresh to After formatting JSON you need to scroll left to see the JSON Apr 18, 2018

@mackaaij mackaaij changed the title from After formatting JSON you need to scroll left to see the JSON to After formatting JSON you need to scroll left to see the formatted result Apr 18, 2018

@jrieken

This comment has been minimized.

Show comment
Hide comment
@jrieken

jrieken Apr 18, 2018

Member

@alexandrudima Could this also be related to the replaceMove change? Or the opposite?

Member

jrieken commented Apr 18, 2018

@alexandrudima Could this also be related to the replaceMove change? Or the opposite?

@alexandrudima

This comment has been minimized.

Show comment
Hide comment
@alexandrudima

alexandrudima Apr 18, 2018

Member

No, it is not related to that.

The editor will try as much as possible to maintain the previous scroll position. I guess the formatter should call one of the .reveal* methods on the editor. But I'm not sure what it should reveal... perhaps the range that was formatted or the last edit range ?

Member

alexandrudima commented Apr 18, 2018

No, it is not related to that.

The editor will try as much as possible to maintain the previous scroll position. I guess the formatter should call one of the .reveal* methods on the editor. But I'm not sure what it should reveal... perhaps the range that was formatted or the last edit range ?

@alexandrudima alexandrudima removed their assignment Apr 18, 2018

@jrieken jrieken added the bug label Apr 19, 2018

@lordcheeto

This comment has been minimized.

Show comment
Hide comment
@lordcheeto

lordcheeto May 4, 2018

Same issue here (1.23.0). I would describe it as the scrollbar not updating on formatting. Specifically, when pasting a large amount of minified content like JSON into VS Code, it comes in as one long line and the horizontal scrollbar handle is very small compared to the track. When the document is formatted, the scrollbar isn't updating to fit the now normal width content.

While you can scroll left all the way to see the content, the scrollbar remains too large. Switching to another tab, and back again forces the scrollbar length to update, which has the side effect of forcing the content back into view.

lordcheeto commented May 4, 2018

Same issue here (1.23.0). I would describe it as the scrollbar not updating on formatting. Specifically, when pasting a large amount of minified content like JSON into VS Code, it comes in as one long line and the horizontal scrollbar handle is very small compared to the track. When the document is formatted, the scrollbar isn't updating to fit the now normal width content.

While you can scroll left all the way to see the content, the scrollbar remains too large. Switching to another tab, and back again forces the scrollbar length to update, which has the side effect of forcing the content back into view.

@brandber

This comment has been minimized.

Show comment
Hide comment
@brandber

brandber Jul 24, 2018

I'm also encountering this behavior. If specific examples are desired, please advise and I'll scrub some examples to share.

brandber commented Jul 24, 2018

I'm also encountering this behavior. If specific examples are desired, please advise and I'll scrub some examples to share.

@jrieken jrieken added this to the September 2018 milestone Sep 11, 2018

@jrieken jrieken closed this in da0a892 Sep 11, 2018

@misolori misolori added the verified label Sep 27, 2018

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