Commit graph

872 commits

Author SHA1 Message Date
bors[bot]
d13ded6cbc
Merge #5101
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 (💡). 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 <aleksey.kladov@gmail.com>
2020-06-30 08:34:08 +00:00
bors[bot]
9f12903bb1
Merge #5119
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 <dml@google.com>
2020-06-29 16:10:43 +00:00
David Lattimore
43b7d505da Show notification while SSR is in progress
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.
2020-06-29 19:17:35 +10:00
Aleksey Kladov
03c5a6690d Add light-weight snapshot testing library with editor integration 2020-06-27 19:22:31 +02:00
David Lattimore
2a18ef0b09 Fix SSR prompt following #4919 2020-06-27 21:26:28 +10:00
bors[bot]
e07826b199
Merge #5017
5017: Add custom cargo runners support. r=matklad a=vsrs

This PR adds an option to delegate actual cargo commands building to another extension. For example, to use a different manager like [cross](https://github.com/rust-embedded/cross).

https://github.com/vsrs/cross-rust-analyzer is an example of such extension. I'll publish it after the rust-analyzer release with this functionality.

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/4902

Co-authored-by: vsrs <vit@conrlab.com>
2020-06-26 16:52:53 +00:00
Aleksey Kladov
76a530242a Merge branch 'Veetaha-feat/sync-branch' 2020-06-25 07:56:47 +02:00
bors[bot]
104fad65da
Merge #5025
5025: Don't mess with messy temp dir and just download into extension dir r=matklad a=Veetaha

Temp dirs are messy. Dealing with them requires handling quite a bunch of
edge cases. As proposed by lnicola this seems better to just put the temp files
in the extension dir and not care much about suddenly leaving garbage.
Instead we get shorter and less platform-caveat-y code.
We will also assume users don't try to issue a download in different vscode windows simultaneously.

Fixes #5019 

Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-06-24 22:09:28 +00:00
Veetaha
c1d39571c9 Append 10 random hex chars to temp artifact files 2020-06-25 01:00:30 +03:00
Laurențiu Nicola
3d872b233b Remove namedExports config 2020-06-24 14:09:12 +03:00
Veetaha
62ebaa822b Don't mess with messy temp dir and just download into extension dir
Temp dirs are messy. Dealing with them requires handling quite a bunch of
edge cases. As proposed by lnicola this seems better to just put the temp files
in the extension dir and not care much about suddenly leaving garbage.
Instead we get shorter and less platform-caveat-y code.
We will also assume users don't try to issue a download in different vscode windows simultaneously
2020-06-24 13:19:14 +03:00
vsrs
2791f37a04 Fix ts lints 2020-06-24 12:30:41 +03:00
vsrs
647b126da5 Switch to ShellExecution instead of full Task 2020-06-24 10:53:49 +03:00
vsrs
a43a9103bc Add custom cargo runners 2020-06-24 10:53:49 +03:00
bors[bot]
45f3a5f9c1
Merge #4992 #4993 #4994 #4997 #4998
4992: Never disable error logging on the frontend r=matklad a=Veetaha



4993: Make bootstrap error message more informative and better-fitting r=matklad a=Veetaha

Now this better fits standard vscode extension activation failure message and suggests enabling verbose logs.

![image](https://user-images.githubusercontent.com/36276403/85321828-ffbb9400-b4cd-11ea-8adf-4032b1f62dfd.png)


4994: Decouple http file stream logic from temp dir logic r=matklad a=Veetaha

Followup for #4989 

4997: Update manual.adoc r=matklad a=gwutz

GNOME Builder (Nightly) supports now rust-analyzer

4998: Disrecommend trace.server: "verbose" for regular users r=matklad a=Veetaha

This option has never been useful for me, I wonder if anyone finds regular users can use this for sending logs

Co-authored-by: Veetaha <veetaha2@gmail.com>
Co-authored-by: Günther Wagner <info@gunibert.de>
2020-06-23 10:09:58 +00:00
Veetaha
426122ffc0 Disrecommend trace.server: "verbose" for regular users 2020-06-22 23:57:36 +03:00
Veetaha
0514d817db Decouple http file stream logic from temp dir logic 2020-06-22 21:43:53 +03:00
Veetaha
c2221ff7e8 Never disable error logging on the frontend 2020-06-22 21:30:32 +03:00
Veetaha
3fd49d8b94 Make bootstrap error message more informative and better-fitting 2020-06-22 21:18:36 +03:00
Veetaha
2d32e97cf9 Hotfix skipping the first chunks of the artifacts 2020-06-22 19:50:57 +03:00
Veetaha
dceb81856e Download artifacts into tmp dir 2020-06-20 15:45:30 +03:00
Veetaha
d6e89244ec Update workaround comment 2020-06-19 20:52:06 +03:00
veetaha
76c1160ffa Migrate flycheck to fully-lsp-compatible progress reports (introduce ra_progress crate) 2020-06-18 14:50:56 +03:00
vsrs
7e986d1504 Add rust-analyzer.gotoLocation command 2020-06-18 10:15:43 +03:00
vsrs
4d6c6a6b1e Fix rust-analyzer.debug.openDebugPane option 2020-06-18 10:15:42 +03:00
Gabriel Valfridsson
656e95211e Warnings as hint or info 2020-06-17 00:00:43 +02:00
Clemens Wasser
fe21fc2d25 checkOnSafe.features and checkOnSafe.allFeatures now work identically. 2020-06-10 09:37:26 +02:00
Clemens Wasser
33b9058838 Most of the checkOnSafe options now default to the cargo equivalent. 2020-06-10 09:27:25 +02:00
Clemens Wasser
47ef544fa5 Added the rust-analyzer.checkOnSave.features option. 2020-06-10 08:51:11 +02:00
bors[bot]
6e4fca5882
Merge #4773
4773: Run|Debug hover actions. r=matklad a=vsrs

![hover_actions_run](https://user-images.githubusercontent.com/62505555/83335644-dfc1f780-a2b6-11ea-820b-ccaa82290e7d.gif)

This hover actions work exactly like corresponding lenses.

Co-authored-by: vsrs <vit@conrlab.com>
2020-06-08 11:29:35 +00:00
Vincent Isambart
3162b9ed8f Fix VSCode settings 2020-06-07 12:07:00 +09:00
vsrs
3434f1dd2c Add Run|Debug hover actions 2020-06-06 18:17:52 +03:00
vsrs
b91fa7494e Fix Run lens. 2020-06-06 15:12:17 +03:00
vsrs
78c9223b7b Remove hover contents marking as trusted.
Hover contents might be extracted from raw
doc comments and need some validation.
2020-06-05 15:25:01 +03:00
vsrs
da7ec4b339 Add hover actions LSP extension documentation. 2020-06-05 15:00:28 +03:00
vsrs
7d0dd17b09 Add hover actions as LSP extension 2020-06-05 14:59:26 +03:00
Mikhail Rakhmanov
6a0083a519 Merge branch 'master' into compute-lazy-assits
# Conflicts:
#	crates/rust-analyzer/src/main_loop/handlers.rs
#	crates/rust-analyzer/src/to_proto.rs
2020-06-03 19:26:01 +02:00
Mikhail Rakhmanov
bacd0428fa Fix review comments 2020-06-03 18:39:01 +02:00
Aleksey Kladov
fa019c8f56 Document rust-project.json 2020-06-03 15:17:26 +02:00
Mikhail Rakhmanov
cb482e6351 Merge remote-tracking branch 'upstream/master' into compute-lazy-assits
# Conflicts:
#	crates/rust-analyzer/src/to_proto.rs
2020-06-02 23:22:45 +02:00
Mikhail Rakhmanov
57cd936c52 Preliminary implementation of lazy CodeAssits 2020-06-02 23:10:53 +02:00
bors[bot]
2f6ab77708
Merge #4710
4710: New runnables r=matklad a=matklad

bors d=@vsrs

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-02 20:44:56 +00:00
bors[bot]
0035dafbfa
Merge #4711
4711: Disable rust-analyzer.{cargo,checkOnSave}.allFeatures by default r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-02 16:16:38 +00:00
Laurențiu Nicola
7a66d99897 Disable rust-analyzer.{cargo,checkOnSave}.allFeatures by default 2020-06-02 19:14:34 +03:00
Aleksey Kladov
a83ab820a4 Spec better runnables 2020-06-02 17:34:18 +02:00
Aleksey Kladov
0303982119 New runnables API 2020-06-02 17:22:42 +02:00
Aleksey Kladov
0ced18eee0 Move run commands to commands.ts 2020-06-02 14:52:55 +02:00
bors[bot]
131ccd9540
Merge #4580
4580: Fix invoking cargo without consulting CARGO env var or standard installation paths r=matklad a=Veetaha

Followup for #4329

The pr essentially fixes [this bug](https://youtu.be/EzQ7YIIo1rY?t=2189)

cc @lefticus

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-06-02 11:58:28 +00:00
Alin Sinpalean
771457ec5c Always derive from process.env when spawning a child process/shell execution
This is useful when an extension (e.g. Nix Environment Selector) or launch
configuration sets one or more environment variables.

When `env` is not explicitly specified in the options passed to
`child_process.spawn()` or `vscode.ShellExecution()`, then `process.env` gets
applied automatically. But when an explicit `env` is set, it should inherit from
`process.env` rather than replace it completely.
2020-05-31 13:41:55 +02:00
veetaha
d605ec9c32 Change Runnable.bin -> Runnable.kind
As per matklad, we now pass the responsibility for finding the binary to the frontend.
Also, added caching for finding the binary path to reduce
the amount of filesystem interactions.
2020-05-31 05:21:45 +03:00