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

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

Closed
mackaaij opened this issue Apr 17, 2018 · 14 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug formatting Source formatter issues verified Verification succeeded

Comments

@mackaaij
Copy link

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

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:

@ramya-rao-a ramya-rao-a added json JSON support issues formatting Source formatter issues labels Apr 17, 2018
@jrieken jrieken added the info-needed Issue requires more information from poster label Apr 17, 2018
@jrieken
Copy link
Member

jrieken commented Apr 17, 2018

the small preview in the top right shows the JSON neatly

Do you mean the mini-map?

@jrieken
Copy link
Member

jrieken commented Apr 17, 2018

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

@mackaaij
Copy link
Author

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

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

@jrieken
Copy link
Member

jrieken commented Apr 18, 2018

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

@mackaaij
Copy link
Author

Done!

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

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 Formatting JSON requires a refresh After formatting JSON you need to scroll left to see the JSON Apr 18, 2018
@mackaaij mackaaij changed the title After formatting JSON you need to scroll left to see the JSON After formatting JSON you need to scroll left to see the formatted result Apr 18, 2018
@jrieken jrieken removed json JSON support issues info-needed Issue requires more information from poster labels Apr 18, 2018
@jrieken
Copy link
Member

jrieken commented Apr 18, 2018

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

@alexdima
Copy link
Member

alexdima 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 ?

@alexdima alexdima removed their assignment Apr 18, 2018
@jrieken jrieken added the bug Issue identified by VS Code Team member as probable bug label Apr 19, 2018
@lordcheeto
Copy link

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

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
@miguelsolorio miguelsolorio added the verified Verification succeeded label Sep 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug formatting Source formatter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

8 participants