rhaiscript / lsp

Language server for Rhai.
Apache License 2.0
43 stars 4 forks source link

Path error in Windows #86

Closed schungx closed 2 years ago

schungx commented 2 years ago
ERROR failed to read file error=JsValue(Error: ENOENT: no such file or directory, open 'c:\c%3A\Git\rhai\examples\definitions\.rhai\all_in_one.d.rhai'
Error: ENOENT: no such file or directory, open 'c:\c%3A\Git\rhai\examples\definitions\.rhai\all_in_one.d.rhai')

When the definition file is changed, it seems to be provided a wrong path to reload.

I believe this is yet another Windows thing - that c%3A which is c: is a Windows-only thing that frustrates generations of Unix programmers.

schungx commented 2 years ago

I believe path errors is probably the main reason why I keep having trouble with functionalities while you cannot reproduce.

However, it doesn't seem like all path errors are being logged - perhaps paths are being used as lookup index and it just fails silently?

tamasfe commented 2 years ago

Yeah, I'll have to go another round with paths.

schungx commented 2 years ago

The thing is that there are usually no errors in the log related to improper paths -- things just fail silently. But I don't know how to resolve this without over-logging everything...

tamasfe commented 2 years ago

In this case the issue was with the duplicated c:/c:, which was due to having / prepended somewhere but only when the URI is converted to a path in JS, I have no idea where that came from and did not bother checking, I just strip it from from the path on windows.

So this should be fixed on master along with an other path issue (not windows-specific).