simrat39 / rust-tools.nvim

Tools for better development in rust using neovim's builtin lsp
MIT License
2.17k stars 159 forks source link

feat: 🎸 add rust fly check command #379

Open IWANABETHATGUY opened 1 year ago

IWANABETHATGUY commented 1 year ago
  1. rust cargo check after each save is pretty costly, especially when the project became very large.
  2. flyCheck is very useful in such a scenario, after running this command rust analyzer will on demand trigger cargo check and push the diagnostics into neovim lsp client
IWANABETHATGUY commented 1 year ago

https://user-images.githubusercontent.com/17974631/236387035-ff2f43eb-8e99-4ece-a587-5677407ac924.mp4

IWANABETHATGUY commented 1 year ago

related code in rust-analyzer vscode extension https://github.com/rust-lang/rust-analyzer/blob/master/editors/code/src/lsp_ext.ts#L45-L47

pgherveou commented 1 year ago

Looks pretty cool, do you need to disable checkOnSave when you want to use this?

IWANABETHATGUY commented 1 year ago

In theory, yes. Because if you enable checkOnSave, save will trigger a fly check already. This is only useful when cargo check cost pretty long time.

MunifTanjim commented 1 year ago

I've pulled this in https://github.com/MunifTanjim/rust-tools.nvim/tree/patched

pgherveou commented 1 year ago

In theory, yes. Because if you enable checkOnSave, save will trigger a fly check already. This is only useful when cargo check cost pretty long time.

So basically you only need to make sure you have this checkOnSave turned off to benefit from that feature. Might be worth adding a note about it in the doc so that people knows about it