aboutsummaryrefslogtreecommitdiff
path: root/crates/assists
Commit message (Collapse)AuthorAgeFilesLines
* 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]>
| * Use new `Definition::usages` API in expand glob importunexge2020-08-201-1/+1
| |
| * Fix importing private modules in expand glob importunexge2020-08-201-0/+52
| |
| * Fix importing unused traits in expand glob importunexge2020-08-201-28/+73
| |
| * Use fixme instead of todounexge2020-08-201-1/+1
| |
| * Use `Definition::find_usages` for finding used items in expand glob importunexge2020-08-202-114/+137
| |
| * Run rustfmtunexge2020-08-201-3/+5
| |
| * Handle more cases in AST replacing in expand glob importunexge2020-08-201-34/+219
| |
| * Improve AST replacing in expand glob importunexge2020-08-201-38/+229
| |
* | Merge #4776bors[bot]2020-08-241-8/+9
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | 4776: Do a weekly minor publish to crates.io r=matklad a=pksunkara This is the same system I set up on Chalk repo. Every week it creates a new minor version, pushes it to github and then deploys it to crates.io. Co-authored-by: Pavan Kumar Sunkara <[email protected]>
| * | Add description for crates that will be publishedPavan Kumar Sunkara2020-08-241-0/+1
| | |
| * | Add version to deps in cargo.tomlPavan Kumar Sunkara2020-08-241-8/+8
| | |
* | | Invert if should be smart about is_some, is_none, is_ok, is_errdragfire2020-08-242-1/+38
|/ /
* / :arrow_up: ungrammarAleksey Kladov2020-08-212-2/+2
|/
* **Remove Unused Parameter** refactoringAleksey Kladov2020-08-196-6/+162
|
* Future proof find-usages APIAleksey Kladov2020-08-192-2/+2
| | | | | | We might want to provide more efficient impls for check if usages exist, limiting the search, filtering and cancellation, so let's violate YAGNI a bit here.
* Introduce LabelAleksey Kladov2020-08-182-18/+11
|
*-. Merge #5776 #5780bors[bot]2020-08-172-6/+60
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5776: Fix eslint errors on .eslintrc.js and rollup.config.js r=matklad a=fuafa Eslint complains if these two files does not include in the `tsconfig.json`. ``` Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: .eslintrc.js. The file must be included in at least one of the projects provided.eslint ``` ![image](https://user-images.githubusercontent.com/20750310/90338269-176d4f80-e01b-11ea-8710-3ea817b235d2.png) 5780: Fixup whitespace when adding missing impl items r=matklad a=jDomantas Generate properly formatted whitespace when adding impl items - with an empty line between items and removing extra whitespace that often appears at the end. This is my first time working on rust analyzer so I'm not very familiar with its internal APIs. If there's a better way to do such syntax tree editing I'd be glad to hear it. Co-authored-by: xiaofa <[email protected]> Co-authored-by: jDomantas <[email protected]>
| | * update generated testsjDomantas2020-08-171-2/+1
| | |
| | * fixup whitespace when adding missing impl itemsjDomantas2020-08-141-4/+59
| | |
* | | Don't make fields private unless you have toAleksey Kladov2020-08-171-27/+10
|/ /
* | Don't expose hir::Path out of hirAleksey Kladov2020-08-155-47/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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