rust-lang / rls

Repository for the Rust Language Server (aka RLS)
Other
3.51k stars 257 forks source link

Move snippets up from rls-vscode to rls #894

Open LucasBullen opened 6 years ago

LucasBullen commented 6 years ago

It has been a common complaint from users of rls that completion support for macros is not present. Knowing that this is a racer issue, I believe that if the rust-lang-nursery team sees these snippets valuable enough to be put into the VSCode plugin, that they should instead be put into the language server to allow all clients to have access to them and avoid code duplication between clients.

nrc commented 6 years ago

is it possible to have snippets in the language server? I didn't think there was protocol for it

LucasBullen commented 6 years ago

Believe it is, Setting the InsertTextFormat value of a CompletionItem to Snippet.

/**
 * The primary text to be inserted is treated as a snippet.
 *
 * A snippet can define tab stops and placeholders with `$1`, `$2`
 * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
 * the end of the snippet. Placeholders with equal identifiers are linked,
 * that is typing in one will update others too.
 */
JJK96 commented 6 years ago

Second this, I'm using this language server from kak-lsp

Xanewok commented 5 years ago

I think it'd make sense for the basic/most commonly used macros (basically this modulo extern crate, if let and spawn IMO)