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

Show suggestions from out of scope #41

Open laralove143 opened 1 year ago

laralove143 commented 1 year ago

Is your feature request related to a problem? Please describe. When using an out-of-scope items, we have to type it out, press cmd+shift+a, select the item we want to import and then continue coding. This comes up very frequently that other IDEs have added features for this.

Describe the solution you'd like Items out-of-scope (from std and added crates) are shown in the completions, upon selection they are imported.

kilbd commented 1 year ago

Unfortunately, this isn't supported yet by Nova 😔 I asked for this LSP feature to be added a year ago, but have not heard of any plans to add it. I might bump that request again.

laralove143 commented 1 year ago

It'd be awesome if everyone reading this could bump (Add heart reaction to or reply to) the feature request to Nova @kilbd made! We need this feature, come on Rustaceans!!!!

laralove143 commented 1 year ago
Screenshot 2023-04-16 at 5 07 07 AM

this is how the typescript extension does it, i haven't gotten to testing it yet but it's a possible approach

kilbd commented 1 year ago

I haven't found yet where this functionality is implemented, but I assume it's helped by the fact that extensions are written in JavaScript and can potentially load in modules and inspect their exports. To implement something similar in Rust I'd need to roll my own Rust parser, which is too much of a commitment and unlikely to be done well.

I also noticed that the TypeScript extension's solution has issues.

The real solution for this and other language extensions is for Nova to continue improving its LSP support. That, or relax its grip on LSP messages, and possibly let extension developers opt into handling some of the messages.