Closed tomblachut closed 3 years ago
I gave it a shot in my "reactive" branch. it's not so great but it could be helpful https://github.com/unlocomqx/svelte-intellij/tree/reactive
Thx! I'll give it a spin
Great job on last update. Now $stores are reconginzing and highlighting by IDE.
But TS-types are incorrent, now they show Store's type, not the value istelf.
I tried to evaluate Type from .subscribe() method as Svelte do and created such snippet
type Unsubscriber<T extends {subscribe: any}> = T['subscribe'] extends ((v: infer S) => any) ?
(S extends (v: infer V) => any ? V : never) : never;
type StoredValue = Unsubscriber<typeof store>;
@today- Current implementation is pretty stupid unfortunately
find usages action also don't find them properly
There's progress
~I've been thinking about that for a bit now and finally asked JB for input.~
~Basically I see 2 approaches here:~
~1. Extend JS language/parser (and also TS ones). Turns out this is insanely over-complicated because there are edge-cases in Svelte 😉 Svelte handles this after parsing step because it doesn't need to care about editing features. (See #46)
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360004377420-Treat-part-of-JS-identifier-specially-depending-on-context
I guess preliminary type-unsafe support will be easy enough.
(also, related docs: http://www.jetbrains.org/intellij/sdk/docs/reference_guide/custom_language_support/rename_refactoring.html)