Commit graph

4641 commits

Author SHA1 Message Date
Florian Diebold
00c74b5d18 Implement inlay hints for emacs 2019-07-27 11:02:34 +02:00
bors[bot]
dc6f0b5a4e Merge #1594
1594: Improve inlay hinting for types r=matklad a=SomeoneToIgnore

Add hints for types in for loop expressions.
Resolve types for every tuple parameter.
Refactor the code.

![image](https://user-images.githubusercontent.com/2690773/61957524-2294ae00-afc8-11e9-8bdc-f86f9c84ab7e.png)


Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2019-07-26 20:16:19 +00:00
Kirill Bulatov
5169a9d498 Improve inlay hinting for types
Add hints for types in for loop expressions.
Resolve types for every tuple parameter.
Refactor the code.
2019-07-26 18:06:31 +03:00
bors[bot]
4647e89def Merge #1586
1586: Add type decorators r=matklad a=SomeoneToIgnore

A follow-up of https://github.com/rust-analyzer/rust-analyzer/pull/1549

Now the frontend shows inlay hints as VS Code Decorators:

<img width="666" alt="image" src="https://user-images.githubusercontent.com/2690773/61802687-918fcc80-ae39-11e9-97b0-3195ab467393.png">
<img width="893" alt="image" src="https://user-images.githubusercontent.com/2690773/61802688-93599000-ae39-11e9-8bcb-4512e22aa3ed.png">

A few notes on the implementation:
* I could not find a normal way to run and display the hints for the file that's already open in the VS Code when it starts.
The updating code runs ok, but does not actually show anything. 
Seems like I miss some event that I could add a handler to.
I've also experimented with `setTimeout` and it worked, but this is too ugly.
The hints appear now when a new file is open or when some change is done in the existing file.

* If there's a `dbg!` used in the lsp_server, the frontend starts receiving change events that contain the string from the `dbg!` output.
It should not be the case in a real life, but I've decided to cover this case, just in case.

* For bigger files, ~500 lines, the decorators start to blink, when updated, this does not seem to be very much of a problem for me at this particular stage of the feature development and can be optimized later. In the worst case, those decorators can be turned off in settings.

* Cursor movement is rather non-intuitive on the right edge of the decorator.
Seems like a thing to fix in the VS Code, not in the plugin.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2019-07-25 17:42:55 +00:00
bors[bot]
ceb16591de Merge #1591
1591: Make Analysis api cancellable r=matklad a=SomeoneToIgnore

Based on the discussion from here: https://github.com/rust-analyzer/rust-analyzer/pull/1549#discussion_r305593236

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2019-07-25 17:32:17 +00:00
Kirill Bulatov
dbbb0beb3e Make Analysis api cancellable 2019-07-25 20:22:41 +03:00
bors[bot]
a8e37ddbc8 Merge #1590
1590: Update crossbeam to pull in new memoffset r=matklad a=kjeremy

Fixes `cargo audit` complaints about memoffset being unsound.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-07-25 16:02:45 +00:00
kjeremy
3e6d60ce8d Update crossbeam to pull in new memoffset 2019-07-25 11:57:49 -04:00
Kirill Bulatov
f1ba963a30 npm run fix 2019-07-25 16:20:02 +03:00
Kirill Bulatov
02f18abc55 Code review fixes 2019-07-25 15:43:35 +03:00
Kirill Bulatov
bd904247ba Remove unnecessary hacks 2019-07-25 15:17:28 +03:00
Kirill Bulatov
583f5c9612 Fix linter issues 2019-07-25 15:17:28 +03:00
Kirill Bulatov
f7b8ae1ee7 Simplify the hints display 2019-07-25 15:17:28 +03:00
Kirill Bulatov
169e69d217 Show type decorators 2019-07-25 15:17:28 +03:00
bors[bot]
1d68e6171e Merge #1589
1589: try to show exact prettier problem r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-25 10:06:00 +00:00
Aleksey Kladov
51568c1467 try to show exact prettier problem 2019-07-25 13:05:34 +03:00
bors[bot]
0651fdc3c8 Merge #1588
1588: ⬆️ npm deps r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-25 09:17:50 +00:00
Aleksey Kladov
38f3b47a00 ⬆️ npm deps 2019-07-25 12:17:27 +03:00
bors[bot]
0194adb651 Merge #1585
1585: move syntax tests to unit tests r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-24 09:51:25 +00:00
Aleksey Kladov
459241f272 move syntax tests to unit tests 2019-07-24 12:49:19 +03:00
Aleksey Kladov
4d544fbf9b switch back to old cleaning strategy
Turns out, Cargo is pretty bad at cleaning after itself: I see .rmeta,
.rlib and .d files after clean :(
2019-07-24 12:35:51 +03:00
bors[bot]
bf3030404e Merge #1584
1584: switch to upstream unescape r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-24 09:03:26 +00:00
Aleksey Kladov
2473cb6a5c switch to upstream unescape 2019-07-24 11:47:28 +03:00
bors[bot]
a971c6d32d Merge #1583
1583: ⬆️ rowan r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-24 08:44:40 +00:00
Aleksey Kladov
c79eea9fc1 ⬆️ rowan 2019-07-24 11:28:53 +03:00
bors[bot]
25921f5a5f Merge #1573
1573: fix: parse box syntax inside parentheses r=matklad a=csmoe

r? @matklad 

Co-authored-by: csmoe <csmoe@msn.com>
2019-07-24 08:27:46 +00:00
bors[bot]
3e086528ef Merge #1582
1582: Show local variable types in completion r=matklad a=viorina



Co-authored-by: Ekaterina Babshukova <ekaterina.babshukova@yandex.ru>
2019-07-23 16:44:15 +00:00
Ekaterina Babshukova
8e49bb664a show local variable types in completion 2019-07-23 19:26:27 +03:00
bors[bot]
5f3ff157e3 Merge #1549
1549: Show type lenses for the resolved let bindings r=matklad a=SomeoneToIgnore

Types that are fully unresolved are not displayed:

<img width="279" alt="image" src="https://user-images.githubusercontent.com/2690773/61518122-8e4ba980-aa11-11e9-9249-6d9f9b202e6a.png">

A few concerns that I have about the current implementation:

* I've adjusted the `file_structure` API method to return the information about the `let` bindings.
Although it works fine, I have a feeling that adding a new API method would be the better way.
But this requires some prior discussion, so I've decided to go for an easy way with an MVP. 
Would be nice to hear your suggestions.

* There's a hardcoded `{undersolved}` check that I was forced to use, since the method that resolves types returns a `String`. 
Is there a better typed API I can use? This will help, for instance, to add an action to the type lenses that will allow us to navigate to the type.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2019-07-23 09:51:40 +00:00
Kirill Bulatov
8f3377d9f9 Code review fixes 2019-07-22 23:25:13 +03:00
bors[bot]
08efe6cf92 Merge #1579
1579: flexi_logger 0.14 r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-07-22 17:25:16 +00:00
kjeremy
ce77291ca4 flexi_logger 0.14 2019-07-22 13:13:55 -04:00
bors[bot]
8522504d51 Merge #1577
1577: smaller debuginfo in release r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-22 17:10:40 +00:00
bors[bot]
0de6ef0684 Merge #1576
1576: don't optimize on CI, it isn't faster r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-22 16:53:23 +00:00
bors[bot]
0db9673260 Merge #1578
1578: ⬆️ deps r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-22 16:31:04 +00:00
Aleksey Kladov
1c764e5478 ⬆️ deps 2019-07-22 18:31:31 +03:00
Aleksey Kladov
40c10932cd smaller debuginfo in release 2019-07-22 18:30:39 +03:00
Aleksey Kladov
660086e5d8 smaller debuginfo in release 2019-07-22 18:25:56 +03:00
Aleksey Kladov
3ea530cf67 don't optimize on CI, it isn't faster 2019-07-22 18:19:57 +03:00
bors[bot]
7d0713e8d2 Merge #1575
1575: Use the same lexer as `rustc` r=matklad a=matklad

This is  !

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-22 14:59:48 +00:00
Aleksey Kladov
700669bbd0 kill old lexer 2019-07-22 17:56:19 +03:00
Aleksey Kladov
75761c0e47 add rustc_lexer 2019-07-22 17:47:33 +03:00
csmoe
8fe58c3598 fix: parse box syntax inside parentheses 2019-07-22 20:52:10 +08:00
Kirill Bulatov
25398ad30d Use SmolStr for the type text 2019-07-22 00:47:44 +03:00
Kirill Bulatov
d32774b464 Fix the string conversions 2019-07-22 00:16:07 +03:00
Kirill Bulatov
31aef808d9 Merge branch 'master' into add-type-lenses 2019-07-22 00:10:29 +03:00
Kirill Bulatov
ba76017d2e Do not show the lens with type hints 2019-07-21 23:48:54 +03:00
Kirill Bulatov
09c7c86696 Resolve types on the server 2019-07-21 23:44:37 +03:00
Kirill Bulatov
24784c60df Code review fixes 2019-07-21 20:51:27 +03:00
Aleksey Kladov
d690249bc8
Remove obsolete keybinding 2019-07-21 19:08:05 +03:00