Language-tools: Svelte Beta breaks other extensions like vscode-javascript and prettier-vscode

Created on 19 Jun 2020  ·  17Comments  ·  Source: sveltejs/language-tools

Describe the bug
JavaScriptSnippets stops working or becomes very slow in Svelte components. Also constantly breaking prettier-vscode formatting.

To Reproduce
Install JavaScriptSnippets, open a reasonably large svelte file and try to trigger a snippet.

Expected behavior
Snippets should open instantly like they do in js files not hang for seconds / indefinitely

System (please complete the following information):

  • OS: MacOS 10.15.5
  • IDE: VSCode 1.46.1
  • Plugin/Package: Svelte Beta and JavaScriptSnippets
bug

All 17 comments

Svelte Beta is also a format provider, we have our own set of prettier using prettier's npm package. As far as I know, you can't use both. Is your setup works at all or it works but extremely slow.

I removed prettier but JavaScriptSnippets still doesn't work.

Video of the problem: https://streamable.com/23vdzs

Takes 40 seconds for the snippet to appear!

What I said is only about prettier though. These two are separate issues.

About JavaScriptSnippets, does other javascript completion also that slow?

@jarrodldavis fair enough, I was guessing it's the language server hanging causing vscode (including extensions) to hang.

Yes all auto-completion is slower, just not quite 40s slow, more 5/10 Secs

@rob-balfre Did you mean to mention me or @jasonlyu123?

Yep, total accident. Sorry

On Fri, 19 Jun 2020, 16:49 Jarrod Davis, notifications@github.com wrote:

@rob-balfre https://github.com/rob-balfre Did you mean to mention me or
@jasonlyu123 https://github.com/jasonlyu123?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/sveltejs/language-tools/issues/207#issuecomment-646468314,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAUAM7RDP47JKUF5JGMLFBTRXMC57ANCNFSM4OCHZ2ZA
.

I opened a ~150 lines component and the suggestion appeared instantly.

Could you reproduce the error after a window reload and then paste the VSCode-log of Output-Svelte in here?

Initialize language server at /Users/xx/xxui Initialize new ts service at Warning - unrecognized UnaryExpression operator 53! This is an edge case unaccounted for in svelte2tsx, please file an issue: https://github.com/sveltejs/language-tools/issues/new/choose !$xxelections Warning - unrecognized UnaryExpression operator 53! This is an edge case unaccounted for in svelte2tsx, please file an issue: https://github.com/sveltejs/language-tools/issues/new/choose !$xxelections SnapshotManager File Statistics: Project files: 2211 Svelte files: 0 From node_modules: 0 Total: 2211 Trying to load config for /Users/xx/xxui/svelte/components/xx/_SearchForm.svelte Warning - unrecognized UnaryExpression operator 53! This is an edge case unaccounted for in svelte2tsx, please file an issue: https://github.com/sveltejs/language-tools/issues/new/choose !$userDebtor Warning - unrecognized UnaryExpression operator 53! This is an edge case unaccounted for in svelte2tsx, please file an issue: https://github.com/sveltejs/language-tools/issues/new/choose !$UserIsConsultant Warning - unrecognized UnaryExpression operator 53! This is an edge case unaccounted for in svelte2tsx, please file an issue: https://github.com/sveltejs/language-tools/issues/new/choose !$xxelections Warning - unrecognized UnaryExpression operator 53! This is an edge case unaccounted for in svelte2tsx, please file an issue: https://github.com/sveltejs/language-tools/issues/new/choose !$xxelections Error walking node { start: 478, end: 533, type: 'IfBlock', expression: Node { type: 'MemberExpression', start: 484, end: 502, loc: SourceLocation { start: [Position], end: [Position] }, object: Node { type: 'Identifier', start: 484, end: 490, loc: [SourceLocation], name: 'sector' }, property: Node { type: 'Identifier', start: 491, end: 502, loc: [SourceLocation], name: 'CarrierName' }, computed: false }, children: [ { start: 503, end: 525, type: 'MustacheTag', expression: [Node] }, { start: 525, end: 526, type: 'Text', raw: ' ', data: ' ' } ] } Warning - unrecognized UnaryExpression operator 53! This is an edge case unaccounted for in svelte2tsx, please file an issue: https://github.com/sveltejs/language-tools/issues/new/choose !$helpPanelContentKey

@rob-balfre Is this the only file that has the issue? I can reproduce the warning but the completion is still instance show up for me. I think it's not related to the issue you're facing.

@jasonlyu123 not just that file but does seem to be contained to that project. Other similar sized projects seem much smoother. Trying to isolate the issue - will keep you posted

What stands out to me is that there are 2211 files initially loaded (which seems like a lot), none of them svelte files, which seems weird. Could you roughly describe the folder structure starting at the root you run VSCode in? Is it a simple svelte project, or is the svelte project just a sub folder and things like Backend or other stuff is next to it?

Do you have a jsconfig.json at the root the svelte project? If not, what happens if you add one with content {} and then restart VSCode?

@rob-balfre I enable typescript's logging in this branch. Could you debug it with your project following the debug instruction here and post the output here?

@jasonlyu123 A general thought to prevent memory leaks if there is no tsconfig.json or jsconfig.json -> what if we add a include: ["**/*.svelte"]-property in case no config is found (similar to the extends logic)? That way no js/ts files will be loaded, which might catch a lot of memory problems.

That seems to be a good way. it would possibly be more aligned with how vscode treats js in the workspace.

By the way, when I was trying this method and removed jsconfig.json from our company's project the problem @rob-balfre encounter suddenly appears. The output logged 1000s project file, 2000s from node_modules and completion takes like 5 - 10 seconds to show up. The memory usage also jumps from 200MB to 900MB. I guess the problem I encounter is because dist files and I also have some packages from another package manager, NuGet to be more precise, so having a jsconfig does save me a lot of headaches.

@rob-balfre could you check if the error still exists?

@dummdidumm I can confirm the issue has gone - feel free to close 🎉

Thanks so much everyone - loving this extension. 👏

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dummdidumm picture dummdidumm  ·  24Comments

jasonlyu123 picture jasonlyu123  ·  28Comments

limitlessloop picture limitlessloop  ·  22Comments

mgholam picture mgholam  ·  46Comments

limitlessloop picture limitlessloop  ·  16Comments