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

TypeError: Cannot read properties of undefined (reading 'source') #1630

Closed
KaRkY opened this issue Sep 12, 2022 · 2 comments
Closed

TypeError: Cannot read properties of undefined (reading 'source') #1630

KaRkY opened this issue Sep 12, 2022 · 2 comments
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.

Comments

@KaRkY
Copy link

KaRkY commented Sep 12, 2022

Describe the bug

When trying to autocomplete component properties I get this error:

TypeError: Cannot read properties of undefined (reading 'source')
    at CompletionsProviderImpl.getCompletions (c:\Users\e-svetinar\.vscode\extensions\svelte.svelte-vscode-105.22.1\node_modules\svelte-language-server\dist\src\plugins\typescript\features\CompletionProvider.js:136:34)
    at async TypeScriptPlugin.getCompletions (c:\Users\e-svetinar\.vscode\extensions\svelte.svelte-vscode-105.22.1\node_modules\svelte-language-server\dist\src\plugins\typescript\TypeScriptPlugin.js:137:29)
    at async PluginHost.tryExecutePlugin (c:\Users\e-svetinar\.vscode\extensions\svelte.svelte-vscode-105.22.1\node_modules\svelte-language-server\dist\src\plugins\PluginHost.js:300:20)
    at async c:\Users\e-svetinar\.vscode\extensions\svelte.svelte-vscode-105.22.1\node_modules\svelte-language-server\dist\src\plugins\PluginHost.js:55:28
    at async Promise.all (index 3)
    at async PluginHost.getCompletions (c:\Users\e-svetinar\.vscode\extensions\svelte.svelte-vscode-105.22.1\node_modules\svelte-language-server\dist\src\plugins\PluginHost.js:54:29)

As far as I could debug it I found that this pull #1609 introduced this bug.
Error is happening in line

if (c.data.source?.includes('.svelte-kit/types')) {

Reproduction

I am using "carbon-components-svelte" maybe this is the problem since it works OK with my own components.

I created a github repo which if you try to autocomplete inside +page.svelte on a Header component there should be an error in output but if you try to autocomplete inside Component it's OK.

https://github.com/KaRkY/svelte-vscode-reproduction

Expected behaviour

Autocomplete should actually suggest useful suggestions.

System Info

  • Windows
  • VSCode (1.71.0)
  • Svelte extension (105.22.1 or 105.22.0) It works OK in 105.21.0

Which package is the issue about?

svelte-language-server

Additional Information, eg. Screenshots

No response

@KaRkY KaRkY added the bug Something isn't working label Sep 12, 2022
@dummdidumm
Copy link
Member

Thank you for the detailed reproduction! Fix is underway

@dummdidumm dummdidumm added the Fixed Fixed in master branch. Pending production release. label Sep 12, 2022
@KaRkY
Copy link
Author

KaRkY commented Sep 14, 2022

I just saw the release and now it works thanks.

@KaRkY KaRkY closed this as completed Sep 14, 2022
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

2 participants