Skip to content
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

Completion frequently needs manual trigger with app code using gtk-rs #10842

Closed
YaLTeR opened this issue Nov 22, 2021 · 4 comments
Closed

Completion frequently needs manual trigger with app code using gtk-rs #10842

YaLTeR opened this issue Nov 22, 2021 · 4 comments

Comments

@YaLTeR
Copy link

YaLTeR commented Nov 22, 2021

I'm writing an app using gtk-rs. Even though the app is still pretty small and I have a high-end machine (Ryzen 5900X, 32 GB of RAM), I frequently get dumb completions in VSCode which I need to manually Escape out of and Ctrl-Space to manually trigger rust-analyzer ones. Then when narrowing down, the r-a completions frequently disappear, requiring another Escape and Ctrl-Space.

Here's a demonstration:

out.mp4

Every pause is intentional by me, so it's not like something happens automatically after a while. I'm just waiting to show what happens, and then manually pressing Escape and Ctrl-Space.

I can reproduce it on a clean checkout of my project:

  1. git clone https://github.com/YaLTeR/plitki.git && cd plitki && git checkout 0a33e2994b8dc1fcc964ff1f23629e0f3ef49cda
  2. Open plitki-gtk in VSCode.
  3. Open main.rs, wait for rust-analyzer to finish loading.
  4. Try typing something in on_activate like I do on the video, or maybe in some other files.

Completions seemed to work fine on an empty project with gtk4 added. However I really cannot call the project above anywhere close to complicated: it only contains a single window and two custom widgets.

Fedora 35 Silverblue, rust-analyzer version: 183ef04 2021-11-22 stable, VSCode 1.61.2 from Flathub opening the project in a toolbox container which works through VSCode's "Remote Container" extension.

@jhgg
Copy link
Contributor

jhgg commented Nov 23, 2021

This is most likely #10369 - when completions take too long to compute vscode does not show them anymore unless you manually trigger them.

@YaLTeR
Copy link
Author

YaLTeR commented Nov 23, 2021

when completions take too long to compute vscode does not show them anymore unless you manually trigger them

I see; what about completions disappearing when narrowing down? E.g. when I typed conne and triggered completions, then typed ct_ac and completions disappeared.

@YaLTeR
Copy link
Author

YaLTeR commented Nov 23, 2021

Not sure I'm doing this right, but I set RA_PROFILE=* and got output when typing just a single letter (window.connect + _):

  140ms - handle_completion
       93ms - CompletionContext::new
           92ms - descend_into_macros
               92ms - Semantics::analyze_impl
                    9ms - SourceBinder::to_module_def
                        9ms - crate_def_map:wait
                        0   - relevant_crates (1 calls)
                        0   - ???
                   83ms - infer:wait @ on_activate
                       83ms - infer_query
                           81ms - trait_solve::wait
                            0   - crate_def_map:wait (13 calls)
                            0   - deref (1 calls)
                            0   - deref_by_trait (1 calls)
                            0   - resolve_obligations_as_possible (24 calls)
                            0   - trait_solve::wait (4 calls)
                            1ms - ???
                        0   - ???
                    0   - body_with_source_map_query (1 calls)
                    0   - crate_def_map:wait (2 calls)
                    0   - ???
                0   - ???
            0   - Semantics::analyze_impl (3 calls)
            0   - SourceBinder::to_module_def (3 calls)
            0   - crate_def_map:wait (2 calls)
            0   - ???
       27ms - iterate_method_candidates
            0   - crate_def_map:wait (402 calls)
            0   - deref (1 calls)
            6ms - render_method (400 calls)
            1ms - trait_solve::wait (324 calls)
           19ms - ???
       19ms - import_on_the_fly @ connect_
           19ms - import_assets::search_for_imports
               19ms - import_assets::search_for
                   18ms - import_assets::trait_applicable_items
                       14ms - items_with_name @ Name: connect_, crate: AssocItemsOnly, assoc items: Some("plitki_gtk"), limit: Some(40)
                           14ms - find_items
                               13ms - query_external_importables
                                   13ms - search_dependencies @ Query { query: "connect_", lowercased: "connect_", name_only: true, assoc_items_only: true, search_mode: Fuzzy, case_sensitive: false, limit: 40, exclude_import_kinds: {} }
                                        0   - fst_path (126 calls)
                                        0   - import_map::Query::import_matches (57 calls)
                                       13ms - ???
                                    0   - ???
                                0   - crate_symbols (1 calls)
                                0   - ???
                            0   - ???
                        4ms - iterate_method_candidates
                            0   - deref (1 calls)
                            0   - find_path_prefixed (8 calls)
                            0   - trait_solve::wait (23 calls)
                            4ms - ???
                        0   - applicable_inherent_traits (1 calls)
                        0   - deref (1 calls)
                        0   - ???
                    0   - import_assets::scope_definitions (1 calls)
                    0   - ???
                0   - ???
            0   - Semantics::analyze_impl (1 calls)
            0   - ???
        0   - Semantics::analyze_impl (2 calls)
        0   - complete_unqualified_path (1 calls)
        0   - crate_def_map:wait (58 calls)
        0   - deref (1 calls)
        0   - item::Builder::build (13 calls)
        0   - trait_solve::wait (2 calls)
        0   - ???

@Veykril
Copy link
Member

Veykril commented Dec 20, 2021

Closing this as the main problem here is us being too slow with completions at times which is tracked in #7542

@Veykril Veykril closed this as completed Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants