You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In ratatui, performing the Import <type> quick fix on Color shows: color_eyre::owo_..., another color_eyre import, ratatui::style::Color, then a crossterm import. The order that I want always is current crate types first, then alphabetical. The sort order seems pretty random right now.
Why? Ctrl+., Enter Enter should be muscle memory
Even better might be to add an extra quick fix if there are crate imports that match as well as external imports: e.g.:
Should have the same option to 'ratatui::style::Color` as this does:
Why? Different UI modality (menu vs popup) for the same action (add an import from this crate). They should be the same where possible to make muscle memory / defaults just work. Right now the popup is jarring as there's no general way to guess if you're going to hit one or the other until you actually view the result (assuming your hands are typing ahead rather than responding to what you see on the screen).
Does this sound like a reasonable heuristic? Is "one of the imports is in this workspace" something that can be determined while getting the list of valid imports?
The text was updated successfully, but these errors were encountered:
There are heuristics that handle the sort order, but in terms of preference for your code it seems to stop at the crate boundary. (link) It probably makes sense to make preference for workspace items somewhere between crate and std?
It took me a minute to work out why my example for this was not picking up the same crate logic. This code was in an example, so it's not in the same crate technically.
…kril
Add preference modifier for workspace-local crates when using auto import.
`@joshka` pointed out some odd behavior of auto import ordering. It doesn't seem that the current heuristics were applying any sort of precedence to imports from the workspace. I've went ahead and added that.
I hope to get some feedback on the modifier numbers here. I just went with something that felt like it balanced giving more power to workspace crates without completely ignoring relative path distance.
closesrust-lang/rust-analyzer#17303
In ratatui, performing the
Import <type>
quick fix on Color shows: color_eyre::owo_..., another color_eyre import, ratatui::style::Color, then a crossterm import. The order that I want always is current crate types first, then alphabetical. The sort order seems pretty random right now.Why? Ctrl+., Enter Enter should be muscle memory
Even better might be to add an extra quick fix if there are crate imports that match as well as external imports: e.g.:
![image](https://private-user-images.githubusercontent.com/381361/334363783-c49e4b90-2598-4767-8e0a-29c9acbd612f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJ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ZT0yMDI1MDIwN1QyMTI5MzRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jODdkMDk4OGUwOTQ0NzZjMTMxNjI4ODVlNDYxZTg1MzI4ODQ1MjZlYThmNzgxZTVjMGQ3ZDY4NTgwYzg5MDY5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.gEvhskPavDdF2sjzFWoK412yvP5WQpQs2CcIkUOjGaI)
Should have the same option to 'ratatui::style::Color` as this does:
Why? Different UI modality (menu vs popup) for the same action (add an import from this crate). They should be the same where possible to make muscle memory / defaults just work. Right now the popup is jarring as there's no general way to guess if you're going to hit one or the other until you actually view the result (assuming your hands are typing ahead rather than responding to what you see on the screen).
Does this sound like a reasonable heuristic? Is "one of the imports is in this workspace" something that can be determined while getting the list of valid imports?
The text was updated successfully, but these errors were encountered: