question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow formatting unsaved files

See original GitHub issue

Would it be possible to allow formatting code that hasn’t been saved to a file yet?

I’m using JSON Reindent in Sublime to for example quickly open a new file, paste in a bunch of JSON, and format it to make it easier to read. Would be great if I could use JsPrettier for this instead, especially since it supports other stuff as well, like HTML.

I get the “JsPrettier: Format Code” option in the command palette, but I’m prompted with “File must be Saved.” Could that requirement be avoided somehow? Do it in memory somehow? Or if a file is needed to pass to the prettier executable, could JsPrettier for example use a tmp file behind the scenes or something?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
mischniccommented, May 21, 2019

I would use this often to format a snippet of code (instead of going to https://prettier.io/ and posting it there)

1reaction
jonlabellecommented, May 4, 2019

Hi @Svish. Great suggestion, but implementing such a feature now would take quite a bit of effort to re-work parser detect/set logic - and this is first time such a request has come up.

However, if more people show interest… we can definitely re-visit the topic.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I format documents that are not saved in visual studio ...
If i Shift + Alt + F (or use the command from the palette) on a Untitled tab on vscode the following command...
Read more >
Windows unsaved files - Microsoft Q&A
Try File > Open > Recover Unsaved Documents. Note that automatic saves are only supported with OneDrive. Comment. Comment
Read more >
How to recover an unsaved file in Word using ... - YouTube
Lots of panic attacks at work or school are caused by unsaved Word files. So, in this video, we are going to learn...
Read more >
How to Recover Unsaved Excel Files [All Options + Precautions]
Enable AutoSave and AutoRecover · Click the 'File' tab · Click on 'Options' · In the Excel Options dialog box, click on Save...
Read more >
How do I format all files in a Visual Studio Code project?
Select and open the folder with files to format on VSCode. Press Ctrl+Shift+P to open command palette.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found