Stream: t-compiler/rust-analyzer

Topic: code generation

Leo Le Bouter (Sep 25 2019 at 02:20, on Zulip):

is it a design goal for rls to be abused as a code generator through it's autocomplete support?

Leo Le Bouter (Sep 25 2019 at 02:22, on Zulip):

e.g. selecting a random element from the autocomplete list including any snippet such as for loop or if conditions then filling in random parameters, would rls offer completion when it knows using some variable wouldnt violate borrow checking for example?

Leo Le Bouter (Sep 25 2019 at 02:23, on Zulip):

I assume that has to be resource hungry to somehow check every variable currently in scope for possible borrow checking violations and filter out the ones that will

Leo Le Bouter (Sep 25 2019 at 02:25, on Zulip):

I want to make a valid Rust random code generator

matklad (Sep 25 2019 at 06:32, on Zulip):

By code generator you mean source code generator (as opposed to machine code generator)?

matklad (Sep 25 2019 at 06:32, on Zulip):

rust-analyzer already have some facilities to generate source code, and the'll grow in the future

matklad (Sep 25 2019 at 06:32, on Zulip):

See the AstBuilder, AstEditor types

Florian Diebold (Sep 25 2019 at 09:18, on Zulip):

I think it's unlikely that we would hide completions if they e.g. violate borrow checking, even if we could do that (which we are a long way from). It's surprising, and often the desired fix would actually be elsewhere

Leo Le Bouter (Sep 25 2019 at 15:55, on Zulip):

@matklad Yes, that's what I mean. Thank you, I'll have a look, though, all the challenge is into making valid generation choices, even with access to an AST.
@Florian Diebold Okay. Thanks.

Last update: Jul 26 2021 at 12:45UTC