rust-lang / rust-lang/rust-analyzer
Main loop task queue never empty
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
After trying out different settings to make sure that the extensions is usable in VSCode, I arrived to the following solution which seems decent enough for now (few logs enable to understand what is going on):
{
"rust-analyzer.checkOnSave.extraArgs": [
"--target-dir",
"./target-analyzer/"
],
"rust-analyzer.files.excludeDirs": [
"./target",
"./target-analyzer"
],
"rust-analyzer.server.extraEnv": {
"CHALK_OVERFLOW_DEPTH": "2000",
"RA_LOG": "rust_analyzer=trace",
},
"rust-analyzer.trace.server": "verbose"
}
Now I noticed that there are few operations which get added to the queue even with no interaction with VSCode from my side, but apparently never get resolved, hence the queue always have a number of items that is > 0, and only increasing.
rust-analyzer version: v0.3.1091 (366bd7242 2022-06-12)
rustc version: 1.61.0 (fe5b13d68 2022-05-18)
This is part of the output I get:
[INFO rust_analyzer::main_loop] task queue len: 734
[DEBUG rust_analyzer::main_loop] handle_event(Notification(Notification { method: "$/cancelRequest", params: Object({"id": Number(1190)}) }))
[INFO rust_analyzer::main_loop] task queue len: 735
[DEBUG rust_analyzer::main_loop] handle_event(Notification { method: "textDocument/didChange" })
[INFO rust_analyzer::main_loop] task queue len: 735
[DEBUG rust_analyzer::main_loop] handle_event(Notification(Notification { method: "$/cancelRequest", params: Object({"id": Number(1189)}) }))
[DEBUG rust_analyzer::main_loop] handle_event(Retry(Request { id: RequestId(I32(307)), method: "textDocument/codeAction", params: Object({"textDocument": Object({"uri": String("file:///home/antonio/Developer/mashnet-node/pallets/public-credentials/src/lib.rs")}), "range": Object({"start": Object({"line": Number(162), "character": Number(2)}), "end": Object({"line": Number(163), "character": Number(26)})}), "context": Object({"diagnostics": Array([]), "triggerKind": Number(2)})}) }))
[DEBUG rust_analyzer::main_loop] will prime caches cause=restart after cancellation
[DEBUG rust_analyzer::main_loop] handle_event(Notification(Notification { method: "$/cancelRequest", params: Object({"id": Number(1184)}) }))
[INFO rust_analyzer::main_loop] task queue len: 735
[DEBUG rust_analyzer::main_loop] handle_event(Request(Request { id: RequestId(I32(1191)), method: "textDocument/completion", params: Object({"textDocument": Object({"uri": String("file:///home/antonio/Developer/mashnet-node/pallets/public-credentials/src/lib.rs")}), "position": Object({"line": Number(209), "character": Number(72)}), "context": Object({"triggerKind": Number(1)})}) }))
[INFO rust_analyzer::main_loop] task queue len: 735
[DEBUG rust_analyzer::main_loop] handle_event(Response(Response { id: RequestId(I32(303)), result: None, error: None }))
[INFO rust_analyzer::main_loop] task queue len: 736
[DEBUG rust_analyzer::main_loop] handle_event(Response { id: RequestId(I32(1035)), error: None })
[INFO rust_analyzer::main_loop] task queue len: 735
[DEBUG rust_analyzer::main_loop] handle_event(Response { id: RequestId(I32(785)), error: None })
[INFO rust_analyzer::main_loop] task queue len: 734
[DEBUG rust_analyzer::main_loop] handle_event(Notification(Notification { method: "$/cancelRequest", params: Object({"id": Number(1185)}) }))
[INFO rust_analyzer::main_loop] task queue len: 734
[DEBUG rust_analyzer::main_loop] handle_event(Request(Request { id: RequestId(I32(1192)), method: "textDocument/codeLens", params: Object({"textDocument": Object({"uri": String("file:///home/antonio/Developer/mashnet-node/pallets/public-credentials/src/lib.rs")})}) }))
[INFO rust_analyzer::main_loop] task queue len: 734
[DEBUG rust_analyzer::main_loop] handle_event(Request(Request { id: RequestId(I32(1193)), method: "textDocument/codeAction", params: Object({"textDocument": Object({"uri": String("file:///home/antonio/Developer/mashnet-node/pallets/public-credentials/src/lib.rs")}), "range": Object({"start": Object({"line": Number(209), "character": Number(72)}), "end": Object({"line": Number(209), "character": Number(72)})}), "context": Object({"diagnostics": Array([]), "triggerKind": Number(2)})}) }))
[INFO rust_analyzer::main_loop] task queue len: 735
[DEBUG rust_analyzer::main_loop] handle_event(Request(Request { id: RequestId(I32(1194)), method: "textDocument/documentSymbol", params: Object({"textDocument": Object({"uri": String("file:///home/antonio/Developer/mashnet-node/pallets/public-credentials/src/lib.rs")})}) }))
[INFO rust_analyzer::main_loop] task queue len: 736
[DEBUG rust_analyzer::main_loop] handle_event(Notification(Notification { method: "$/cancelRequest", params: Object({"id": Number(1193)}) }))
[INFO rust_analyzer::main_loop] task queue len: 737
[DEBUG rust_analyzer::main_loop] handle_event(Request(Request { id: RequestId(I32(1195)), method: "textDocument/codeAction", params: Object({"textDocument": Object({"uri": String("file:///home/antonio/Developer/mashnet-node/pallets/public-credentials/src/lib.rs")}), "range": Object({"start": Object({"line": Number(209), "character": Number(72)}), "end": Object({"line": Number(209), "character": Number(72)})}), "context": Object({"diagnostics": Array([]), "triggerKind": Number(2)})}) }))
[INFO rust_analyzer::main_loop] task queue len: 737
[DEBUG rust_analyzer::main_loop] handle_event(Notification(Notification { method: "$/cancelRequest", params: Object({"id": Number(1151)}) }))
[INFO rust_analyzer::main_loop] task queue len: 738
[DEBUG rust_analyzer::main_loop] handle_event(Request(Request { id: RequestId(I32(1196)), method: "textDocument/inlayHint", params: Object({"textDocument": Object({"uri": String("file:///home/antonio/Developer/mashnet-node/pallets/public-credentials/src/lib.rs")}), "range": Object({"start": Object({"line": Number(129), "character": Number(0)}), "end": Object({"line": Number(267), "character": Number(0)})})}) }))
[INFO rust_analyzer::main_loop] task queue len: 738
[DEBUG rust_analyzer::main_loop] handle_event(Request(Request { id: RequestId(I32(1197)), method: "textDocument/foldingRange", params: Object({"textDocument": Object({"uri": String("file:///home/antonio/Developer/mashnet-node/pallets/public-credentials/src/lib.rs")})}) }))
[INFO rust_analyzer::main_loop] task queue len: 739
[DEBUG rust_analyzer::main_loop] handle_event(Notification(Notification { method: "$/cancelRequest", params: Object({"id": Number(1192)}) }))
[INFO rust_analyzer::main_loop] task queue len: 740
[DEBUG rust_analyzer::main_loop] handle_event(Request(Request { id: RequestId(I32(1198)), method: "textDocument/codeLens", params: Object({"textDocument": Object({"uri": String("file:///home/antonio/Developer/mashnet-node/pallets/public-credentials/src/lib.rs")})}) }))
[INFO rust_analyzer::main_loop] task queue len: 740
[DEBUG rust_analyzer::main_loop] handle_event(Request(Request { id: RequestId(I32(1199)), method: "textDocument/hover", params: Object({"textDocument": Object({"uri": String("file:///home/antonio/Developer/mashnet-node/pallets/public-credentials/src/lib.rs")}), "position": Object({"line": Number(212), "character": Number(47)})}) }))
[INFO rust_analyzer::main_loop] task queue len: 741
[DEBUG rust_analyzer::main_loop] handle_event(Notification(Notification { method: "$/cancelRequest", params: Object({"id": Number(1199)}) }))
[INFO rust_analyzer::main_loop] task queue len: 742
[DEBUG rust_analyzer::main_loop] handle_event(Notification(Notification { method: "$/cancelRequest", params: Object({"id": Number(1191)}) }))
[INFO rust_analyzer::main_loop] task queue len: 742
[DEBUG rust_analyzer::main_loop] handle_event(Request(Request { id: RequestId(I32(1200)), method: "textDocument/inlayHint", params: Object({"textDocument": Object({"uri": String("file:///home/antonio/Developer/mashnet-node/pallets/public-credentials/src/lib.rs")}), "range": Object({"start": Object({"line": Number(129), "character": Number(0)}), "end": Object({"line": Number(267), "character": Number(0)})})}) }))
[INFO rust_analyzer::main_loop] task queue len: 742
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in rust_analyzer::main_loop and reproduce the growing queue with the VSCode settings and trace output shown in the issue. Follow the handling of cancellation notifications, requests, retries, and responses; done means the task queue no longer grows indefinitely during idle VSCode use.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100