aboutsummaryrefslogtreecommitdiff
path: root/crates/assists/src/handlers/auto_import.rs
Commit message (Collapse)AuthorAgeFilesLines
* Merge #6172bors[bot]2020-10-201-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6172: Add qualify path assist r=matklad a=Veykril This implements a `qualify_path` assist which works quite similar to the `auto_import` assist but instead of adding imports to the file it well, qualifies the path. This PR also moves out the `AutoImportAssets` struct and functions from `auto_import` into a utils submodule as most of this is now shared between `auto_import` and `qualify_path`. Changes made to `AutoImportAssets` are solely in its `search_for_imports` function which now takes a prefixed parameter to discern between using `find_use_path_prefixed` and `find_use_path` as the former is the required behavior by `auto_import` and the latter by this assist. For missing imported traits instead of importing this will qualify the path with a trait cast as in: ```rust test_mod::TestStruct::TEST_CONST<|> ``` becomes ```rust <test_mod::TestStruct as test_mod::TestTrait>::TEST_CONST ``` and for trait methods ideally it would do the following: ```rust let test_struct = test_mod::TestStruct {}; test_struct.test_meth<|>od() ``` becomes ```rust let test_struct = test_mod::TestStruct {}; test_mod::TestTrait::test_method(&test_struct) ``` Fixes #4124. Co-authored-by: Lukas Wirth <[email protected]>
| * Properly qualify trait methods in qualify_path assistLukas Wirth2020-10-151-1/+1
| |
* | Minor, rename featureAleksey Kladov2020-10-191-1/+1
| |
* | Document auto_import as a featureLukas Wirth2020-10-151-0/+55
|/
* Slightly cleanup import_assets moduleLukas Wirth2020-10-131-6/+6
|
* Adhere to style guidelines in import_assetsLukas Wirth2020-10-131-6/+16
|
* Extract ImportAssets out of auto_importLukas Wirth2020-10-131-241/+18
|
* Move ModPath->ast::Path function to IDE layerAleksey Kladov2020-10-061-2/+5
| | | | closes #6092
* Make ImportPrefix a configuration optionLukas Wirth2020-10-051-6/+10
|
* Merge #6019bors[bot]2020-09-291-6/+2
|\ | | | | | | | | | | | | | | 6019: Remove make::path_from_text r=matklad a=Veykril This removes the `make::path_from_text` function, which according to a note should've been private. I removed it since it didn't really serve a purpose as it was simply wrapping `make::ast_from_text`. Co-authored-by: Lukas Wirth <[email protected]>
| * Remove make::path_from_textLukas Wirth2020-09-161-6/+2
| |
* | Don't unnecessarily unnest imports for import insertionLukas Wirth2020-09-251-2/+31
|/
* Make MergeBehaviour configurableLukas Wirth2020-09-121-5/+2
|
* Fix import insertion breaking nested modulesLukas Wirth2020-09-031-5/+6
|
* Replace insert_use_statement with the new insert_useLukas Wirth2020-09-031-7/+12
|
* :arrow_up: ungrammarAleksey Kladov2020-08-211-1/+1
|
* Don't expose hir::Path out of hirAleksey Kladov2020-08-151-1/+1
| | | | | | | | | | | | | | Conjecture: it's impossible to use hir::Path *correctly* from an IDE. I am not entirely sure about this, and we might need to add it back at some point, but I have to arguments that convince me that we probably won't: * `hir::Path` has to know about hygiene, which an IDE can't set up properly. * `hir::Path` lacks identity, but you actually have to know identity to resolve it correctly
* Rename ra_assists -> assistsAleksey Kladov2020-08-131-0/+1088