aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | Rewrite goto definition testsAleksey Kladov2020-06-305-614/+487
| | | |
| * | | Better factoringAleksey Kladov2020-06-302-9/+18
| | | |
* | | | Merge #5135bors[bot]2020-06-301-5/+8
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5135: Generalize annotations r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | | Generalize annotationsAleksey Kladov2020-06-301-5/+8
|/ / /
* | | Merge #5132bors[bot]2020-06-305-7/+7
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5132: Fix some typos r=matklad a=davidlattimore Co-authored-by: David Lattimore <[email protected]>
| * | | Fix some typosDavid Lattimore2020-06-305-7/+7
| | | |
* | | | Merge #5101bors[bot]2020-06-3010-13/+377
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5101: Add expect -- a light-weight alternative to insta r=matklad a=matklad This PR implements a small snapshot-testing library. Snapshot updating is done by setting an env var, or by using editor feature (which runs a test with env-var set). Here's workflow for updating a failing test: ![expect](https://user-images.githubusercontent.com/1711539/85926956-28afa080-b8a3-11ea-9260-c6d0d8914d0b.gif) Here's workflow for adding a new test: ![expect-fresh](https://user-images.githubusercontent.com/1711539/85926961-306f4500-b8a3-11ea-9369-f2373e327a3f.gif) Note that colorized diffs are not implemented in this PR, but should be easy to add (we already use them in test_utils). Main differences from insta (which is essential for rust-analyzer development, thanks @mitsuhiko!): * self-updating tests, no need for a separate tool * fewer features (only inline snapshots, no redactions) * fewer deps (no yaml, no persistence) * tighter integration with editor * first-class snapshot object, which can be used to write test functions (as opposed to testing macros) * trivial to tweak for rust-analyzer needs, by virtue of being a workspace member. I think eventually we should converge to a single snapshot testing library, but I am not sure that `expect` is exactly right, so I suggest rolling with both insta and expect for some time (if folks agree that expect might be better in the first place!). # Editor Integration Implementation The thing I am most excited about is the ability to update a specific snapshot from the editor. I want this to be available to other snapshot-testing libraries (cc @mitsuhiko, @aaronabramov), so I want to document how this works. The ideal UI here would be a code action (:bulb:). Unfortunately, it seems like it is impossible to implement without some kind of persistence (if you save test failures into some kind of a database, like insta does, than you can read the database from the editor plugin). Note that it is possible to highlight error by outputing error message in rustc's format. Unfortunately, one can't use the same trick to implement a quick fix. For this reason, expect makes use of another rust-analyzer feature -- ability to run a single test at the cursor position. This does need some expect-specific code in rust-analyzer unfortunately. Specifically, if rust-analyzer notices that the cursor is on `expect!` macro, it adds a special flag to runnable's JSON. However, given #5017 it is possible to approximate this well-enough without rust-analyzer integration. Specifically, an extension can register a special runner which checks (using regexes) if rust-anlyzer runnable covers text with specific macro invocation and do special magic in that case. closes #3835 Co-authored-by: Aleksey Kladov <[email protected]>
| * | | Update crates/rust-analyzer/src/handlers.rsAleksey Kladov2020-06-281-3/+1
| | | | | | | | | | | | Co-authored-by: Veetaha <[email protected]>
| * | | Fix potential overflowAleksey Kladov2020-06-271-1/+1
| | | |
| * | | styleAleksey Kladov2020-06-271-2/+4
| | | |
| * | | Add colorsAleksey Kladov2020-06-273-5/+15
| | | |
| * | | Remove fragile testAleksey Kladov2020-06-271-29/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This test needs to be updated after every change (it contains line number), which is annoying. It also fails on windows due to \, so it's easier to remove it.
| * | | Update crates/expect/src/lib.rsAleksey Kladov2020-06-271-1/+1
| | | | | | | | | | | | Co-authored-by: bjorn3 <[email protected]>
| * | | Update crates/expect/src/lib.rsAleksey Kladov2020-06-271-2/+4
| | | | | | | | | | | | | | | | Co-authored-by: bjorn3 <[email protected]>
| * | | Add example expect test for goto definitionAleksey Kladov2020-06-273-8/+35
| | | |
| * | | Add light-weight snapshot testing library with editor integrationAleksey Kladov2020-06-278-5/+357
| | | |
* | | | Merge #5120bors[bot]2020-06-306-0/+73
|\ \ \ \ | |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | 5120: Add a simple SSR subcommand to the rust-analyzer command line binary r=davidlattimore a=davidlattimore Is adding the dependency on ra_ide_db OK? It's needed for the call to `db.local_roots()` Co-authored-by: David Lattimore <[email protected]>
| * | | Moved new deps to CLI-only sectionDavid Lattimore2020-06-301-2/+2
| | | |
| * | | Add a simple SSR subcommand to the rust-analyzer command line binaryDavid Lattimore2020-06-296-0/+73
| | | |
* | | | Merge #5128bors[bot]2020-06-291-4/+4
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5128: Update serde_json and cc r=kjeremy a=kjeremy Co-authored-by: kjeremy <[email protected]>
| * | | | Update serde_json and cckjeremy2020-06-291-4/+4
|/ / / /
* | | | Merge #5119bors[bot]2020-06-291-3/+9
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5119: Show notification while SSR is in progress r=matklad a=davidlattimore Ideally we would (a) show progress and (b) allow cancellation, but at least now there's some indication to the user that something is happening. Co-authored-by: David Lattimore <[email protected]>
| * | | | Show notification while SSR is in progressDavid Lattimore2020-06-291-3/+9
| |/ / / | | | | | | | | | | | | Ideally we would (a) show progress and (b) allow cancellation, but at least now there's some indication to the user that something is happening.
| | | |
| \ \ \
*-. \ \ \ Merge #5096 #5097bors[bot]2020-06-295-19/+38
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5096: Fix handling of whitespace when applying SSR within macro expansions. r=matklad a=davidlattimore I originally did replacement by passing in the full file text. Then as some point I thought I could do without it. Turns out calling .text() on a node coming from a macro expansion isn't a great idea, especially when you then try and use ranges from the original source to cut that text. The test I added here actually panics without the rest of this change (sorry I didn't notice sooner). 5097: Fix SSR prompt following #4919 r=matklad a=davidlattimore Co-authored-by: David Lattimore <[email protected]>
| | * | | | Fix SSR prompt following #4919David Lattimore2020-06-271-1/+1
| | | | | |
| * | | | | Fix handling of whitespace when applying SSR within macro expansions.David Lattimore2020-06-274-18/+37
| | | | | | | | | | | | | | | | | | | | | | | | I originally did replacement by passing in the full file text. Then as some point I thought I could do without it. Turns out calling .text() on a node coming from a macro expansion isn't a great idea, especially when you then try and use ranges from the original source to cut that text. The test I added here actually panics without the rest of this change (sorry I didn't notice sooner).
* | | | | | Merge #5122bors[bot]2020-06-291-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5122: Fix "Run | Debug" lens for examples r=matklad a=vsrs Fixes #4974 Co-authored-by: vsrs <[email protected]>
| * | | | | | Fix "Run | Debug" lens for examplesvsrs2020-06-291-1/+1
| | |_|/ / / | |/| | | |
* | | | | | Merge #5126bors[bot]2020-06-296-15/+25
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5126: Use more of FxHash* r=matklad a=lnicola ``` -rwxr-xr-x 1 me me 37917528 Jun 29 17:26 /home/me/.cargo/bin/rust-analyzer -rwxr-xr-x 1 me me 37904056 Jun 29 18:14 /home/me/.cargo/bin/rust-analyzer ``` Saved 13.5 KB there :-). Co-authored-by: LaurenÈ›iu Nicola <[email protected]>
| * | | | | | Use more of FxHash*Laurențiu Nicola2020-06-296-15/+25
| | | | | | |
* | | | | | | Merge #5127bors[bot]2020-06-2912-565/+434
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5127: Update the rest of the tests r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | | | | | Update the rest of the testsAleksey Kladov2020-06-299-446/+311
| | | | | | |
| * | | | | | (T): make typification tests more data drivenAleksey Kladov2020-06-295-133/+137
|/ / / / / /
* | | | | | Merge #5124bors[bot]2020-06-295-21/+98
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5124: (Partially) fix handling of type params depending on type params r=matklad a=flodiebold If the first type parameter gets inferred, that's still not handled correctly; it'll require some more refactoring: E.g. if we have `Thing<T, F=fn() -> T>` and then instantiate `Thing<_>`, that gets turned into `Thing<_, fn() -> _>` before the `_` is instantiated into a type variable -- so afterwards, we have two type variables without any connection to each other. Co-authored-by: Florian Diebold <[email protected]>
| * | | | | (Partially) fix handling of type params depending on type paramsFlorian Diebold2020-06-295-21/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the first type parameter gets inferred, that's still not handled correctly; it'll require some more refactoring: E.g. if we have `Thing<T, F=fn() -> T>` and then instantiate `Thing<_>`, that gets turned into `Thing<_, fn() -> _>` before the `_` is instantiated into a type variable -- so afterwards, we have two type variables without any connection to each other.
* | | | | | Merge #5105bors[bot]2020-06-2820-119/+44
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5105: Simlify with matches!() r=matklad a=Veetaha Co-authored-by: Veetaha <[email protected]>
| * | | | | | Get rid of unused importsVeetaha2020-06-282-10/+3
| | | | | | |
| * | | | | | Follow matklad suggestionsVeetaha2020-06-285-19/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Move vis_offset() to utils.rs - Shorten explicit ra_syntax::ast -> ast - Undo refactoring exhaustive pattern to non-exhaustive
| * | | | | | Simlify with matches!()Veetaha2020-06-2820-98/+32
| | | | | | |
* | | | | | | Merge #5114bors[bot]2020-06-283-94/+128
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5114: Cleanup cargo process handling in flycheck r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | | | | | | Cleanup cargo process handling in flycheckAleksey Kladov2020-06-282-61/+66
| | | | | | | |
| * | | | | | | More standard pattern for CargoAleksey Kladov2020-06-281-76/+83
| | | | | | | |
| * | | | | | | NamingAleksey Kladov2020-06-282-12/+11
| | | | | | | |
| * | | | | | | RenameAleksey Kladov2020-06-281-3/+3
| | | | | | | |
| * | | | | | | Make sure to join the childAleksey Kladov2020-06-281-2/+25
| | |/ / / / / | |/| | | | |
* | | | | | | Merge #5113bors[bot]2020-06-281-2/+2
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5113: Update instant r=kjeremy a=kjeremy Co-authored-by: Jeremy Kolb <[email protected]>
| * | | | | | | Update instantJeremy Kolb2020-06-281-2/+2
|/ / / / / / /
* | | | | | | Merge #5112bors[bot]2020-06-282-10/+14
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5112: Update Chalk to released version r=flodiebold a=flodiebold Co-authored-by: Florian Diebold <[email protected]>
| * | | | | | Update Chalk to released versionFlorian Diebold2020-06-282-10/+14
|/ / / / / /
* | | | | | Merge #5108bors[bot]2020-06-281-1/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5108: Don't show ra_fixture param hints r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>