lapce-rust icon indicating copy to clipboard operation
lapce-rust copied to clipboard

Tell rust-analyzer to only look at **.rs files

Open hbina opened this issue 2 years ago • 2 comments

This will fix an issue when trying to open the log file with the rust plugin installed. It causes a loop of error -> log -> error

[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log
[2023-01-22][12:16:06][lapce_data::proxy][ERROR] lsp server stderr: [ERROR rust_analyzer::main_loop] unexpected DidChangeTextDocument: /home/hbina/.local/share/lapce-stable/logs/20230122-121351.log

Signed-off-by: Hanif Bin Ariffin [email protected]

hbina avatar Jan 22 '23 04:01 hbina

It might also want Cargo.toml files and the like too? (I'm not too sure if your change would block that, but I'd suggest testing whether saving a Cargo.toml file - with a new dependency or whatever - causes RA to analyze based on that)

MinusGix avatar Jan 22 '23 21:01 MinusGix

You are right. RA should refresh its state whenever Cargo.toml is edited so we should also pattern match for Cargo.toml. I checked the official RA plugin for VSCode and it seems to not use any patterns at all?

https://github.com/rust-lang/rust-analyzer/blob/master/editors/code/src/client.ts#L75

hbina avatar Jan 22 '23 22:01 hbina