Unwanted reformatting on save #28
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
repos/svelte-sublime#28
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I am using the
JsPrettierplugin to format all of code but it is conflicting with the auto formatting done by this package. I am not sure why but this plugin reformats the svelte file on save. I don't expect this behaviour of a syntax highlighter and can see a way of turning it off.One example of this automatic formatting is that the
prettier-plugin-sveltewants anything inside of a conditional render to be indented:But when I have this plugin installed, the plugin seems to remove this indentation on save:
Since I run prettier as a precommit hook I always run into an error because the plugin is overriding the
JsPrettierplugins changes.Since this is meant to be a syntax highlighter I would suggest removing this, or at least adding a setting to disable it.
@p-mercury Hmm, so this plugin does not do any sort of auto-formatting or writing to any project files whatsoever. Whatever issue you're seeing here, it can't be caused by this plugin.
That is very strange, I'll do a bit of investigation to see whats happening. The reason I suspect something with this package is that when I disable it in the package manager and then press save on the file, prettier adds back in the lost indentation.
I can't seem to figure out what is causing this, whenever I have this plugin enabled prettier (with the svelte extension) removes certain indentation like shown in the initial. If someone else can figure it out please let me know.
@p-mercury If I had to guess, I'd say you likely have a plugin that's applying formatting based on file scope and/or syntax. When you have this plugin installed your file will have a scope of
text.html.svelteand a syntax ofSvelte. Otherwise, these files would just be HTML or Plain Text and potentially treated differently on save than when you have this plugin installed. It's possibleprettier-plugin-svelteitself is treating these files differently based on scope and/or syntax or there is another plugin in the mix that's causing this. But again, this package is just a.sublime-syntaxfile so there's no way this plugin is the actual root issue.Thank you very much for pointing that out, that helped me find a solution.
This issue describes the same issue but with LiquidJS and has a solution.
@p-mercury Fantastic! Glad you were able to get down to the root of it.