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 Beta breaks other extensions like vscode-javascript and prettier-vscode #207

Closed
rob-balfre opened this issue Jun 18, 2020 · 17 comments
Labels
bug Something isn't working

Comments

@rob-balfre
Copy link

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
@rob-balfre rob-balfre added the bug Something isn't working label Jun 18, 2020
@jasonlyu123
Copy link
Member

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.

@rob-balfre
Copy link
Author

I removed prettier but JavaScriptSnippets still doesn't work.

@rob-balfre
Copy link
Author

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

Takes 40 seconds for the snippet to appear!

@jasonlyu123
Copy link
Member

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

About JavaScriptSnippets, does other javascript completion also that slow?

@rob-balfre
Copy link
Author

@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

@jarrodldavis
Copy link
Contributor

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

@rob-balfre
Copy link
Author

rob-balfre commented Jun 19, 2020 via email

@dummdidumm
Copy link
Member

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?

@rob-balfre
Copy link
Author

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

@jasonlyu123
Copy link
Member

jasonlyu123 commented Jun 20, 2020

@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.

@rob-balfre
Copy link
Author

@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

@dummdidumm
Copy link
Member

dummdidumm commented Jun 20, 2020

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?

@jasonlyu123
Copy link
Member

@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?

@dummdidumm
Copy link
Member

@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.

@jasonlyu123
Copy link
Member

jasonlyu123 commented Jun 22, 2020

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.

dummdidumm pushed a commit to dummdidumm/language-tools that referenced this issue Jun 22, 2020
To not flood the initial files with potentially completely unrelated .js/.ts files

sveltejs#207 , sveltejs#151
dummdidumm added a commit that referenced this issue Jun 22, 2020
* (fix) add include when there's no js/ts config

To not flood the initial files with potentially completely unrelated .js/.ts files

#207 , #151

* use empty include

.svelte is not a supported ending, so there wouldnt be any files loaded anyway
@dummdidumm
Copy link
Member

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

@rob-balfre
Copy link
Author

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

Thanks so much everyone - loving this extension. 👏

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

No branches or pull requests

4 participants