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.

plugin inserts prettier:content when using webstorm

See original GitHub issue

example svelte project using the default template: https://github.com/theweekendgeek/svelte-prettier-example)

This s happening in WebStorm, I could not yet reproduce this in Visual Studio Code. I would assume that other IDEs from Jetbrains behave the same. Not sure If I might need to be raising this issue with them, because of the way the IDE calls Prettier for example.

How to reproduce:

  1. open project in webstorm
  2. in Settings -> Prettier: make sure prettier package is selected, add svelte extension to Run for files. Check On 'Reformat Code' action and On save
  3. open App.svelte
  4. select onMount
  5. type opening curly brace to surround with curly braces
  6. prettier:content is inserted instead of reformatted code

What I have found out so far:

  • In General I can call the Reformat with Prettier action without problems. I will format the code as expected, except when I have just done the sequence above and pressed undo. In this case the same result as above will shown.

  • I can workaround the issue by disabling the On 'Reformat Code' action option in the Prettier Settings.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
freeform99commented, Feb 11, 2022

Same problem here, with Webstorm. Unfortunately, entire script tag content got lost, which I only noticed some hours later, so lots of work to restore original file …

1reaction
staticglitchcommented, Apr 19, 2022

Experiencing the same issue on PhpStorm. Triggers on selecting something, then wrapping with {}. This is too complex for me to solve…

Workaround is: turn OFF prettier for “on reformat code” actions, and turn ON “on save.” Then simply use save shortcut instead of reformat.

Read more comments on GitHub >

github_iconTop Results From Across the Web

prettier-plugin-svelte - Bountysource
plugin inserts prettier:content when using webstorm $ 0 · In General I can call the Reformat with Prettier action without problems. · I...
Read more >
Install plugins | WebStorm - JetBrains
Use the Marketplace tab to browse and install plugins from the JetBrains Plugin Repository or from a custom plugin repository. Use the Installed ......
Read more >
Code completion | WebStorm Documentation - JetBrains
You can create syntactically correct code constructs by using statement completion Ctrl+Shift+Enter . It inserts the necessary syntax elements ( ...
Read more >
Generate code | WebStorm Documentation - JetBrains
You can also define custom templates to cover use cases specific to your workflow. You can create code constructs by inserting and expanding ......
Read more >
Queries | WebStorm Documentation - JetBrains
Please note that it is a paid plugin. Configure code style for INSERT, UPDATE, WITH, SELECT, FROM, and other query structures.
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