sublimelsp / LSP-svelte

Convenience plugin for Svelte Language Tools
MIT License
16 stars 0 forks source link

aliases inside svelte components #61

Closed basaran closed 2 years ago

basaran commented 3 years ago

Hello, thank you for the package.

I'm trying to setup go to definition for my aliases inside svelte components:

<style lang="scss">
@import "@css/mixins/media-queries.scss";
..
</style>

I have the following in my jsconfig and tsconfig:

{
    "compilerOptions": {
        "baseUrl": ".",
        "paths": {
            "@css": ["src/css"],
            "@css/*": ["src/css/*"],
        }
    },
    "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte", "src/**/*.css", "src/**/*.scss"],
    "exclude": ["node_modules", "**/node_modules", "dist"]
}

but when I try to go to definition, sublime says nothing was found. Is there a setting I can use with the LSP config for this?

istudyatuni commented 2 years ago

Hello! This now works for me in the script tag. My jsconfig:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "src/*": ["./src/*"]
    }
  }
}

and inside the component

<script context="module">
    import { testData } from 'src/stores/test'
</script>

a hover with information is displayed. But it doesn't works when importing a component into a component (except auto-completing props names)

<script context="module">
    import SideMenu from 'src/components/organisms/SideMenu'
</script>

But! It not works in VS Code too (I think we can use this as a benchmark)

predragnikolic commented 2 years ago

Hello, There is nothing that can be implemented in this repo to achieve your feature request, so I will close this issue.

I would advice you to open a feature request at https://github.com/sveltejs/language-tools.

predragnikolic commented 2 years ago

Just to be clear, path aliasing works for components.

Screenshot 2022-08-01 at 12 37 37

But go to definition will not work in this case css/scss:

<style lang="scss">
@import "@css/mixins/media-queries.scss";
..
</style>
basaran commented 2 years ago

Thank you for the clarification.