crystal-lang-tools / vscode-crystal-lang

Yet another VSCode extension for Crystal Programming Language
https://marketplace.visualstudio.com/items?itemName=crystal-lang-tools.crystal-lang
MIT License
276 stars 58 forks source link

Syntax checking does not work in WSL 2 #143

Closed pyrsmk closed 7 months ago

pyrsmk commented 3 years ago

Describe the bug

The syntax checker does not worker under WSL 2. If we write some invalid code and then save, nothing happens. After some debugging, I found where the issue was located : https://github.com/crystal-lang-tools/vscode-crystal-lang/blob/master/src/crystalUtils.ts#L78

In WSL 2, for my case, document was /mnt///me/my_user/some_dir/some_file.cr instead of /home/my_user/some_dir/some_file.cr. Hence, I replaced the line 78 with return document.replace('/mnt///me', '/home');.

It is probably not a reliable way to fix this and some stuff should be refactored to handle WSL 1 and 2 correctly (or only WSL 2, since it's the new recommended WSL version which behaves differently with the filesystem).

If needed, I may create a PR based on your advices about how to fix it well ;)

Desktop (please complete the following information):

nobodywasishere commented 7 months ago

If you can, please let me know if this is still reproducible on v0.9.0