tomblachut / svelte-intellij

Svelte components in WebStorm and friends
MIT License
482 stars 38 forks source link

Variables created in reactive statements are marked as unresolved #249

Closed TheOnlyTails closed 1 year ago

TheOnlyTails commented 3 years ago

When I create a variable in a reactive statement like so:

let count = 0;
$: doubled = count * 2;

The result is the following: image In both the declaration site and any usage, the reactive variable is marked as unresolved.

rafrafek commented 2 years ago

I have the same problem in Pycharm Pro 2021.3 obraz

he1d1 commented 2 years ago

A workaround is to split the declaration and assignment:

let count = 0;

let doubled;
$: doubled = count * 2;
AnthoniG commented 2 years ago

A workaround is to split the declaration and assignment:

let count = 0;

let doubled;
$: doubled = count * 2;

Thanks I was banging my head against the wall with this, until eventually I had to remove the lang="ts" and fall back to plain JavaScript.

tomblachut commented 2 years ago

Folks, I tried to reproduce this across versions and reactive declarations always work for me no matter if in JS or TS script. I'll need a reproduction project for this bug, I'm afraid.

he1d1 commented 2 years ago

Folks, I tried to reproduce this across versions and reactive declarations always work for me no matter if in JS or TS script. I'll need a reproduction project for this bug, I'm afraid.

This usually happens after you shut the IDE completely and reopen it

tomblachut commented 2 years ago

Folks, I found the root cause, fix will be released soon

TheOnlyTails commented 2 years ago

Awesome, thank you!

AndrewKirkovski commented 2 years ago

Was there any regression recently? I'm having this issue in PhpStorm in fresh project

Happens inconsistently, some places work ok, some not

image
TheOnlyTails commented 2 years ago

I'm actually getting this too with the new SvelteKit changes:

<script lang="ts">
  export let data;
  $: ({ posts } = data)
  //    ^^^^^ -> error here, posts cannot be found
</script>
tomblachut commented 2 years ago

Folks, I'm assuming this is the 2022.2? Maybe something regressed in the core JS code, need to check

Captain-Matroskin commented 1 year ago

Folks, I'm assuming this is the 2022.2? Maybe something regressed in the core JS code, need to check

The same problem now. I use WebStorm 2022.3

Scui1 commented 1 year ago

Issue still persists in WebStorm 2023.1.2 together with plugin version 231.8770.15 Image

tomblachut commented 1 year ago

Covered by some other issues and mostly WEB-58397 use the svelte language server