aboutsummaryrefslogtreecommitdiff
path: root/crates/assists/src/handlers
Commit message (Collapse)AuthorAgeFilesLines
...
| * | De-duplicate `add_group` callsite in qualify_pathLukas Wirth2020-10-161-121/+108
| | |
| * | Properly qualify trait methods in qualify_path assistLukas Wirth2020-10-152-47/+79
| | |
| * | Add mark tests to qualify_path assistLukas Wirth2020-10-141-0/+9
| | |
| * | Add qualify path assistLukas Wirth2020-10-141-0/+1020
| | |
* | | Don't rely on display names in inlay_hintsAleksey Kladov2020-10-202-2/+2
| | |
* | | Minor, rename featureAleksey Kladov2020-10-191-1/+1
| | |
* | | Change visibility works for type aliasesAleksey Kladov2020-10-182-5/+19
| |/ |/|
* | More idiomatic classification APIAleksey Kladov2020-10-152-4/+4
| |
* | Document auto_import as a featureLukas Wirth2020-10-151-0/+55
|/
*-. Merge #6207 #6224 #6226 #6227bors[bot]2020-10-141-241/+28
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6207: Extract ImportAssets out of auto_import r=matklad a=Veykril See https://github.com/rust-analyzer/rust-analyzer/pull/6172#issuecomment-707182140 I couldn't fully pull out `AssistContext` as `find_node_at_offset_with_descend`: https://github.com/rust-analyzer/rust-analyzer/blob/81fa00c5b5d5ffb559a39c7ff5190a2519a8ea61/crates/assists/src/assist_context.rs#L90-L92 requires the `SourceFile` which is private in it and I don't think making it public just for this is the right call? 6224: :arrow_up: salsa r=matklad a=matklad bors r+ 🤖 6226: Add reminder to update lsp-extensions.md r=matklad a=matklad bors r+ 🤖 6227: Reduce bors timeout r=matklad a=matklad bors r+ 🤖 Co-authored-by: Lukas Wirth <[email protected]> Co-authored-by: Aleksey Kladov <[email protected]>
* | | Fix stackoverflow in insert_use::recursive_mergeLukas Wirth2020-10-142-0/+31
| |/ |/|
* | Fix MergeBehaviour::Full not working when merging nested long pathsLukas Wirth2020-10-131-1/+1
| |
| * 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
|/
* Merge #6130 #6135bors[bot]2020-10-121-65/+67
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6130: Items case quick fix (snake_case / UPPER_SNAKE_CASE / CamelCase) r=matklad a=popzxc Resolves #4598. After a third try, it finally works. Boy, it appeared tougher than it seemed. Initially I thought like "Ha, `rustc` already tells us where idents are named incorrectly. It shouldn't be that hard, should it?". Well, the problems with the information provided by `rustc` appeared shortly: - `rustc` warnings are `flycheck` warnings, which are slightly aside from our diagnostics with fixes. When we map flycheck diagnostic to LSP, we can convert it into a fix, but only if it's marked as `Applicability::MachineApplicable`. Name case fix is marked `Applicability::MaybeIncorrect`, and for a reason: it only suggest to rename symbol under cursor, without tracking any references. - Warning spawned by `rustc` are identified by string labels rather than enum. It means that if one day the diagnostic will be renamed in `rustc`, `rust-analyzer` code will still compile, but won't find the required diagnostic by name anymore. If by chance this will happen when some unlucky guy will decide to create their first pull request, they'll be confused by suddenly failing tests (likely) not related to their changes. - Even if we'll try to build fixes atop of `rustc` warnings, we'll have to do it in the `rust_analyzer::diagnostics::to_proto` module, which is far less convenient for that matter than `ide` crate. That's why I decided that it's worth a separate `rust-analyzer` diagnostic, which will implement `DiagnosticWithFix` trait. After that, I discovered that currently `hir_ty::diagnostics` only check `DefWithBody` types, like function bodies. I had to add support for diagnostics which look at any `ModuleDef`. And of course, since I'd added a lot of new functionality, it required extensive testing. That explains why the diff is so big for a (looking) relatively small feature. I hope that this PR doesn't only add a small feature, but also creates a base for building another features. ## Example: ![case_quick_fix](https://user-images.githubusercontent.com/12111581/95008475-e07ee780-0622-11eb-9978-62a9ea0e7782.gif) P.S. My eyes were bleeding when I had to write the code for the example... 6135: when generating new function, focus on return type instead of body r=matklad a=bnjjj I made a little change when we use the assist to generate a new function, instead of focusing on the function body, it will focus on return type Co-authored-by: Igor Aleksanov <[email protected]> Co-authored-by: Benjamin Coenen <[email protected]>
| * when generating new function, focus on return type instead of bodyBenjamin Coenen2020-10-081-65/+67
| | | | | | | | Signed-off-by: Benjamin Coenen <[email protected]>
* | adt: correctly inherit field visibility from enumJonas Schievink2020-10-091-6/+4
|/ | | | | | | Previously, "find all references" on a variant field wouldn't find any references outside the defining module. This is because variant fields were incorrectly assumed to be private, like struct fields without explicit visibility, but they actually inherit the enum's visibility.
* Move ModPath->ast::Path function to IDE layerAleksey Kladov2020-10-064-7/+37
| | | | closes #6092
* Merge #6139bors[bot]2020-10-061-6/+10
|\ | | | | | | | | | | | | | | | | | | | | | | 6139: Make find_path_prefixed configurable r=matklad a=Veykril This makes `find_path_prefixed` more configurable allowing one to choose whether it always returns absolute paths, self-prefixed paths or to ignore local imports when building the path. The config names are just thrown in here, taking better names if they exist :) This should fix #6131 as well? Co-authored-by: Lukas Wirth <[email protected]>
| * Make ImportPrefix a configuration optionLukas Wirth2020-10-051-6/+10
| |
* | Do not leave braces for colons in dbg!Kirill Bulatov2020-10-061-2/+7
| |
* | Merge #6111bors[bot]2020-10-051-0/+701
|\ \ | |/ |/| | | | | | | | | | | | | | | | | 6111: Add assist for converting the base of integer literals. r=SomeoneToIgnore a=vlakreeh This PR adds an assist similar to Intellij's [convert number to](https://i.imgur.com/JH6wstP.png). It also does a small refactor to [assists/src/tests.rs](https://github.com/rust-analyzer/rust-analyzer/blob/fc34403018079ea053f26d0a31b7517053c7dd8c/crates/assists/src/tests.rs) to add the ability to specify the resolved assist for a specific action within an assist group. ## Demo ![Demo of the assist in action](https://i.imgur.com/MBhdPFH.gif) Co-authored-by: vlakreeh <[email protected]>
| * Add tests for convert integer literal assistvlakreeh2020-09-301-4/+570
| |
| * Add convert integer literal assistvlakreeh2020-09-291-0/+135
| |
* | Minor clippy performance suggestionskjeremy2020-09-302-2/+2
|/
* Merge #6019bors[bot]2020-09-294-38/+11
|\ | | | | | | | | | | | | | | 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-164-38/+11
| |
* | MicrooptimizeAleksey Kladov2020-09-281-6/+7
| |
* | Don't unnecessarily unnest imports for import insertionLukas Wirth2020-09-252-2/+66
| |
* | Rename impl edit method to be more explicitMatt Hooper2020-09-211-1/+1
| |
* | Added test for impl member assist when impl def is missing bracesMatt Hooper2020-09-211-0/+19
| |
* | Replace entire impl def instead of only associated items for missing impl ↵Matt Hooper2020-09-211-9/+12
| | | | | | | | member assist (if braces are missing from an impl def then there is no associated item list in the AST)
* | Merge #5989bors[bot]2020-09-162-19/+15
|\ \ | |/ |/| | | | | | | | | | | | | | | 5989: Rewrite import merging r=jonas-schievink a=Veykril Rewrites how import merging is being handled. It is now a recursive function to properly handle merging of intermediate levels in the import trees. With this ordering the imports is also now possible tho it doesn't quite order it the same way as `rustfmt` does yet, namely it orders lowercase identifiers after uppercase identifiers as that is the standard character order that rust uses. This also fixes a few weird behaviors that were visible in some of the `replace_qualified_name_with_use.rs` tests. This really took longer than I was hoping for, fighting with import trees is quite the exhausting task 😅 Co-authored-by: Lukas Wirth <[email protected]>
| * Reimplement import merging by making it recursive properly nesting all levelsLukas Wirth2020-09-122-19/+15
| |
* | Make MergeBehaviour configurableLukas Wirth2020-09-123-11/+6
|/
* Properly preserve macro bracesKirill Bulatov2020-09-111-25/+16
|
* Merge #5955bors[bot]2020-09-111-75/+86
|\ | | | | | | | | | | | | | | | | | | 5955: Remove merge import code duplication r=jonas-schievink a=Veykril This removes the code duplication caused by #5935, this also allows the assist to merge imports that have equal visibility and prevents merges of unequal visibility. This PR also fixes an iteration mistake in the mentioned PR: Turns out I made a mistake when writing the `segment_iter` function, I was assuming that the `children` of a path will just be the segments, which is obviously not the case. This also brings insertion order of shorter paths in line with how `rustfmt` orders them. Co-authored-by: Lukas Wirth <[email protected]>
| * Allow merge_imports assists to merge imports of equal visibilityLukas Wirth2020-09-051-0/+50
| |
| * Remove duplicated import merge logicLukas Wirth2020-09-051-75/+36
| |
* | One more testKirill Bulatov2020-09-101-0/+2
| |
* | Use better heuristics for replacement text when removing dbg!Kirill Bulatov2020-09-101-37/+116
|/
* Merge #5940bors[bot]2020-09-041-0/+168
|\ | | | | | | | | | | | | | | 5940: Implement "Replace `impl Trait` function argument with the named generic" assist. r=matklad a=alekseysidorov Fixes #5085 Co-authored-by: Aleksei Sidorov <[email protected]>
| * Remove unnecessary commaAleksei Sidorov2020-09-041-9/+9
| |
| * Fix testsAleksei Sidorov2020-09-041-15/+22
| |
| * Fix nitpicksAleksei Sidorov2020-09-041-7/+12
| |
| * Resolve most of corner casesAleksei Sidorov2020-09-031-8/+102
| |
| * Initial implementation of the #5085 issueAleksei Sidorov2020-09-031-0/+62
| |
* | Add extra insert_use test for pub(crate) re-export handlingLukas Wirth2020-09-031-4/+5
| |
* | Disable insert_import in extract_struct_from_enum_variant until its fixedLukas Wirth2020-09-031-0/+4
| |