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

(feat) better ./$types auto imports #1592

Merged
merged 1 commit into from Aug 17, 2022

Conversation

dummdidumm
Copy link
Member

TypeScript doesn't resolve imports to SvelteKit's $types very well, help it doing better

TypeScript doesn't resolve imports to SvelteKit's $types very well, help it doing better
@dummdidumm dummdidumm merged commit 936fa6f into sveltejs:master Aug 17, 2022
@dummdidumm dummdidumm deleted the better-types-imports branch August 17, 2022 13:59
@fehnomenal
Copy link

This is already released, right? My vscode extension is at 105.21.0:
image

But how do I activate this? My suggestions look like this:
image
Of which the first one would be correct but I am expecting ./$types as suggestion. Or am I missing something?

@dummdidumm
Copy link
Member Author

That's a code action, not autocompletion - good point we didn't add proper handling to that one

@fehnomenal
Copy link

Alright, then should it popup here?
image

Or maybe here?
image

@dummdidumm
Copy link
Member Author

Did you enable the TypeScript plugin that comes with the extension? If not, then it doesn't work.

@fehnomenal
Copy link

fehnomenal commented Aug 24, 2022

Update: Lol, it works. I never bothered actually pressing enter on the suggestions... Thank you!


Yes, toggling/restarting vscode does not help either:
image

But I noticed error logs from the TS language server after Ctrl+Space with the cursor at PageLoad|:

[2022-08-24 14:05:57.162] [exthost] [error] Error: <semantic> TypeScript Server Error (4.7.4)
Debug Failure. False expression.
Error: Debug Failure. False expression.
    at getCompletionEntryCodeActionsAndSourceDisplay (/home/andi/workspace-carat/monorepo/common/temp/node_modules/.pnpm/typescript@4.7.4/node_modules/typescript/lib/tsserver.js:132616:22)
    at Object.getCompletionEntryDetails (/home/andi/workspace-carat/monorepo/common/temp/node_modules/.pnpm/typescript@4.7.4/node_modules/typescript/lib/tsserver.js:132554:30)
    at getCompletionEntryDetails (/home/andi/workspace-carat/monorepo/common/temp/node_modules/.pnpm/typescript@4.7.4/node_modules/typescript/lib/tsserver.js:164668:35)
    at Proxy.ls.getCompletionEntryDetails (/home/andi/.vscode-oss/extensions/svelte.svelte-vscode-105.21.0/node_modules/typescript-svelte-plugin/dist/src/language-service/completions.js:51:23)
    at /home/andi/workspace-carat/monorepo/common/temp/node_modules/.pnpm/typescript@4.7.4/node_modules/typescript/lib/tsserver.js:176510:57
    at Object.mapDefined (/home/andi/workspace-carat/monorepo/common/temp/node_modules/.pnpm/typescript@4.7.4/node_modules/typescript/lib/tsserver.js:605:30)
    at IpcIOSession.Session.getCompletionEntryDetails (/home/andi/workspace-carat/monorepo/common/temp/node_modules/.pnpm/typescript@4.7.4/node_modules/typescript/lib/tsserver.js:176508:33)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/home/andi/workspace-carat/monorepo/common/temp/node_modules/.pnpm/typescript@4.7.4/node_modules/typescript/lib/tsserver.js:175147:61)
    at /home/andi/workspace-carat/monorepo/common/temp/node_modules/.pnpm/typescript@4.7.4/node_modules/typescript/lib/tsserver.js:177195:88
    at IpcIOSession.Session.executeWithRequestId (/home/andi/workspace-carat/monorepo/common/temp/node_modules/.pnpm/typescript@4.7.4/node_modules/typescript/lib/tsserver.js:177186:28)
    at IpcIOSession.Session.executeCommand (/home/andi/workspace-carat/monorepo/common/temp/node_modules/.pnpm/typescript@4.7.4/node_modules/typescript/lib/tsserver.js:177195:33)
    at IpcIOSession.Session.onMessage (/home/andi/workspace-carat/monorepo/common/temp/node_modules/.pnpm/typescript@4.7.4/node_modules/typescript/lib/tsserver.js:177221:35)
    at process.<anonymous> (/home/andi/workspace-carat/monorepo/common/temp/node_modules/.pnpm/typescript@4.7.4/node_modules/typescript/lib/tsserver.js:179856:31)
    at process.emit (node:events:390:28)
    at emit (node:internal/child_process:917:12)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)
	at Function.create (/nix/store/69kjf1fsdzqd43xjrkgxgg556bkxhdlg-vscodium-1.70.2.22230/lib/vscode/resources/app/extensions/typescript-language-features/dist/extension.js:1:509467)
	at dispatchResponse (/nix/store/69kjf1fsdzqd43xjrkgxgg556bkxhdlg-vscodium-1.70.2.22230/lib/vscode/resources/app/extensions/typescript-language-features/dist/extension.js:1:503315)
	at dispatchMessage (/nix/store/69kjf1fsdzqd43xjrkgxgg556bkxhdlg-vscodium-1.70.2.22230/lib/vscode/resources/app/extensions/typescript-language-features/dist/extension.js:1:502183)
	at ChildProcess.<anonymous> (/nix/store/69kjf1fsdzqd43xjrkgxgg556bkxhdlg-vscodium-1.70.2.22230/lib/vscode/resources/app/extensions/typescript-language-features/dist/extension.js:1:501668)
	at ChildProcess.emit (node:events:390:28)
	at emit (node:internal/child_process:917:12)
	at processTicksAndRejections (node:internal/process/task_queues:84:21)

Could this be related?

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

Successfully merging this pull request may close these issues.

None yet

2 participants