crystal-lang-tools/vscode-crystal-lang

Syntax checking does not work in WSL 2

pyrsmk opened this issue · 1 comments

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):

  • OS: Windows 10
  • Crystal version: 1.0
  • This plugin version: 0.8.2