Commit graph

923 commits

Author SHA1 Message Date
Jeremy Kolb 5b9257561f Pass CodeActionKind through our middleware to populate menus 2020-07-02 17:13:03 -04:00
bors[bot] 1a3a7f4237
Merge #5188
5188: Implement StatusBar r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-02 14:02:52 +00:00
Aleksey Kladov 3ef7676076 Implement StatusBar 2020-07-02 15:32:14 +02:00
bors[bot] 57ed622ec4
Merge #5089 #5161 #5184 #5185 #5186
5089: Disable auto-complete on comments r=matklad a=BGluth

Resolves #4907 by disabling any auto-completion on comments.

As flodiebold [pointed out](https://github.com/rust-analyzer/rust-analyzer/issues/4907#issuecomment-648439979), in the future we may want to support some form of auto-completion within doc comments, but for now it was suggested to just disable auto-completion on them entirely.

The implementation involves adding a new field `is_comment` to `CompletionContext` and checking if the immediate token we auto-completed on is a comment. I couldn't see a case where we need to check any of the ancestors, but let me know if this is not sufficient. I also wasn't sure if it was necessary to add a new field to this struct, but I decided it's probably the best option if we want to potentially do auto-completion on doc comments in the future.

Finally, the three tests I added should I think ideally not filter results by `CompletionKind::Keyword`, but if I want to get unfiltered results, I need access to a non-public function [get_all_completion_items](9a4d02faf9/crates/ra_ide/src/completion/test_utils.rs (L32-L39)) which I don't know if I should make public just for this.



5161: SSR: Add initial support for placeholder constraints r=matklad a=davidlattimore



5184: Always install required nightly extension if current one is not nightly r=matklad a=Veetaha

This is weird, but having switched back to stable by uninstalling the extension appears that vscode doesn't destroy the `PersistentState` and thus changing to `nightly` channel doesn't work because the last check for nightly extension was less than 1 hour ago. The simple solution is to skip this check if we know that the current extension version is not nightly.

5185: Force showing extension activation error pop-up notification r=matklad a=Veetaha

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

5186: fix: correct pd/ppd/tfn/tmod completion doc r=matklad a=fannheyward

a33eefa3b2/crates/ra_ide/src/completion/complete_snippet.rs (L23-L24)

Co-authored-by: BGluth <gluthb@gmail.com>
Co-authored-by: David Lattimore <dml@google.com>
Co-authored-by: Veetaha <veetaha2@gmail.com>
Co-authored-by: Heyward Fann <fannheyward@gmail.com>
2020-07-02 09:12:46 +00:00
Veetaha 6a6ce616aa Force showing extension activation error pop-up notification 2020-07-02 05:19:02 +03:00
Veetaha 69b6f6def5 Always install required nightly extension if current one is not nightly 2020-07-02 05:05:29 +03:00
Aleksey Kladov c9f878962a Add reload workspace command 2020-07-01 14:57:59 +02:00
bors[bot] d34fd372bb
Merge #5098
5098: Bump npm deps r=Veetaha a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-07-01 08:18:57 +00:00
Laurențiu Nicola 538980b10e Be more strict with @types/node
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-07-01 08:01:17 +03:00
Matthijs Brobbel f640d2a09c
Fix a typo 2020-06-30 17:42:54 +02:00
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
Laurențiu Nicola f4211977cf Use newer @types/node 2020-06-29 19:05:48 +03: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
Laurențiu Nicola 5d783a2579 Downgrade @types/node 2020-06-28 09:35:51 +03:00
Laurențiu Nicola 9ef4e85f17 Bump @rollup/plugin-commonjs 2020-06-27 22:37:03 +03:00
Laurențiu Nicola 30a246bb99 Bump some npm deps 2020-06-27 20:41:22 +03: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