kit icon indicating copy to clipboard operation
kit copied to clipboard

vscode cannot read correctly files

Open ivanafanasyeu opened this issue 6 months ago • 6 comments

Describe the bug

Screenshot 2023-12-23 at 16 09 23

Reproduction

open last sveltekit2 project in vscode and try to import something

Logs

No response

System Info

macOS, VScode

Severity

blocking an upgrade

ivanafanasyeu avatar Dec 23 '23 13:12 ivanafanasyeu

Please provide a minimal reproduction in the form of a code repository.

eltigerchino avatar Dec 23 '23 15:12 eltigerchino

The duplication seems to be because TypeScript 5.3+ fixes some issue path completion for rootDirs. The path completion now shows the files and directories inside .svelte-kit/types. But I only see the directory has two entries, and the file doesn't get duplicated. And it also appears in SvelteKit v1. So, there might be another issue with your setup. We'll definitely need a reproduction to check. Also, Can you try disabling all VSCode extensions to see if it's caused by the extension you installed?

jasonlyu123 avatar Dec 24 '23 02:12 jasonlyu123

The duplication seems to be because TypeScript 5.3+ fixes some issue path completion for rootDirs. The path completion now shows the files and directories inside .svelte-kit/types. But I only see the directory has two entries, and the file doesn't get duplicated. And it also appears in SvelteKit v1. So, there might be another issue with your setup. We'll definitely need a reproduction to check. Also, Can you try disabling all VSCode extensions to see if it's caused by the extension you installed?

disabling extensions provide the same result: https://github.com/ivanafanasyeu/vscode-dub

ivanafanasyeu avatar Dec 24 '23 08:12 ivanafanasyeu

It seems like the file duplication only happens when there is a directory with an upper case character in the file tree. For example: /path/To/project/+page.ts. This is related to SvelteKit because of the rootDirs configuration, but it is definitely a TypeScript issue. And it also happens in SvelteKit v1, so it certainly isn't "blocking an upgrade".

The next TypeScript release is at least March, but they haven't released the plan yet, So it might be way later. If you're annoyed by it, you can work around it by moving your project to a path with no uppercase directory. At least it'll have less duplication.

jasonlyu123 avatar Dec 24 '23 08:12 jasonlyu123

It seems like the file duplication only happens when there is a directory with an upper case character in the file tree. For example: /path/To/project/+page.ts. This is related to SvelteKit because of the rootDirs configuration, but it is definitely a TypeScript issue. And it also happens in SvelteKit v1, so it certainly isn't "blocking an upgrade".

The next TypeScript release is at least March, but they haven't released the plan yet, So it might be way later. If you're annoyed by it, you can work around it by moving your project to a path with no uppercase directory. At least it'll have less duplication.

it's definitely not about the case, it literally something with reading paths at all

ivanafanasyeu avatar Dec 24 '23 10:12 ivanafanasyeu

Sorry. I don't understand what you meant by "something with reading paths at all". If I understand correctly, Your problem is the auto-completion with the path in the module specifier. And that feature is provided by TypeScript, no matter if it's a ts/js file or a svelte file.

The case I first mentioned where it has two "routes" directories is because of the "rootDirs" config that SvelteKit generated. They're not duplicates, just the same name. The three times duplicate is the previous case plus a TypeScript bug. Some paths are converted to lowercase in case-insensitive file systems, but some are not, so the de-duplicate doesn't work correctly.

If you're not reporting on the auto-completion. Please provide details on what exactly your problem is.

jasonlyu123 avatar Dec 24 '23 11:12 jasonlyu123

Closing due to inactivity

eltigerchino avatar Jan 20 '24 03:01 eltigerchino