racer-rust / racer

Rust Code Completion utility
MIT License
3.36k stars 278 forks source link

Completion inside a comment performance issue #413

Open ville-h opened 8 years ago

ville-h commented 8 years ago

Completion inside a comment performance varies quite significantly (from 0.01s to ~0.3s)[0] seemingly depending on the context of the comment. Here is test for scenario that I noticed while using emacs+racer:

fn main() {
    // writing in this comment is fine
}

struct A {
}

impl A {
    fn f() {
        // writing in this comment is broken
        let x = 0;
    }

    fn g() {
        // writing in this comment is fine
    }
}

Completion in "// writing in this comment is broken" takes significantly longer than in the other two comments. Removing "let x = 0;" makes it comparably fast.

[0] https://github.com/racer-rust/emacs-racer/issues/6

phildawes commented 8 years ago

This can probably be fixed by either:

Doing the latter might be a lot easier than changing each plugin. Does anybody else fancy having a go at this?

ville-h commented 8 years ago

It seems that opening the comment with /* doesn't trigger the behaviour. The comment doesn't even have to be terminated with */.