Open laralove143 opened 2 years ago
I'm having a tough time chasing down what's going on with this issue. Ostensibly, the Rust Analyzer binary should be taking care of this itself. It seems to eventually pick up the new dependency – maybe after a save? Not sure. I haven't found a way to kick it to look for new dependencies faster via LSP messages.
An option – but not a very good one – is to use the Restart Rust Analyzer command I added in extension version 2.1.0 today. It's not as disruptive as reloading the project, but it does take a good many seconds for RA to reboot. If I can't find a way to kick RA to refresh, then I may set up my own file watch for Cargo.toml
and reboot RA automatically on any changes.
You could also reopen the issue you linked me on RA, I think the way VSCode does it is using a watch as well, though not sure
So I dug a little deeper, and the watch is actually not happening within the RA binary. As defined in the LSP spec, it is the responsibility of the client to watch files and notify the server of file changes via a workspace/didChangeWatchedFiles
request. Sadly, when I watch Cargo.toml
and send the appropriate request when it changes, Rust Analyzer responds with:
{"error":{"code":-32601,"message":"unknown request"}}
As far as I can tell, Rust Analyzer expects the client to register the didChangeWatchedFiles
capability if it will perform watches for the server – and if it does not then RA will NOT register listeners for workspace/didChangeWatchedFiles
requests. VS Code registers this capability and – you guessed it! – Nova does not because its LanguageClient does not handle watches.
Sigh.
I'll put in a request to Panic to have them support watches, but I don't expect that to come quickly. For now, I'll have to reboot RA whenever Cargo.toml
changes.
Every day I'm distancing from Nova... But restarting when the file is saved should work fine
😔 I know. It's crushing to keep running into obstacles. I do appreciate how much better you've made this extension, so I hope you find the best tool for you.
I should probably mention for anyone visiting this ticket now that this extension restarts Rust Analyzer when changes to Cargo.toml
are detected. I'm leaving this issue open only to remind myself to check occasionally to see if Nova supports workspace/didChangeWatchedFiles
so I can avoid the server reboot.
when i add a new crate in my Cargo.toml, i dont get editor support on it
To Reproduce
Expected behavior adding new dependencies dont require a nova restart
Screenshots
after quitting nova
Versions (please complete the following information):