vscode-nushell-lang
vscode-nushell-lang copied to clipboard
ENOENT: no such file or directory, open '<project>/source' Code: -32603
While editing a file (ci\build.nu), I get the following error:
[Error - 1:09:34 PM] Request textDocument/definition failed.
Message: Request textDocument/definition failed with message: ENOENT: no such file or directory, open '<my_project>\source'
Code: -32603
it seems to be looking for a source folder in the root of my directory. Am I missing something here ?
seems odd to me. i've seen those errors from time to time. i'm not sure what is causing them. i've also seen the same errors with rust_analyzer. i wonder if there's some bug in vscode or if this bug is in this extension?
Hum, interesting, I'm on windows, maybe something rust or a crate nushell depends on gets messed up because of windows path ?
Hum, interesting, I'm on windows, maybe something rust or a crate nushell depends on gets messed up because of windows path ?
Hmmm, good point. With nushell, if windows paths are enclosed in double quotes, it thinks it's an escape. e.g. c:\some\path wouldn't work but c:/some/path and c:\\some\\path would. Maybe we have single quotes on the windows side somewhere in the extension? or maybe it's in a variable that we can't see and needs to be double escaped for windows?
I aam experiencing it now on MacOS as well, so I don think it is due to Windows. Any clues on why this could happen ?
I've seen them on MacOS too. Probably more on MacOS than anywhere else. I haven't been able (or willing?) to narrow in on what's causing it. I sometimes just ignore them because rust-analyzer prints a bunch of these for me too.
It would be nice to have a repeatable use case to test against on mac, linux, and windows.
It looks like for some reason nu returns {"end" : 0, "file" : "source", "start" : 0} in some occasions. It seems to be sometimes happening when the extension queries many times at once, not sure why though ? Are you familiar with the nu part of it ? I'm really not yet @fdncred .
Edit: seems like the "source" might come from
https://github.com/nushell/nushell/blob/a3702e1eb713c45ec5d38e13a9d02969ac7cdce6/crates/nu-parser/src/parser.rs#L6069-L6083
wow, nice research! I have no idea why that's happening. I'll see if I can get JT to take a look.
@fdncred - looking at it, it looks like a Span(0, 0) is slipping in somewhere. Look at the stdout in the second picture, it says {"start": 0, "file": "source", "end": 0}. That's a sentinel value no one should ever see, so I suspect this is tripping over an order of operations that's dropping the span info.