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

Format on save is delayed #11654

Closed
Tracked by #86
hf29h8sh321 opened this issue Mar 8, 2022 · 0 comments · Fixed by #13428
Closed
Tracked by #86

Format on save is delayed #11654

hf29h8sh321 opened this issue Mar 8, 2022 · 0 comments · Fixed by #13428
Labels
A-vscode vscode plugin issues C-support Category: support questions

Comments

@hf29h8sh321
Copy link

Using Visual Studio Code, saving a file runs handle_code_action first, then formats.

 664ms - handle_code_action
        4ms - FindUsages:search
            0   - classify_name (6 calls)
            3ms - classify_name_ref (24 calls)
            0   - descend_into_macros (60 calls)
            0   - parse_query (1 calls)
            0   - search_scope (1 calls)
      261ms - FindUsages:search
            8ms - parse_macro_expansion
            5ms - parse_query @ FileId(4432)
            5ms - parse_query @ FileId(4476)
            5ms - parse_query @ FileId(4832)
            4ms - parse_query @ FileId(4811)
            4ms - parse_query @ FileId(4446)
            3ms - parse_query @ FileId(4447)
           10ms - parse_query @ FileId(4845)
            4ms - parse_query @ FileId(4843)
// hundreds of lines

rust-analyzer version: 2022-03-07 dev (built from master)

Also occurs on stable

rustc version: rustc 1.61.0-nightly (68369a041 2022-02-22)

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTUP_HOME or CARGO_HOME)

"editor.formatOnSave": true,
@flodiebold flodiebold added A-vscode vscode plugin issues C-support Category: support questions labels Apr 6, 2022
bors added a commit that referenced this issue Oct 17, 2022
fix: Fix formatting requests hanging when r-a is still starting

The reason for that was that we were calculating the crate defmaps of the file we are saving by accident causing us to get stuck waiting on their expensive computation, while we only need the relevant crate id.

Closes #4054
Closes #11654
@bors bors closed this as completed in 4d4c05d Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vscode vscode plugin issues C-support Category: support questions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants