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

svelte-check hangs for significant time on some specific .svelte module content #337

Closed
adamansky opened this issue Jul 23, 2020 · 4 comments
Assignees
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.

Comments

@adamansky
Copy link

adamansky commented Jul 23, 2020

Describe the bug

Running svelte-check on project with the following .svelte module content:

<script lang="ts">
  ///
  ///
  /// A:
  ///

  import { onMount } from 'svelte';

</script>

causes svelte-check eating 100% of CPU for 15 seconds on i7.

cd ./svelte-check-hangs

time  svelte-check 

real    0m14,159s
user    0m15,011s
sys     0m0,117s

To Reproduce
Create TypeScript project add .svelte module with content above.

Expected behavior
svelte-check should process this case within a 1-2 seconds

System (please complete the following information):

  • OS: Ubuntu 20.04
  • IDE: Any
  • Plugin/Package: svelte-check

Additional context
Sample project attached
svelte-check-hangs.tar.gz

PS:
If you add more leading comment slashes /// svelte-check computation time will grow exponentially. Lets try the following example:

<script lang="ts">

  ///
  ///
  ///
  ///
  /// A:
  ///

  import { onMount } from 'svelte';

</script>

@adamansky adamansky added the bug Something isn't working label Jul 23, 2020
@dummdidumm
Copy link
Member

It's this regex causing heavy computation.

@mvolkmann
Copy link

Maybe there needs to be a step before the content of a file is processed where all comments are removed.

@dummdidumm dummdidumm added the Fixed Fixed in master branch. Pending production release. label Jul 27, 2020
@mvolkmann
Copy link

@dummdidumm Thanks so much for this fix! The "Svelte for VS Code" extension is usable for me now!

@JohnnyFun
Copy link

fwiw, global replaces to files still gets chuggin pretty good because of formatter. In my case I did a find/replace across 369 files. I let it finish and told vscode to keep waiting. Probably took ~5-10min to finish.

I sometimes also see the formatter chugging on a single, fairly small file.

Btw, thanks for all your guys' recent work on this project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.
Projects
None yet
Development

No branches or pull requests

4 participants