Stream: t-compiler/wg-rls-2.0

Topic: Integrating other programs into the output


Jake Goulding (Aug 04 2020 at 13:13, on Zulip):

If I had some super-cool program that searched through Rust code and returned matching locations, would there be some way of integrating it with r-a so that editors could benefit? Does LSP have a concept of multiple concurrent backends for one editor?

matklad (Aug 04 2020 at 13:20, on Zulip):

If this is a completely separate problem, it probably makes sense to implement a separate LSP server

matklad (Aug 04 2020 at 13:20, on Zulip):

The clients, I think, should be able to use several server for a single file

matklad (Aug 04 2020 at 13:21, on Zulip):

Well, you could plug it into rust-analyzer directly, but then I'll have to maintain it :D

Jake Goulding (Aug 04 2020 at 13:36, on Zulip):

And all the code to implement a LSP server is nicely extracted from r-a and easy to reuse, right?

matklad (Aug 04 2020 at 13:36, on Zulip):

And all the code to implement a LSP server is nicely extracted from r-a and easy to reuse, right?

Somewhat extracted: https://github.com/rust-analyzer/lsp-server

Jake Goulding (Aug 04 2020 at 13:48, on Zulip):

Now I just have to do the easy part and write that magical tool.

David Lattimore (Aug 05 2020 at 00:19, on Zulip):

What kind of search did you have in mind? Just wondering how related it might be to the structural search replace in RA. Or is it something very domain specific?

Jake Goulding (Aug 07 2020 at 20:29, on Zulip):

I’m actually unaware of what RA has so I should look into it. The long answer is https://github.com/shepmaster/strata-rust

David Lattimore (Aug 08 2020 at 02:24, on Zulip):

Nice! There's probably a small amount of overlap. SSR (https://rust-analyzer.github.io/manual.html#structural-search-and-replace) currently only exposes a search and replace function, not just a straight search. Of the examples you gave, the last one (let Single...) is close to the kind of thing SSR could match (although it doesn't yet support matching statements). The first one (searching for methods that take arguments that implement the trait Foo) is the kind of thing SSR might be able to do in the future (but can't now).

It's not clear if this is something that Strata would support, but something I think would be incredibly useful in an IDE (i.e. in Rust Analyzer) would be a way to say "I need a Foo" and have the IDE provide suggestions for how to get a Foo, possibly taking into account what kinds of things I've already got in the function I'm working on. This might involve a little bit of graph searching, since it might be necessary call more than one function.

This would be great for when you're unfamiliar with a library and don't know that you need to call .into() on a string or something similar in order to get an instance (although obviously documentation helps here too).

Last update: Sep 27 2020 at 12:45UTC