MaulingMonkey / VisualRust

Visual Studio extension for Rust
MIT License
2 stars 0 forks source link

Optimize RustCompletionCommandHandler to not spuriously reinvoke racer after structural tokens #7

Closed MaulingMonkey closed 7 years ago

MaulingMonkey commented 7 years ago

The following branch: https://github.com/PistonDevelopers/VisualRust/blob/f005c247f0f30aa0d84fab655d192743de53bba8/src/VisualRust/RustCompletionCommandHandler.cs#L90-L94

                        else if (leftTokenType == RustTokenTypes.STRUCTURAL)
                        {
                            Cancel();
                            StartSession();
                        }

appears to be taken for every typing keystroke when continuing to type an expression such as:

let result = foo + b...

Presumably because the left token is +. This causes racer to be rerun every character, when it is not for:

let result = f...

Relates to https://github.com/PistonDevelopers/VisualRust/issues/70

MaulingMonkey commented 7 years ago

Should be fixed as part of https://github.com/MaulingMonkey/VisualRust/commit/7b9f314a6db4d54a2afff6942cdb3d758fb5a552