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
plugin inserts prettier:content when using webstorm #242
Comments
I tested this and when I hit undo, the part that I had seleced before is selected again. I think it could very well be related or the same issue as #233, I could imagine some ranged formatting being triggered when surrounding a selection with curly braces. regarding reproduction: I think you could probably try with the Intellij Community Edition. the javascript plugin should be based on the same code as Webstorm. |
@theweekendgeek The JavaScript plugin for IntelliJ IDEA is only available for the Ultimate edition (which has it pre-installed, making it practically equivalent to WebStorm). |
Also getting this but I'm using PyCharm Pro (which is basically a superset of WebStorm). @dummdidumm JetBrains provides free licenses to open source projects: https://www.jetbrains.com/community/opensource/#support |
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 ... |
I have the same Problem it never worked for me, I tested it a few times over the last year, but it never worked. In my experience, you don't need anything selected, it just cuts out the script part. It works for the JS files, though. |
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. |
@staticglitch that worked for me, thanks! |
Using "optimize imports" action still inserts this |
Executing the action "remove braces around function body" somewhere on an |
This problem is still happening on a lot of actions (on save, on reformat, when trying usual refactoring trick like surrounding something with curly brackets…). It's a nightmare and prevent the proper usage of prettier + svelte in webstorm. I tried several things but nothing worked properly. |
I found a workaround, which consists of disabling prettier entirely, and configuring the IDE formatter to apply prettier's rules instead. You can do this by navigating to However, this change is lost upon restarting the IDE, which I have created a bug ticket for and would appreciate everyone thumbs-upping it for prioritization as long as it's the only way to prevent the |
+1 P.S.
for those who lost their original file content due to this error: this prettier:content is base64 string, just decode it. |
+1 This is really annoying |
Do you have any updates on this matter? In my opinion, this is a serious issue that needs to be addressed. If someone could provide information on what needs to be done, I would be more than willing to help fix this annoying and show-stopping bug. |
This is an upstream bug/limitation. We need a way to hook into prettier's "format range" option: prettier/prettier#7639 |
@falkomerr manually configuring the prettier version to whatever package resides under Note: bug still occurs when "run on reformat" is selected, independent of what's enabled in "run on save" |
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:
Run for files
. CheckOn 'Reformat Code' action
andOn save
App.svelte
onMount
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 pressedundo
. 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.The text was updated successfully, but these errors were encountered: