lapce / lapce-rust

Apache License 2.0
80 stars 26 forks source link

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

Open hbina opened 1 year ago

hbina commented 1 year ago

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 hanif.ariffin.4326@gmail.com

MinusGix commented 1 year ago

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)

hbina commented 1 year ago

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