Skip to content

Database forking / speculative execution #931

@mkurnikov

Description

@mkurnikov

I'm implementing completion for my language server, which is based on salsa / rust-analyzer architecture.

To determine the correct context, usual technique is to amend the current file with the "fake identifier" at the cursor position.

fn main() {
    /*caret*/ 
}

->

fn main() {
    fake_ident/*caret*/
}

which requires cloning the database and calling set_file_text() on it.
There is a db.fork_db().as_view::<MyDb>() but I can't get mutable reference out of it.

It was discussed multiple times both in rust-analyzer repo and in Salsa Zulip channel, under the name "speculative execution".
Is there any timeline on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions