aboutsummaryrefslogtreecommitdiff
path: root/crates
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
| |
| |
| \
*-. \ Merge #5951 #5975bors[bot]2020-09-1114-34/+53
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5951: Rename record_field_pat to record_pat_field r=jonas-schievink a=pksunkara The token was renamed but not this. 5975: Report better errors in project.json/sysroot r=jonas-schievink a=jonas-schievink This does a bunch of light refactoring so that the `Sysroot` is loaded later, which makes sure that any errors are reported to the user. I then added a check that reports an error if libcore is missing in the loaded sysroot. Since a sysroot without libcore is very useless, this indicates a configuration error. Co-authored-by: Pavan Kumar Sunkara <[email protected]> Co-authored-by: Jonas Schievink <[email protected]>
| | * | Report better errors in project.json/sysrootJonas Schievink2020-09-114-17/+36
| | | |
| * | | Rename record_field_pat to record_pat_fieldPavan Kumar Sunkara2020-09-1010-17/+17
| | | |
* | | | Merge #5970bors[bot]2020-09-111-37/+118
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | 5970: Use better heuristics for replacement text when removing dbg! r=jonas-schievink a=SomeoneToIgnore Closes https://github.com/rust-analyzer/rust-analyzer/issues/5911 Co-authored-by: Kirill Bulatov <[email protected]>
| * | | One more testKirill Bulatov2020-09-101-0/+2
| | | |
| * | | Use better heuristics for replacement text when removing dbg!Kirill Bulatov2020-09-101-37/+116
| |/ /
* | | Merge #5969bors[bot]2020-09-1110-5/+431
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5969: Propose module name completion options r=jonas-schievink a=SomeoneToIgnore <img width="539" alt="image" src="https://user-images.githubusercontent.com/2690773/92663009-cb0aec00-f308-11ea-9ef5-1faa91518031.png"> Currently traverses the whole file set every time we try to complete the module, as discussed in https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/mod.3C.7C.3E.20completion Co-authored-by: Kirill Bulatov <[email protected]>
| * | | Adjust the test commentKirill Bulatov2020-09-111-9/+16
| | | |
| * | | One more testKirill Bulatov2020-09-091-0/+15
| | | |
| * | | Rename the method to avoid false promisesKirill Bulatov2020-09-092-17/+15
| | | |
| * | | Add VirtualPath testsKirill Bulatov2020-09-091-3/+38
| | | |
| * | | Fix the testsKirill Bulatov2020-09-095-7/+9
| | | |
| * | | Add testsKirill Bulatov2020-09-091-0/+153
| | | |
| * | | Properly handle mod.rs importsKirill Bulatov2020-09-091-47/+40
| | | |
| * | | Complete semicolon when neededKirill Bulatov2020-09-096-26/+30
| | | |
| * | | Properly reacto to keywordsKirill Bulatov2020-09-096-4/+28
| | | |
| * | | Less false positive completion candidatesKirill Bulatov2020-09-091-44/+59
| | | |
| * | | Properly handle nested submodules in the same fileKirill Bulatov2020-09-091-70/+79
| | | |
| * | | Move most of the logic into the completion moduleKirill Bulatov2020-09-098-118/+107
| | | |
| * | | Finally cretae the mod completion moduleKirill Bulatov2020-09-094-18/+43
| | | |
| * | | Move rust-related logic from vfs to base_db levelKirill Bulatov2020-09-092-61/+74
| | | |
| * | | Properly handle special cases (binaries, mod.rs)Kirill Bulatov2020-09-093-52/+60
| | | |
| * | | Exclude special filesKirill Bulatov2020-09-092-3/+5
| | | |
| * | | Implement file name & extension retrieval method for VirtualPathKirill Bulatov2020-09-091-2/+20
| | | |
| * | | Small refactoringKirill Bulatov2020-09-092-32/+26
| | | |
| * | | Happy path implementedKirill Bulatov2020-09-098-26/+38
| | | |
| * | | Properly use FileSet APIKirill Bulatov2020-09-093-38/+49
| | | |
| * | | Better APIKirill Bulatov2020-09-098-24/+64
| | | |
| * | | First steps for mod<|> completionKirill Bulatov2020-09-094-6/+65
| |/ /
* | | Merge #5957bors[bot]2020-09-103-23/+66
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5957: Add consuming modifier to lvalues that are passed by value and not Copy r=jonas-schievink a=Nashenas88 Related to #5856 Co-authored-by: Paul Daniel Faria <[email protected]>
| * | | Fix handling of consuming self, refactor shared logic into a single functionPaul Daniel Faria2020-09-062-30/+34
| | | |
| * | | Add consuming modifier to lvalues that are passed by value and not CopyPaul Daniel Faria2020-09-063-14/+53
| | |/ | |/|
* | | Merge #5956bors[bot]2020-09-102-7/+89
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5956: Highlight errors in macros r=jonas-schievink a=popzxc Resolves #4924 This PR makes rust-analyzer highlight not only the source place when error originates in macro, but also the exact places in macro which caused an error. This is done by creating an inverse diagnostic, which points to the macro and cross-references the source place. ![изображение](https://user-images.githubusercontent.com/12111581/92319594-b71e6c00-f022-11ea-94c1-f412905269dd.png) Co-authored-by: Igor Aleksanov <[email protected]>
| * | Highlight errors in macrosIgor Aleksanov2020-09-062-7/+89
| |/
* | Merge #5968bors[bot]2020-09-093-14/+30
|\ \ | |/ |/| | | | | | | | | | | | | | | 5968: Lookup ADT and associated type names for chalk debugging / tweak chalk interner r=flodiebold a=nathanwhit This PR improves the chalk program writing integration by looking up the names for ADTs and associated types, making the output much more readable. There are also a few small changes to the interner, which gives some nice performance improvements. We clone `Ty`s and `ProgramClause`s relatively often in chalk, so wrapping them in `Arc`s is a perf win. This takes the time for performing type inference on the rust-analyzer codebase from 40s to 33s on my machine. Co-authored-by: Nathan Whitaker <[email protected]>
| * Tweak interner for chalkNathan Whitaker2020-09-091-9/+9
| |
| * Lookup ADT and assoc. type names for chalk debugNathan Whitaker2020-09-092-5/+21
| |
* | Merge #5940bors[bot]2020-09-045-1/+267
|\ \ | | | | | | | | | | | | | | | | | | | | | 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-043-11/+10
| | |
| * | Fix testsAleksei Sidorov2020-09-043-18/+25
| | |
| * | Update codegenAleksei Sidorov2020-09-041-0/+13
| | |
| * | Fix nitpicksAleksei Sidorov2020-09-042-24/+14
| | |
| * | Resolve most of corner casesAleksei Sidorov2020-09-032-12/+124
| | |
| * | Initial implementation of the #5085 issueAleksei Sidorov2020-09-034-0/+145
| | |
* | | Merge #5935bors[bot]2020-09-046-535/+744
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5935: Rewrite import insertion r=matklad a=Veykril This is my attempt at refactoring the import insertion #3947. I hope what I created here is somewhat in line with what was requested, it wouldn't surprise me . `common_prefix` is a copy from `merge_imports.rs` so those should be unified somewhere, `try_merge_trees` is also copied from there but slighly modified to take the `MergeBehaviour` enum into account. `MergeBehaviour` should in the end become a configuration option, and the order if `ImportGroup` probably as well? I'm not too familiar with the assist stuff and the like which is why I dont know what i have to do with `insert_use_statement` and `find_insert_use_container` for now. I will most likely add more test cases in the end as well as I currently only tried to hit every path in `find_insert_position`. Some of the merge tests also fail atm due to them not sorting what they insert. There is also this test case I'm not sure if we want to support it. I would assume we want to? https://github.com/rust-analyzer/rust-analyzer/pull/5935/files#diff-6923916dd8bdd2f1ab4b984adacd265fR540-R547 The entire module was rewritten so looking at the the file itself is probably better than looking at the diff. Regarding the sub issues of #3947: - #3301: This is fixed with the rewrite, what this implementation does is that it scans through the first occurence of groupings and picks the appropriate one out. This means the user can actually rearrange the groupings on a per file basis to their liking. If a group isnt being found it is inserted according to the `ImportGroup` variant order(Would be nice if this was configurable I imagine). - #3831: This should be fixed with the introduced `MergeBehaviour` enum and it's `Last` variant. - #3946: This should also be [fixed](https://github.com/rust-analyzer/rust-analyzer/pull/5935/files#diff-6923916dd8bdd2f1ab4b984adacd265fR87) - #5795: This is fixed in the sense that the grouping search picks the first group that is of the same kind as the import that is being added. So if there is a random import in the middle of the program it should only be considered if there is no group of the same kind in the file already present. - the last point in the list I havent checked yet, tho I got the feeling that it's not gonna be too simple as that will require knowledge of whether in this example `ast` is a crate or the module that is already imported. Co-authored-by: Lukas Wirth <[email protected]>
| * | | Add extra insert_use test for pub(crate) re-export handlingLukas Wirth2020-09-032-12/+19
| | | |