svelte-intellij icon indicating copy to clipboard operation
svelte-intellij copied to clipboard

Support NPM Workspaces for "Go to Declaration"

Open davjhan opened this issue 2 years ago • 0 comments

What

Assume you have an NPM workspace setup properly like so:

Project Root
  - Library A
        - A.svelte
  - Library B
        - B.svelte

And in A.svelte, I import component B.svelte from the sub package @davjhan/LibraryB

    import B from '@davjhan/LibraryB/src/B.svelte'

When right click on B "Go To > Declaration or Usages" or simply command click on B, I expect it to take me to the definition source in /Library B/B.svelte. However, it says "No Declarations Found".

If I right click on the path ( '@davjhan/LibraryB/src/B.svelte'), and go to declaration or usages, it sends me to a readonly version of this file in node_modules.

It works when...

  • This works as expected on VS Code.

  • This works as expected if I export and import a JS const. It seems to be .svelte specific.

  • This works as expected if A is just a regular .ts file with the same import line.

  • This works as expected if I specify lang-ts on the script tag:

<script lang=ts>
    import B from '@davjhan/LibraryB/src/B.svelte'
</script>

davjhan avatar Jul 19 '22 01:07 davjhan