Commit graph

10496 commits

Author SHA1 Message Date
bors[bot]
3a7c218fd4
Merge #4576
4576: Add implementation of extract struct from enum variant r=matklad a=mcrakhman

Hi guys! I implemented the extraction functionality including modifying multiple files. The only thing I didn't change the cursor position. I've done it with a previous API, but now snippets have been introduced and I need to figure out how to do it.

Please bear in mind that I am a newcomer in the rust-analyzer (and also Rust) world, so I tried to implement the feature to the best of my knowledge, but the API is very new to me, so I am very welcome to introducing changes etc. 

Co-authored-by: Mikhail Rakhmanov <rakhmanov.m@gmail.com>
2020-06-08 16:28:48 +00:00
bors[bot]
38ac331f7d
Merge #4784
4784: Change management of test cfg to better support json projects r=Nashenas88 a=Nashenas88

This helps support json projects where they can decide whether to add the `test` cfg or not. One alternative is to add support for marking json project crates as a sysroot crate, and adding logic to remove the `test` cfg in those cases. In my opinion, that option gives less flexibility to json projects and leads to more functionality that needs to be maintained.

Fixes #4508 
cc @woody77 

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
Co-authored-by: Paul Daniel Faria <nashenas88@users.noreply.github.com>
2020-06-08 16:20:45 +00:00
Paul Daniel Faria
dbceaf522b Use Option<&str> for target instead of Option<&String> 2020-06-08 12:10:23 -04:00
Paul Daniel Faria
9c35f135b9 Remove default_cfg_options, pass target instead so it can be used for building cargo workspaces 2020-06-08 10:23:29 -04:00
bors[bot]
5ed9818a7c
Merge #4796
4796: Fix unsafe highlihgintngs r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-08 13:23:38 +00:00
Aleksey Kladov
3b4d000250 Better unsafe highlihgting tests 2020-06-08 15:23:03 +02:00
Aleksey Kladov
c476f71bdf Highlight only the unsafe operator itself 2020-06-08 15:03:14 +02:00
bors[bot]
83fd0fb355
Merge #4775
4775: Add goto def for enum variant field r=matklad a=unexge

Closes #4764. I'm not familiar with ra codebase, there might be better ways to do that 😄 

Co-authored-by: unexge <unexge@gmail.com>
2020-06-08 12:46:12 +00:00
unexge
48b6dd0b33 Use explicit match for extracting def from classify_name 2020-06-08 15:38:10 +03:00
unexge
4edf736eb2 Swap into_definition and definition semantics for FieldShorthand variant 2020-06-08 15:37:12 +03:00
bors[bot]
db36a25839
Merge #4683
4683: Implement syntax highlighting for doctests r=ltentrup a=ltentrup

The implementation is more complicated than the previous injection logic as the doctest comments consist of multiple ranges. The implementation extracts the doctests together with an offset-mapping, applies the syntax highlighting, and updates the text ranges.

<img width="478" alt="Bildschirmfoto 2020-06-01 um 15 45 25" src="https://user-images.githubusercontent.com/201808/83415249-1f0b5800-a41f-11ea-8fa6-c282434d6ff7.png">

Part of #4170.

Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
2020-06-08 12:26:33 +00:00
Leander Tentrup
4a2efb2f42 Implement syntax highlighting for doctests 2020-06-08 14:18:16 +02:00
bors[bot]
ab86f15ff2
Merge #4794
4794: Tweak release r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-08 12:05:44 +00:00
Aleksey Kladov
cbc5eb8738 Refactor 2020-06-08 14:05:14 +02:00
Aleksey Kladov
97ea2dfc4b Move to a dedicated file 2020-06-08 13:58:54 +02:00
unexge
c5d5d21858 Add FieldShorthand variant to NameClass 2020-06-08 14:46:58 +03: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
bors[bot]
a5f427ced3
Merge #4793
4793: Don't @ people in commit messages r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-08 11:20:01 +00:00
vsrs
b7db9f058a Apply suggestions from code review 2020-06-08 14:19:40 +03:00
Aleksey Kladov
4968321706 Don't @ people in commit messages 2020-06-08 13:19:32 +02:00
bors[bot]
3623c1663f
Merge #4792
4792: Document more knowledge r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-08 10:55:29 +00:00
Aleksey Kladov
cc07c82fef Preconditions style 2020-06-08 12:54:48 +02:00
Aleksey Kladov
ee8dec5dc1 IDE API 2020-06-08 12:52:28 +02:00
bors[bot]
d8552d114c
Merge #4781
4781: Remove redundancy in syntax highlighting tests r=matklad a=ltentrup

Follow up from #4683. Improves syntax highlighting testing by introducing a function that contains the boilerplate comparison code. Keeps the `ra_fixture` argument in the first position, thus, the editor syntax highlighting injection still works.

Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
2020-06-08 09:48:38 +00:00
bors[bot]
bb0d4600ff
Merge #4770
4770: Clean up handling of int/float literal types r=matklad a=flodiebold

'Unknown' int/float types actually never exist as such, they get replaced by type variables immediately. So the whole `Uncertain<IntTy>` thing was unnecessary and just led to a bunch of match branches that were never hit.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-06-08 09:37:37 +00:00
bors[bot]
b366b98a9e
Merge #4787
4787: Fix bug in lexer for format specifier r=matklad a=ltentrup

The `type` and `width` were not correctly distinguished.
Fixes #4696.

Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
2020-06-08 09:05:09 +00:00
bors[bot]
d6967762dd
Merge #4788
4788: Update quote r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-06-07 22:24:40 +00:00
Jeremy Kolb
0d01be7e18 Update quote 2020-06-07 18:21:38 -04:00
bors[bot]
c59ffac4c8
Merge #4780
4780: Fix VSCode settings r=SomeoneToIgnore a=vincentisambart

closes #4779

#4779 was reproducing every time, so doing a bisect I found out the problem to be coming from #4730.
The only change to the extension that #4730 included was changes to editors/code/package.json.
So I tried modifying those changes a bit and got it working.

Co-authored-by: Vincent Isambart <vincent.isambart@gmail.com>
2020-06-07 21:27:37 +00:00
Leander Tentrup
3aaaf924cb Fix bug in lexer for format specifier where the type and width were not correctly distinguished 2020-06-07 22:57:24 +02:00
Paul Daniel Faria
3937b225e7 Change management of test cfg to better support json projects 2020-06-07 10:29:03 -04:00
Leander Tentrup
65943c0585 Remove redundancy in syntax highlighting tests 2020-06-07 14:50:02 +02:00
Vincent Isambart
3162b9ed8f Fix VSCode settings 2020-06-07 12:07:00 +09:00
unexge
73684a4ae2 Add goto def for enum variant field 2020-06-06 22:16:59 +03:00
vsrs
9b4256dc4d Add lib target filtering. 2020-06-06 22:11:17 +03:00
bors[bot]
dc340f12a3
Merge #4772
4772: Document certain invariants r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-06 17:55:13 +00:00
Aleksey Kladov
81ffe973ac Document certain invariants 2020-06-06 19:54:41 +02:00
Aleksey Kladov
ae1acbd09c Document import style 2020-06-06 19:32:45 +02:00
vsrs
46084f8a96 Disable runnables lookup in macro-generated code. 2020-06-06 20:10:36 +03:00
Florian Diebold
d66daee849 Clean up handling of int/float literal types
'Unknown' int/float types actually never exist as such, they get replaced by
type variables immediately. So the whole `Uncertain<IntTy>` thing was
unnecessary and just led to a bunch of match branches that were never hit.
2020-06-06 17:52:00 +02:00
vsrs
3434f1dd2c Add Run|Debug hover actions 2020-06-06 18:17:52 +03:00
vsrs
de74c0dcab Preliminary runnables refactoring 2020-06-06 18:17:52 +03:00
bors[bot]
d4a92b4fef
Merge #4769
4769: Fix Run lens. r=matklad a=vsrs

This PR fixes a bug introduced in https://github.com/rust-analyzer/rust-analyzer/pull/4710: second and all subsequent clicks on the Run lens produce invalid commands:

1. `cargo test --package ra_ide --lib -- hover::tests::test_hover_enum_has_impl_action --exact --nocapture`
2. `cargo test --package ra_ide --lib -- hover::tests::test_hover_enum_has_impl_action --exact --nocapture` **`-- hover::tests::test_hover_enum_has_impl_action --exact --nocapture`**
3. `cargo test --package ra_ide --lib -- hover::tests::test_hover_enum_has_impl_action --exact --nocapture` **`-- hover::tests::test_hover_enum_has_impl_action --exact --nocapture -- hover::tests::test_hover_enum_has_impl_action --exact --nocapture`**

Co-authored-by: vsrs <vit@conrlab.com>
2020-06-06 15:05:59 +00:00
vsrs
b91fa7494e Fix Run lens. 2020-06-06 15:12:17 +03:00
bors[bot]
a609336d72
Merge #4765
4765: Fix type parameter defaults r=matklad a=flodiebold

They should not be applied in expression or pattern contexts, unless there are other explicitly given type args.

(The existing tests about this were actually wrong.)

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-06-06 10:56:59 +00:00
Florian Diebold
a4a4a1854e Fix type parameter defaults
They should not be applied in expression or pattern contexts, unless there are
other explicitly given type args.
2020-06-05 20:09:13 +02:00
bors[bot]
02f7b5d7ab
Merge #4761
4761: Upgrade Chalk to published version r=matklad a=flodiebold

CC @pksunkara 

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-06-05 16:05:06 +00:00
bors[bot]
2a3ab7f3b4
Merge #4689
4689: Implement return position impl trait / opaque type support r=matklad a=flodiebold

This is working, but I'm not that happy with how the lowering works. We might need an additional representation between `TypeRef` and `Ty` where names are resolved and `impl Trait` bounds are separated out, but things like inference variables don't exist and `impl Trait` is always represented the same way.

Also note that this doesn't implement correct handling of RPIT *inside* the function (which involves turning the `impl Trait`s into variables and creating obligations for them). That intermediate representation might help there as well.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-06-05 15:46:28 +00:00
Florian Diebold
0d2328f3ea Review fixes 2020-06-05 17:41:58 +02:00
bors[bot]
f133159ec0
Merge #4760
4760: Minimize FileLoader interface r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-05 15:23:22 +00:00