-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[just for feedback] Flycheck individual function #11342
Conversation
I think while it's a nice idea, there are several problems with this approach.
|
So we want to drop flycheck at some point? There are dozens of lint in rustc and hundereds in clippy, implementing all of them natively is duplicate effort and not a good idea IMO. I can see a shared lint library as a final solution, but a very very far one?
Nothing prevent us from running it on all functions of a file. Running rustc on the example above takes 100ms, but running it on 10 copies of it still takes 100ms and 100 copies of it takes 300ms. So we can run it on all functions of a file on open in ~500ms, and all changed functions in ~100ms, showing diagnostics in every visible function.
I mean, we don't do it on each keystroke. That sentence is just saying that there is a problem with current flycheck and this one is better. |
I think the idea is that eventually librarification of rustc will allow sharing most code, including lints, between rustc and rust-analyzer, with only the glue code being different to allow for eager batch compilation (rustc) vs incremental on-demand analysis (rust-analyzer). |
See also #3107 for some more context. Performance is not the main reason that we don't run check on type, the lack of a VFS that can be shared with rustc is. |
I know the plan, but progress on librarification is somehow slow. And a shared lint library is probably in the last steps. It depends on shared ast, shared types, shared hir, ... so I think it takes years.
hmm, I tried auto save as suggested in that thread, it turned on laptop fans and some errors take ~5s to appear, but it wasn't as bad as I expected. I thought running it on save is some kind of throttling for saving system resources. Flycheck + autosave is not perfect, but it works, and this one is not flawless either, so we can close it. |
This is an attempt to display rustc errors while editing code. We can't run
cargo check
on whole project because it will burn the cpu and take some seconds to finish (is this the problem?), But we can check the under edit function by including it and header of what it uses.For example, we want to check
foo
function in this code:This PR contains a code that generate this code:
The code is no where near complete, Its only a proof-of-concept and I just wanted to make sure it works. We can send this code to rustc (or clippy or ...), get the result, shift the span to match original input and show them (this is not implemented in this PR, and I don't exactly know how to do it)
Problems
==
cannot be applied to type_ra_E0<_ra_E0<_ra_S2>>
" and we should restore original names.Any comments? Is it in the right direction? It is somehow hacky and we may want to do it in a more reasonable way, for example by calling special rustc apis designed for this propose.