tomblachut / svelte-intellij

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

Unused import warning when module used inside event and animate directives. #92

Closed nassredean closed 4 years ago

nassredean commented 4 years ago

Hi there! Thanks for working on this plugin, I find it very useful! I found a small bug. When importing a module and using it inside a directive in a component, the import statement is greyed out and we get an "unused import warning":

Here is the relavent code

<script>
  import { quintOut } from 'svelte/easing';
  import { fly } from 'svelte/transition';
  import { flip } from 'svelte/animate';
</script>

<div>
    {#each items.filter((item) => item.id === active) as item (item.id)}
      <img src={item.url}
           data-carousel-index={item.id}
           alt={`carousel-image-${item.id}`}
           on:click|stopPropagation|preventDefault={handleClick}
           on:mousemove={updateCursor}
           on:mouseenter={updateCursor}
           out:fly="{{
 x: -window.innerWidth * easeDirection, opacity: 1, duration: 600, easing: quintOut,
}}"
           in:fly="{{
 x: window.innerWidth * easeDirection, opacity: 1, duration: 600, easing: quintOut,
}}"
           animate:flip
      >
    {/each}
</div>

You can see int the editor it is greyed out: private-chef-club  ~:Workspace:private-chef-club  -  :apps:marketing:ui-components:SplashCarousel svelte 2019-11-17 14-19-50

Though it is being used here: private-chef-club  ~:Workspace:private-chef-club  -  :apps:marketing:ui-components:SplashCarousel svelte 2019-11-17 14-20-30

tomblachut commented 4 years ago

Hi! Yes, please refer to #11. Basically every reference used in HTML attribute name so far is treated as plain text.

nassredean commented 4 years ago

Sorry for opening this I didn't see that issue! Thanks again!