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

Very slow when used with prettier-atom #60

Closed
severo opened this issue Oct 10, 2019 · 4 comments
Closed

Very slow when used with prettier-atom #60

severo opened this issue Oct 10, 2019 · 4 comments

Comments

@severo
Copy link

severo commented Oct 10, 2019

After installing prettier-plugin-svelte, saving a .svelte file in Atom (with prettier-atom formatting on save) turns to be very slow.

I published explanations to replicate here: https://github.com/severo/atom_prettier_svelte

Note that calling prettier from the CLI is instantaneous.

@Fil
Copy link

Fil commented Oct 10, 2019

I can confirm the issue on @severo's project — takes 15s to save the Large.svelte file. (Atom 1.40.1, prettier-atom 0.57.3, macOS 10.14.6).

@chrisbrown-io
Copy link
Contributor

chrisbrown-io commented Oct 29, 2019

I've been having the same issue when using prettier-plugin-svelte with SublimeJsPrettier.

Narrowed it down to being an issue with the cursorOffset/--cursor-offset argument being passed to the prettier cli.

It doesn't currently look like there is a way to disable this within prettier-atom (looks like they're working on it), but this is definitely the cause of the issue.

I'm not sure if this is an issue with the plugin internally calculating the cursor-offset, or prettier itself - will look into if I get more time.

e.g

When taking a moderately large .svelte file (100 lines+), without --cursor-offset argument, processed in < 1s:

prettier Example.svelte --config .prettierrc --loglevel debug

Whereas if you add the --cursor-offset argument, it's taking anywhere from 10s upwards
(0 as cursor offset is used as an example here, would be populated with correct integer by your IDE automatically) :

prettier Example.svelte --config .prettierrc --loglevel debug --cursor-offset 0

@jamesbirtles
Copy link
Contributor

Very strange, thanks for the investigation @chrisbrown-io

@antonbrams
Copy link

do we have any solution for this issue? For some reason the prettier-plugin-svelte in combination with prettier-atom works freaking slow. With plain .js prettier-atom performs good. How can i fix a minute freeze of a svelte file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants