Commit graph

6435 commits

Author SHA1 Message Date
Florian Diebold
fe7bf993aa Implement better handling of divergence
Divergence here means that for some reason, the end of a block will not be
reached. We tried to model this just using the never type, but that doesn't work
fully (e.g. in `let x = { loop {}; "foo" };` x should still have type `&str`);
so this introduces a `diverges` flag that the type checker keeps track of, like
rustc does.
2020-05-08 18:15:24 +02:00
Timo Freiberg
64e6b8200b Use new HirDisplay variant in add_function assist 2020-05-08 17:14:45 +02:00
Timo Freiberg
fe93675e8a New HirDisplay method for displaying sourcecode 2020-05-08 17:12:18 +02:00
Florian Diebold
f5177f91ae Fix type of byte literals
They're `&[u8; N]`, not `&[u8]` (see #4374).
2020-05-08 15:18:33 +02:00
Aleksey Kladov
ecff5dc141 Cleanup 2020-05-08 14:55:28 +02:00
Aleksey Kladov
7c0409e0c7 Cleanup 2020-05-08 12:34:39 +02:00
Aleksey Kladov
6713be0b13 Rename ra_env -> ra_toolchain 2020-05-08 12:25:36 +02:00
bors[bot]
8295a9340c
Merge #4329
4329: Look for `cargo`, `rustc`, and `rustup` in standard installation path r=matklad a=cdisselkoen

Discussed in #3118.  This is approximately a 90% fix for the issue described there.

This PR creates a new crate `ra_env` with a function `get_path_for_executable()`; see docs there.  `get_path_for_executable()` improves and generalizes the function `cargo_binary()` which was previously duplicated in the `ra_project_model` and `ra_flycheck` crates.  (Both of those crates now depend on the new `ra_env` crate.)  The new function checks (e.g.) `$CARGO` and `$PATH`, but also falls back on `~/.cargo/bin` manually before erroring out.  This should allow most users to not have to worry about setting the `$CARGO` or `$PATH` variables for VSCode, which can be difficult e.g. on macOS as discussed in #3118.

I've attempted to replace all calls to `cargo`, `rustc`, and `rustup` in rust-analyzer with appropriate invocations of `get_path_for_executable()`; I don't think I've missed any in Rust code, but there is at least one invocation in TypeScript code which I haven't fixed.  (I'm not sure whether it's affected by the same problem or not.) a4778ddb7a/editors/code/src/cargo.ts (L79)

I'm sure this PR could be improved a bunch, so I'm happy to take feedback/suggestions on how to solve this problem better, or just bikeshedding variable/function/crate names etc.

cc @Veetaha 

Fixes #3118.

Co-authored-by: Craig Disselkoen <craigdissel@gmail.com>
Co-authored-by: veetaha <veetaha2@gmail.com>
2020-05-08 10:11:19 +00:00
Aleksey Kladov
d3110859ba Move feature desugaring to the right abstraction layer 2020-05-08 02:56:53 +02:00
Craig Disselkoen
3077eae2a6 use home crate instead of dirs 2020-05-07 12:06:44 -07:00
bors[bot]
1b136aae0b
Merge #4296
4296: Support cargo:rustc-cfg in build.rs r=matklad a=robojumper

Fixes #4238.

Co-authored-by: robojumper <robojumper@gmail.com>
2020-05-07 18:50:00 +00:00
bors[bot]
97b9b364d6
Merge #4362
4362: do not show runnables for main function outside of a binary target  r=matklad a=bnjjj

close #4356

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-07 17:30:13 +00:00
bors[bot]
fd84c31ff7
Merge #4346
4346: Fix rename of enum variant visible from module r=matklad a=montekki

Probably fixes #4237 

It looks like the ref is found correctly in this case but it's visibility is not correctly determined. I took a stab at fixing that by adding an implementation of `HasVisibility` for `EnumVariant` so it works more or less the same way it does for struct fields.

In other words, the `search_range` here does not contain the ref since it's not considered visible:

efd8e34c39/crates/ra_ide_db/src/search.rs (L209-L214)


Before that I tried to populate `ItemScope` with visible enum variants but that ended up with breaking tests all over the place and also it looked illogical in the end: `ItemScope` is not populated with, say, public struct fields and the same should be true for `enum` variants.

I've added two more or less identical tests: one for the case with a struct field rename and one for enum variant rename; the test for struct should probably be removed and the names should be changed.


Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
2020-05-07 16:29:01 +00:00
Aleksey Kladov
1e790ea314 Simplify 2020-05-07 17:32:01 +02:00
Aleksey Kladov
28fcff125a Nicer API 2020-05-07 17:29:23 +02:00
Aleksey Kladov
c6b81bc013 Rename AssitLabel -> Assist 2020-05-07 17:18:28 +02:00
Benjamin Coenen
c839d4f7a9 do not show runnables for main function outside of a binary target #4356
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-07 16:52:14 +02:00
Aleksey Kladov
4867968d22 Refactor assists API to be more convenient for adding new assists
It now duplicates completion API in its shape.
2020-05-07 16:27:54 +02:00
Fedor Sakharov
210f0cbd27
Remove HasVisibility implementation 2020-05-07 16:31:51 +03:00
Aleksey Kladov
43cedecf68 Fix panic in FunctionSignature 2020-05-07 14:29:01 +02:00
Benjamin Coenen
6203e9c4fa add if let and while let postfix for Option and Result #4348
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-07 11:23:38 +02:00
Craig Disselkoen
227929f9dd simplify by using bail! macro 2020-05-06 13:29:22 -07:00
Craig Disselkoen
5d4648884b cargo fmt 2020-05-06 12:47:13 -07:00
Craig Disselkoen
44b01ccff3 return a PathBuf instead of String 2020-05-06 12:39:11 -07:00
bors[bot]
1a0988b899
Merge #4316 #4351
4316: do not truncate display for hover r=matklad a=bnjjj

close #4311 

4351: Fix Windows server path r=matklad a=lnicola

CC @Coder-256.

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-05-06 16:54:31 +00:00
bors[bot]
b832dfc917
Merge #4331
4331: Fixture improvements r=TimoFreiberg a=TimoFreiberg

As mentioned in [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/resolve_path.20between.20fixture.20files) :)

I think always allowing unindented first lines is friendlier than making the user fix it and I don't see any drawbacks.

Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-05-06 16:18:17 +00:00
Timo Freiberg
86fa80e5b3 Allow fixture strings with unindented first line
This allows fixtures like
        "//- /lib.rs
         ...
         //- /foo.rs
         ...
"
2020-05-06 18:09:28 +02:00
Timo Freiberg
8a5d14453e Add fixture doc comment 2020-05-06 18:09:28 +02:00
Benjamin Coenen
51c02ab84f add Ok wrapping
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-06 17:45:55 +02:00
bors[bot]
e99447ffbf
Merge #4347
4347: Fix usefulness check for never type r=flodiebold a=MikailBag



Co-authored-by: Mikail Bagishov <bagishov.mikail@yandex.ru>
2020-05-06 15:11:26 +00:00
Mikail Bagishov
7c94fa7d01
Fix usefulness check for never type 2020-05-06 17:59:27 +03:00
Aleksey Kladov
020ca6695f Simplify 2020-05-06 16:39:11 +02:00
Fedor Sakharov
bd9f1f7eb7
Fix rename of enum variant visible from module 2020-05-06 17:35:22 +03:00
Aleksey Kladov
4d50709a96 Minor 2020-05-06 16:10:35 +02:00
Aleksey Kladov
0970c3454b Rename 2020-05-06 16:10:35 +02:00
Aleksey Kladov
fdd4df97ba Use SourceChange for assists 2020-05-06 15:43:47 +02:00
Aleksey Kladov
1116c9a0e9 Fix TODO 2020-05-06 13:21:49 +02:00
Aleksey Kladov
233f01c9ba Move target to AssistLabel
Target is used for assists sorting, so we need it before we compute
the action.
2020-05-06 12:51:28 +02:00
Benjamin Coenen
1ec953f117 do not truncate display for hover
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-06 11:33:43 +02:00
Aleksey Kladov
3850b1c086 Lift SourceChange to the ra_ide_db 2020-05-06 11:32:34 +02:00
Aleksey Kladov
beb35c3ecb Fix capitalization 2020-05-06 11:19:43 +02:00
Benjamin Coenen
550c629498 do not truncate display for hover
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-06 11:08:50 +02:00
Aleksey Kladov
eea431180e Regenerate 2020-05-06 10:21:35 +02:00
Aleksey Kladov
d308ff910b Merge doc_tests and tests 2020-05-06 10:18:12 +02:00
Aleksey Kladov
25e6bbde01 Merge assits::test_helpers and tests 2020-05-06 10:16:55 +02:00
Benjamin Coenen
c4d128e454 Merge branch 'master' of github.com:rust-analyzer/rust-analyzer into fix_4311 2020-05-06 09:57:00 +02:00
Craig Disselkoen
1b76b4281e simplify some code using early returns 2020-05-05 16:12:56 -07:00
Craig Disselkoen
3e603a8fdd add module-level docs so that tests pass 2020-05-05 16:12:56 -07:00
Craig Disselkoen
7e60264ba0 cargo fmt 2020-05-05 16:12:56 -07:00
Craig Disselkoen
303b444dbb pull function out into new crate ra_env; use in ra_flycheck as well 2020-05-05 16:12:56 -07:00
Craig Disselkoen
5aa1bba107 more generic, find rustc as well 2020-05-05 16:12:56 -07:00
Craig Disselkoen
ffaef1b7ae ra_project_model: look for Cargo in more places
See #3118
2020-05-05 16:12:56 -07:00
bors[bot]
30eb458b4f
Merge #4332
4332: Refactor TextEdit r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-05 21:50:47 +00:00
Aleksey Kladov
ca9e0f5fe9 Fixup tests 2020-05-05 23:48:26 +02:00
Aleksey Kladov
27c7ef6d65 Use more natural signature for Edit::apply 2020-05-05 23:23:29 +02:00
Aleksey Kladov
4a6fa8f0df Rename AtomTextEdit -> Indel 2020-05-05 23:15:49 +02:00
guigui64
c22660179c
add the allFeatures flag (true by default) 2020-05-05 22:46:42 +02:00
Aleksey Kladov
381cbc6088 Minor cleanups 2020-05-05 22:14:01 +02:00
bors[bot]
d38741f681
Merge #4327
4327: Refactor assists r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-05 19:36:53 +00:00
Aleksey Kladov
3908fad1fe Normalize naming of diagnostics 2020-05-05 21:35:30 +02:00
Aleksey Kladov
df00da15c4 Fix compilation 2020-05-05 20:45:44 +02:00
Aleksey Kladov
aee22c73c3 Move group_label where it belongs 2020-05-05 20:42:52 +02:00
Aleksey Kladov
6c2414430a use GroupLabel for type safety 2020-05-05 20:34:45 +02:00
Aleksey Kladov
d5b9282ede Minor rename 2020-05-05 20:33:10 +02:00
Aleksey Kladov
13c078db9c Flip Assist::new arguments 2020-05-05 20:30:33 +02:00
bors[bot]
a4778ddb7a
Merge #4325
4325: Fix column conversion for supplementary plane characters r=matklad a=lnicola

Fixes https://github.com/rust-analyzer/rust-analyzer/pull/4276#issuecomment-623079855.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-05-05 18:10:39 +00:00
Laurențiu Nicola
1d794e8590 Fix column conversion for supplementary plane characters 2020-05-05 20:30:52 +03:00
bors[bot]
8803e748a6
Merge #4166
4166: Defining a default target to support cross-compilation targets  r=matklad a=FuriouZz

Related to #4163 

Co-authored-by: Christophe MASSOLIN <christophe.massolin@gmail.com>
2020-05-05 17:25:52 +00:00
bors[bot]
df7b59081f
Merge #4323
4323: Add tests for #4306 r=kjeremy a=lnicola

CC @kjeremy 

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-05-05 17:01:46 +00:00
Laurențiu Nicola
7ec1b63f81 Add tests for #4306 2020-05-05 19:39:45 +03:00
Christophe MASSOLIN
04e32fbffc Remove code duplicates 2020-05-05 18:23:47 +02:00
bors[bot]
f0411ff9e0
Merge #4320
4320: add doctest support r=matklad a=bnjjj

close #4317

preview:

<img width="253" alt="Capture d’écran 2020-05-05 à 17 39 58" src="https://user-images.githubusercontent.com/5719034/81086040-45110b80-8ef8-11ea-9c05-79c6fe400fc3.png">


Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-05 16:22:31 +00:00
Christophe MASSOLIN
14dde99627 Pass cargo.target to rustc 2020-05-05 18:15:13 +02:00
Christophe MASSOLIN
0ab4340cdb Rename defaultTarget to target 2020-05-05 18:01:54 +02:00
Edwin Cheng
92665358cd Rename ImplItem to AssocItem 2020-05-05 23:56:10 +08:00
Benjamin Coenen
fe52f8f028 add doctest support #4317
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-05 17:44:27 +02:00
bors[bot]
756e91732b
Merge #4305
4305: Favor types for record type struct in name resolution r=matklad a=edwin0cheng

Fixed #4235

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-05-05 15:06:41 +00:00
Edwin Cheng
07de8ea165 invert if 2020-05-05 23:01:07 +08:00
bors[bot]
f68e099777
Merge #4265
4265: Make `change_visibility` assist work for tuple struct fields r=matklad a=Jesse-Bakker

Fixes #4206 

Co-authored-by: Jesse Bakker <git@jessebakker.com>
2020-05-05 14:42:33 +00:00
robojumper
f2dd233ddc Assume cargo_metadata uses String for cfgs soon 2020-05-05 14:53:52 +02:00
robojumper
059fc86963 Merge heavy tests 2020-05-05 14:53:18 +02:00
Benjamin Coenen
0bf02f5cca do not truncate display for hover #4311
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-05 14:29:25 +02:00
bors[bot]
d1c1c01309
Merge #4306 #4308
4306: Make incremental sync opt-out and fix line index rebuild r=matklad a=lnicola



4308: Update server binary paths in docs r=matklad a=Coder-256

Fixed incorrect macOS path and converted to a list. Also, should the Windows path include `matklad.rust-analyzer`? (I can't check)

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Jacob Greenfield <jacob@jacobgreenfield.me>
2020-05-05 10:02:56 +00:00
Benjamin Coenen
831bb1cf91 refactor: use attrsOwner directly in is_cfg_enabled
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-05 09:34:07 +02:00
Edwin Cheng
cf821cc332 Change union resolve types only 2020-05-05 01:19:54 +08:00
Edwin Cheng
e921195d93 Change favor_types to has_constructor 2020-05-05 01:15:27 +08:00
Laurențiu Nicola
7c1d5f286a Fix line index rebuild during incremental changes 2020-05-04 20:04:30 +03:00
Laurențiu Nicola
191abf3685 Make incremental sync opt-out 2020-05-04 19:54:39 +03:00
Edwin Cheng
5ae18f4f81 Remove unused import 2020-05-05 00:34:54 +08:00
Edwin Cheng
204c8de3bf Add test for issue 2020-05-05 00:29:47 +08:00
Edwin Cheng
af001677d1 Fix test 2020-05-05 00:17:30 +08:00
Edwin Cheng
8d96db3417 Favor types for Record in name resolution 2020-05-05 00:17:22 +08:00
Aleksey Kladov
b211c5814e Remove false positive attr compleitons 2020-05-04 16:48:50 +02:00
Aleksey Kladov
8f4478390e Qualify ast types 2020-05-04 15:33:08 +02:00
Aleksey Kladov
e9643ab74c Cleanup imports 2020-05-04 15:33:08 +02:00
Aleksey Kladov
71f6d58e31 Remove unnecessary condition
No tests fail, and quick manual testing shows that there are no
false-positives. In general, each completion contributor should be
independent from the others.
2020-05-04 15:32:23 +02:00
Aleksey Kladov
d7450222a9 Simplify 2020-05-04 14:55:24 +02:00
bors[bot]
580c5a969d
Merge #4297
4297: refactor: use parent instead ancestors for use alias r=matklad a=bnjjj

Linked to this comment https://github.com/rust-analyzer/rust-analyzer/pull/4269/files#r419343670

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-04 12:37:41 +00:00
Aleksey Kladov
802617ccc2 Simplify 2020-05-04 14:16:10 +02:00
Benjamin Coenen
e88c3e4fcd refactor: use parent instead ancestors for use alias
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-04 13:42:30 +02:00
robojumper
2980ba1fde Support build.rs cargo:rustc-cfg 2020-05-04 13:29:09 +02:00
bors[bot]
57f285d0eb
Merge #4283
4283: Support macro for trait items r=matklad a=edwin0cheng

Fixed  #4039

r? @flodiebold 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
Co-authored-by: Edwin Cheng <edwin@m-inverse.com>
2020-05-04 10:49:24 +00:00
Edwin Cheng
5899c8eaa9 Fixes names for collect_item funtions 2020-05-04 18:34:32 +08:00
bors[bot]
b1a5dc8c8b
Merge #4269 #4293
4269: add support of use alias semantic in definition r=matklad a=bnjjj

close #4202 

4293: no doctests for flycheck r=matklad a=matklad



bors r+
🤖

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-04 10:34:06 +00:00
Aleksey Kladov
6af464d185 no doctests for flycheck 2020-05-04 12:26:52 +02:00
Aleksey Kladov
710e430dbb Fix focus range for TypeParam
closes #4274
2020-05-04 12:25:32 +02:00
Aleksey Kladov
13bce1a164 Add test marks 2020-05-04 12:10:26 +02:00
bors[bot]
3b1d983085
Merge #4282
4282: More name hints omitting heuristics r=matklad a=SomeoneToIgnore

Omit parameter name hints for cases like the first two parameters from the screenshot:

<img width="394" alt="Screenshot 2020-05-03 at 15 06 34" src="https://user-images.githubusercontent.com/2690773/80914717-165b2f80-8d56-11ea-8675-040972f70d98.png">


Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-05-04 08:36:48 +00:00
Kirill Bulatov
30817de3af Code review fixes
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-05-04 11:04:02 +03:00
bors[bot]
d855280818
Merge #4285
4285: add support of cfg attributes on enum variants r=edwin0cheng a=bnjjj

close #4279

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-04 03:18:48 +00:00
bors[bot]
57ec813294
Merge #4286
4286: Make incremental sync opt-in r=matklad a=lnicola

@matklad do you want to merge this? I'd make it opt-out, but it's fine to test it more.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-05-04 03:03:52 +00:00
bors[bot]
6a48a94d47
Merge #4268
4268: Support auto-import in macro r=SomeoneToIgnore a=edwin0cheng

Fixed: #3854

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-05-03 22:52:10 +00:00
Kirill Bulatov
66882f1a24 Move snake case method to heck 2020-05-03 21:35:21 +03:00
Laurențiu Nicola
87a18b18ea Make incremental sync opt-in 2020-05-03 20:58:07 +03:00
Benjamin Coenen
bed115d6e1 add support of cfg attributes on enum variants #4279
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-03 17:56:45 +02:00
Edwin Cheng
73ed2f2e90 Remove whitespaces 2020-05-03 22:15:07 +08:00
Edwin Cheng
8b6216df05 Support macro for trait items 2020-05-03 22:08:39 +08:00
Kirill Bulatov
ba8ffab644 Omit name hints for enum names similar to parameter names 2020-05-03 15:55:08 +03:00
Kirill Bulatov
8eb820f460 Omit name hints for method names similar to parameter names 2020-05-03 15:55:08 +03:00
bors[bot]
baa35b02b2
Merge #4280
4280: Add documents owner for ImplDef and SourceFile r=matklad a=edwin0cheng

When working on #3182, I found that `ImplDef` and `SourceFile` do not implemet `DocCommentsOwer` trait, and I tested it in `cargo doc` that `impl` could has some doc-comments.

I am not so sure about `SourceFile` case, but in theory if that file is a crate root, the doc comment of it should represent the whole crate documentation, right ?

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-05-03 10:46:07 +00:00
Edwin Cheng
f90fbaf6a6 Add documents owner for ImplDef and SourceFile 2020-05-03 18:00:27 +08:00
bors[bot]
76c2f4ef49
Merge #4278
4278: Log panics in apply_document_changes r=matklad a=lnicola

This doesn't necessarily help (because of https://github.com/rust-analyzer/rust-analyzer/issues/4263#issuecomment-623078531), but maybe we could leave it in there for a while in case it catches something.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-05-03 09:48:44 +00:00
Laurențiu Nicola
074d1ac2f7 Log panics in apply_document_changes 2020-05-03 12:46:20 +03:00
bors[bot]
682c079043
Merge #4276
4276: Don't count start of non-ASCII characters as being inside of them r=matklad a=lnicola

I'm still not sure that `utf16_to_utf8_col` is correct for code points from Supplementary Planes. These have two UTF-16 code units, and I feel we're not going to count them correctly.

Fixes the crash in https://github.com/rust-analyzer/rust-analyzer/issues/4263#issuecomment-622988258.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-05-03 08:57:02 +00:00
Laurențiu Nicola
16d3bb9106 Don't count start of non-ASCII characters as being inside of them 2020-05-03 09:54:39 +03:00
Kirill Bulatov
2fd054f276 Fix derive argument parsing 2020-05-02 23:47:51 +03:00
Benjamin Coenen
99c2ca8494 add support of use alias semantic in definition #4202
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-02 21:42:27 +02:00
Kirill Bulatov
9f0ed7ed92 Separate macros completion from other 2020-05-02 22:33:23 +03:00
Edwin Cheng
2034002413 Support auto-import in macro 2020-05-03 03:24:55 +08:00
Kirill Bulatov
fee74851b0 Propose custom derives in completion 2020-05-02 22:24:27 +03:00
Kirill Bulatov
767bff89ed Complete standard derives 2020-05-02 21:41:02 +03:00
Kirill Bulatov
c4b32d1534 Fix the extension method 2020-05-02 21:41:02 +03:00
Benjamin Coenen
4613497a77 Merge branch 'master' of github.com:rust-analyzer/rust-analyzer into fix_4202 2020-05-02 20:27:02 +02:00
Jesse Bakker
b5c330bf5a Make change_visibility assist work for tuple struct field visibility 2020-05-02 18:25:38 +02:00
bors[bot]
89e1f97515
Merge #4207 #4253
4207: Add unwrap block assist #4156 r=matklad a=bnjjj

close issue #4156 

4253: Remove `workspaceLoaded` setting r=matklad a=eminence

The `workspaceLoaded` notification setting was originally designed to
control the display of a popup message that said:

    "workspace loaded, {} rust packages"

This popup was removed and replaced by a much sleeker message in the
VSCode status bar that provides a real-time status while loading:

    rust-analyzer: {}/{} packages

This was done as part of #3587

The change in this PR simply renames this setting from `workspaceLoaded` to
`progress` to better describe what it actually controls.  At the moment,
the only type of progress message that is controlled by this setting is
the initial load messages, but in theory other messages could also be
controlled by this setting.


Reviewer notes:

* If we didn't like the idea of causing minor breaking to user's config, we could keep the setting name as `workspaceLoaded`
* I think we can now close both #2719 and #3176 since the notification dialog in question no longer exists (actually I think you can close those issues even if you reject this PR 😄 )

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Andrew Chin <achin@eminence32.net>
2020-05-02 12:44:55 +00:00
Aleksey Kladov
359d3be308 Fix parsing of blocks without { 2020-05-02 14:35:17 +02:00
Benjamin Coenen
fdf86637bf Merge branch 'master' of github.com:rust-analyzer/rust-analyzer 2020-05-02 13:39:05 +02:00
Benjamin Coenen
6d5f3922f7 Add unwrap block assist #4156
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-02 12:31:11 +02:00
bors[bot]
fb8fb65131
Merge #4234
4234: Support local_inner_macros r=jonas-schievink a=edwin0cheng

This PR implements `#[macro_export(local_inner_macros)]` support. 

Note that the rustc implementation is quite [hacky][1] too. :)

[1]: 614f273e93/src/librustc_resolve/macros.rs (L456)

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-05-02 10:30:49 +00:00
Benjamin Coenen
0b40876b99 Merge branch 'master' of github.com:rust-analyzer/rust-analyzer 2020-05-02 12:25:04 +02:00
Benjamin Coenen
eea21738ab Add unwrap block assist #4156
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-02 12:20:39 +02:00
bors[bot]
75bc024946
Merge #4257
4257: ast::EffectExpr r=matklad a=matklad

closes #4230 

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-02 09:57:45 +00:00
Aleksey Kladov
b73dbbfbf2 Add missing members generates indented blocks 2020-05-02 11:53:07 +02:00
bors[bot]
235728319f
Merge #4256
4256: Improve formatting of analyzer status text r=flodiebold a=eminence

The old formatting had everything on 1 line, making it quite hard to read:

    requests:    1 textDocument/documentSymbol         2ms    2 textDocument/codeAction             2ms    3 rust-analyzer/inlayHints            20ms    4 textDocument/foldingRange           108ms    6 textDocument/codeLens               66ms    5 textDocument/semanticTokens/range   76ms    8 rust-analyzer/inlayHints            195ms    7 textDocument/semanticTokens         250ms    9 textDocument/semanticTokens/range   108ms


It now looks like this:

```
requests:
*   1 textDocument/documentSymbol         11ms
    2 textDocument/codeAction             15ms
    3 rust-analyzer/inlayHints            4ms
    5 textDocument/foldingRange           3ms
    4 textDocument/semanticTokens/range   45ms
    6 textDocument/codeLens               182ms
    8 rust-analyzer/inlayHints            124ms
    7 textDocument/semanticTokens         127ms
    9 textDocument/documentHighlight      2ms
   10 textDocument/codeAction             3ms
```

Co-authored-by: Andrew Chin <achin@eminence32.net>
2020-05-02 09:45:37 +00:00
Aleksey Kladov
b58dfd24f1 Add smoke test for decorated blocks 2020-05-02 11:27:28 +02:00
Aleksey Kladov
623faefcda Cleanup inline tests 2020-05-02 11:21:39 +02:00
Aleksey Kladov
642a3392d9 Update test data 2020-05-02 11:21:39 +02:00
Aleksey Kladov
4f2134cc33 Introduce EffectExpr 2020-05-02 11:21:39 +02:00
Aleksey Kladov
247d32cbfd Test/check the whole package
Closes #4255
2020-05-02 10:57:37 +02:00
Edwin Cheng
edf0b4c152 Test whether it is bang macro properly 2020-05-02 10:16:26 +08:00