kilbd / nova-rust

A Rust extension for the Nova text editor, using the Rust Analyzer language server.
MIT License
29 stars 5 forks source link

Specify external Rust analyzer #39

Closed cjwcommuny closed 1 year ago

cjwcommuny commented 1 year ago

Is it possible to specify an external Rust analyzer (e.g. installed from Homebrew)?

kilbd commented 1 year ago

Not currently. This extension "installs" its own RA binary to its extension directory. It gets trashed along with the rest of the files when you uninstall the extension. This was primarily done for a better user experience – so that users didn't need to install it themselves, provide the extension an install path, manage updates, etc. It also provides me some consistency when trying to troubleshoot issues.

Can you tell me more about what your goals are for using an external RA? I can't think of what it would buy you since all configuration is done through LanguageClient messages.

cjwcommuny commented 1 year ago

I sometimes encounter network issues that prevent me from downloading the Rust analyzer, which results in an invalid executable file. It would be helpful to have the ability to specify an external Rust analyzer in such cases.

kilbd commented 1 year ago

Ohhhh, I see now. Thank you so much for sharing your experience. I'm very sorry that you've had this issue.

I saw that my file download script didn't actually throw an error when a download failed, so the update proceeded to overwrite the RA binary with a bad file. I believe I've corrected this issue, but because of a Nova quirk I can't test locally and will need to do so after pushing up a patched version.

As it happens, I uncovered an exacerbating issue while looking into this. RA uses dates for its release versions, but there's now some drift between the date/version reported by the binary and the date used for the release on GitHub (because long builds? Not sure). The effect of this is that the extension likely tried to update more often than necessary. I'm now using commit SHAs instead of release tags to determine if there's a new version.

Though I've got fixes in place, I can see how a corrupt extension RA binary would be a show stopper. My preferred way forward is to check for an environment variable (RA_PATH) in the extension settings, which seems to me like a nice compromise between encouraging letting the extension manage RA and providing an emergency accommodation.

kilbd commented 1 year ago

This issue should be resolved in 2.3.1.