Skip to content

Auto complete broken when input quickly in a large codebase #10187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
taikulawo opened this issue Sep 9, 2021 · 8 comments · Fixed by #12431
Closed

Auto complete broken when input quickly in a large codebase #10187

taikulawo opened this issue Sep 9, 2021 · 8 comments · Fixed by #12431
Labels
A-completion autocompletion A-perf performance issues

Comments

@taikulawo
Copy link

taikulawo commented Sep 9, 2021

So as the #6612 (comment) suggested.I reopen an issue

tokio is a large project, I'm contributing to it. where I println is in https://github.com/tokio-rs/tokio/blob/7e51b44a209dab1de0810d90e3dddff80c2e44a6/tokio/src/runtime/task/core.rs#L203.

If I input it quickly, vscode will fallback to using string-based intellisense auto complete.
If slowly, It will works, But it waste of my time.

watch this video: https://i.imgur.com/mcOBvpi.mp4

RA: v0.2.735
vscode:

Version: 1.60.0 (Universal)
Commit: e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff
Date: 2021-09-01T10:54:53.442Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 20.6.0

@jonas-schievink
Copy link
Contributor

Presumably this is caused by #7542

@lnicola
Copy link
Member

lnicola commented Sep 9, 2021

Yeah, this is #7542. Quick profile:

   98ms - handle_completion
       71ms - import_on_the_fly @ pr
           27ms - import_assets::search_for_imports (1 calls)
           43ms - render_resolution (36 calls)
        0   - Semantics::analyze_impl (1 calls)
       11ms - SourceBinder::to_module_def (1 calls)
        0   - crate_def_map:wait (157 calls)
        0   - deref (2 calls)
       10ms - descend_into_macros (2 calls)
        0   - infer:wait (1 calls)
        0   - item::Builder::build (27 calls)
        1ms - iterate_method_candidates (1 calls)
        2ms - render_resolution (202 calls)
   82ms - publish_diagnostics
       82ms - diagnostics
           66ms - SourceBinder::to_module_def
               62ms - crate_def_map:wait
                4ms - crate_def_map:wait (102 calls)
                0   - relevant_crates (1 calls)
           14ms - Module::diagnostics (1 calls)
            0   - parse_query (1 calls)
   84ms - handle_inlay_hints
       84ms - inlay_hints
           76ms - Semantics::analyze_impl
               66ms - SourceBinder::to_module_def
                   62ms - crate_def_map:wait
                       58ms - crate_def_map_query @ tokio
                            0   - PerNs::filter_visibility (3787 calls)
                            1ms - crate_def_map:wait (7403 calls)
                           57ms - ???
                        0   - item_tree_query (1 calls)
                    4ms - crate_def_map:wait (102 calls)
                    0   - relevant_crates (1 calls)
                0   - body_with_source_map_query (1 calls)
                0   - crate_def_map:wait (2 calls)
                0   - generic_params_query (2 calls)
                0   - impl_data_query (1 calls)
                9ms - infer:wait (1 calls)
            6ms - Semantics::analyze_impl (283 calls)
            0   - crate_def_map:wait (230 calls)
   92ms - handle_semantic_tokens_full_delta
       92ms - highlight
           66ms - Semantics::analyze_impl
               66ms - SourceBinder::to_module_def
                   61ms - crate_def_map:wait
                    4ms - crate_def_map:wait (102 calls)
                    0   - relevant_crates (1 calls)
                0   - crate_def_map:wait (1 calls)
            1ms - Semantics::analyze_impl (77 calls)
            1ms - SourceBinder::to_module_def (79 calls)
            0   - classify_lifetime (2 calls)
            0   - classify_lifetime_ref (2 calls)
            2ms - classify_name (85 calls)
           12ms - classify_name_ref (273 calls)
            0   - crate_def_map:wait (398 calls)
            4ms - descend_into_macros (100 calls)
            0   - generic_params_query (1 calls)
            0   - infer:wait (79 calls)
            0   - source_file_to_def (1 calls)
            0   - trait_solve::wait (81 calls)

@lnicola lnicola added A-completion autocompletion A-perf performance issues labels Sep 9, 2021
@taikulawo
Copy link
Author

Does that have an expectation fix time?

@memoryruins
Copy link
Contributor

memoryruins commented Oct 5, 2021

In the case this improves the experience for anyone else, recently I've had "editor.wordBasedSuggestions" disabled in vscode to minimize vscode inconsistently choosing between the two. If at times r-a's suggestions still don't appear automatically, ctrl+space and r-a's suggestions should appear. Changing "editor.quickSuggestionsDelay" (default: 10) to a larger value helps with it appearing automatically more consistently without the need of ctrl+space. Currently using 200 on an old laptop with a large project.

@taikulawo
Copy link
Author

taikulawo commented Oct 27, 2021

In the case this improves the experience for anyone else, recently I've had "editor.wordBasedSuggestions" disabled in vscode to minimize vscode inconsistently choosing between the two. If at times r-a's suggestions still don't appear automatically, ctrl+space and r-a's suggestions should appear. Changing "editor.quickSuggestionsDelay" (default: 10) to a larger value helps with it appearing automatically more consistently without the need of ctrl+space. Currently using 200 on an old laptop with a large project.

I'm not using on an old laptop. I'm using 32 core, 64 GB headless linux server

@Veykril
Copy link
Member

Veykril commented Jan 28, 2022

Related #7560

@cgbur
Copy link
Contributor

cgbur commented May 20, 2022

I have also tried turning off word base suggestions and increasing the time but the behavior still happens consistently for me. Has there been any update on this? I’m about to write a plug-in that just does control space after every keystroke. The inconsistency here is the number one drawback from using IntelliJ. I also know that this is a VS code specific problem because when using Lapce which uses rust analyzer there is no issue. It seems like this problem only plagues the vS code users.

@TimYorke
Copy link

TimYorke commented May 31, 2022

I'm getting frustrated by this problem and I can easily recreate it by typing the first letter of a function, waiting for the auto-complete box to appear, and then typing the 2nd and 3rd letters in quick succession.

The auto-complete box immediately disappears and doesn't come back, even though the function name I'm typing is in the list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-completion autocompletion A-perf performance issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants