aboutsummaryrefslogtreecommitdiff
path: root/crates/assists/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge #6105bors[bot]2020-10-021-48/+85
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6105: Fix path comparison not comparing paths correctly with unequal lengths r=matklad a=Veykril ~~This PR includes the commit from #6102 there as I found a bug while writing that(so either merging this or both in order works) so I included a test there already which was just ignored.~~ This PR fixes that, basically inserting imports didn't consider path length for equality, so depending on the order it might insert the path before or after another import if they only differ in segment length. ~~Diff without the commit of #6102 https://github.com/rust-analyzer/rust-analyzer/commit/2d90d3937d71f9a00f3d44c15b20679215311637~~ Co-authored-by: Lukas Wirth <[email protected]>
| * | Fix path comparison not comparing paths correctly with unequal lengthsLukas Wirth2020-10-011-48/+85
| | |
* | | Merge #6104bors[bot]2020-10-022-2/+2
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | 6104: Minor clippy performance suggestions r=matklad a=kjeremy Co-authored-by: kjeremy <[email protected]>
| * | Minor clippy performance suggestionskjeremy2020-09-302-2/+2
| |/
* / Fix MergingBehaviour::Last not working properlyLukas Wirth2020-09-301-21/+52
|/
* 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
| |
* | Remove partial import test in insert_useLukas Wirth2020-09-251-10/+0
| |
* | Don't unnecessarily unnest imports for import insertionLukas Wirth2020-09-252-2/+66
| |
* | Document AstTransformationAleksey Kladov2020-09-211-0/+28
| |
* | 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-163-103/+287
|\ \ | |/ |/| | | | | | | | | | | | | | | 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]>
| * Add make::glob_use_tree function to create star-only UseTreeLukas Wirth2020-09-161-11/+3
| |
| * Fix merge imports failing if the `self` module import is in the wrong treeLukas Wirth2020-09-121-22/+34
| |
| * Tidy up `recursive_merge` implementationLukas Wirth2020-09-121-60/+60
| |
| * Reimplement import merging by making it recursive properly nesting all levelsLukas Wirth2020-09-123-83/+263
| |
* | Make MergeBehaviour configurableLukas Wirth2020-09-126-15/+27
|/
* Properly preserve macro bracesKirill Bulatov2020-09-111-25/+16
|
* Merge #5955bors[bot]2020-09-112-82/+114
|\ | | | | | | | | | | | | | | | | | | 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-052-6/+61
| |
| * Remove duplicated import merge logicLukas Wirth2020-09-052-77/+43
| |
| * Fix segment_iter not iterating segments properlyLukas Wirth2020-09-051-5/+16
| |
* | 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-043-0/+183
|\ | | | | | | | | | | | | | | 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-042-10/+10
| |
| * Fix testsAleksei Sidorov2020-09-042-17/+24
| |
| * Update codegenAleksei Sidorov2020-09-041-0/+13
| |
| * 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-032-0/+64
| |
* | Add extra insert_use test for pub(crate) re-export handlingLukas Wirth2020-09-032-12/+19
| |
* | Disable insert_import in extract_struct_from_enum_variant until its fixedLukas Wirth2020-09-031-0/+4
| |
* | Fix import insertion breaking nested modulesLukas Wirth2020-09-035-62/+117
| |
* | Fix inserting imports in front of inner attributesLukas Wirth2020-09-032-3/+54
| |
* | Replace insert_use_statement with the new insert_useLukas Wirth2020-09-034-54/+68
| |
* | Impl make::blank_lineLukas Wirth2020-09-032-26/+9
| |
* | Use mark to check that paths that are too long will not be mergedLukas Wirth2020-09-031-0/+13
| |
* | Tidy up tests and apply suggested changesLukas Wirth2020-09-031-72/+107
| |
* | Add more import insertion testsLukas Wirth2020-09-031-3/+68
| |
* | Begin refactor of import insertionLukas Wirth2020-09-031-468/+440
|/
* Unify namingAleksey Kladov2020-09-031-1/+1
|
* Reduce path_from_text usageAleksey Kladov2020-08-311-13/+17
|
* **Inline Variable** works with field shorthandAleksey Kladov2020-08-261-2/+29
|
* MinorAleksey Kladov2020-08-251-2/+1
|
* Cleanup invert-ifAleksey Kladov2020-08-251-19/+14
| | | | | * stick to trivial factory functions in make * compress the logic for inverting Option/Result
* Merge #5733bors[bot]2020-08-242-119/+617
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5733: Fix expand glob import bugs r=matklad a=unexge fixes https://github.com/rust-analyzer/rust-analyzer/issues/5709 TODOs: - [x] Incorrect node replacing <details> <summary>Details</summary> ```rust use crate::{ body::scope::{ExprScopes, ScopeId}, body::Body, builtin_type::BuiltinType, db::DefDatabase, expr::{ExprId, PatId}, generics::GenericParams, item_scope::{BuiltinShadowMode, BUILTIN_SCOPE}, nameres::CrateDefMap, path::*<|>, per_ns::PerNs, visibility::{RawVisibility, Visibility}, AdtId, AssocContainerId, ConstId, ContainerId, DefWithBodyId, EnumId, EnumVariantId, FunctionId, GenericDefId, HasModule, ImplId, LocalModuleId, Lookup, ModuleDefId, ModuleId, StaticId, StructId, TraitId, TypeAliasId, TypeParamId, VariantId, }; ``` becames ```rust use crate::{PathKind, name, name, ModPath}; ``` </details> - [x] Ignoring visibility <details> <summary>Details</summary> ```rust mod foo { mod bar { pub struct Bar; } } use foo::bar::*; fn baz(bar: Bar) {} ``` becames ```rust mod foo { mod bar { pub struct Bar; } } use foo::bar::Bar; fn baz(bar: Bar) {} ``` although mod `bar` is private </details> - [x] Eating attributes Co-authored-by: unexge <[email protected]>