Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alias paths aren't being resolved by language server #12249

Open
Joonel opened this issue May 22, 2024 · 1 comment
Open

Alias paths aren't being resolved by language server #12249

Joonel opened this issue May 22, 2024 · 1 comment

Comments

@Joonel
Copy link

Joonel commented May 22, 2024

Describe the bug

Not being able to go to an implementation of a function when using an alias like default $lib or a custom one;
Suggestions for typing imports don't work.

image


image

Reproduction

Repo with reproduction - https://github.com/Joonel/alias-bug

Create a new empty project, no TS, no JSDoc.
Add any @custom-alias for a folder in svelte.config.js, import a function on +page.svelte from the index.js in that folder, then try to go to the implementation of that function.

svelte.config.js:

  kit: {
    adapter: adapter(),
    alias: {
      "@custom-alias": "./src/custom-alias",
    },
  },

paths in ./svelte-kit/tsconfig.json are as expected:

"compilerOptions": {
"paths": {
	"@custom-alias": [
		"../src/custom-alias"
	],
	"@custom-alias/*": [
		"../src/custom-alias/*"
	],
	"$lib": [
		"../src/lib"
	],
	"$lib/*": [
		"../src/lib/*"
	]
},

Logs

No response

System Info

System:
    OS: Windows 11 10.0.22631
  Binaries:
    Node: 20.10.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.4.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.0.6 - ~\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Chromium (123.0.2420.97)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    @sveltejs/adapter-auto: ^3.2.1 => 3.2.1
    @sveltejs/kit: ^2.5.10 => 2.5.10
    @sveltejs/vite-plugin-svelte: ^3.1.0 => 3.1.0
    svelte: ^4.2.17 => 4.2.17
    vite: ^5.2.11 => 5.2.11

Severity

serious, but I can work around it

Additional Information

No response

@dummdidumm
Copy link
Member

You need to add a jsconfig.json referencing that generated tsconfig, else intellisense doesn't know what these references are. We should adjust the npm create svelte CLI to add a minimum jsconfig.json if you chose no for both JsDoc and TS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants