Commit Graph

15269 Commits

Author SHA1 Message Date
Vladyslav Katasonov
9eb19d92dd allow try expr? when extacting function 2021-02-13 22:04:52 +03:00
Vladyslav Katasonov
f345d1772a handle return, break and continue when extracting function 2021-02-13 22:04:52 +03:00
Vladyslav Katasonov
0ad3d7938f migrate body span to {parent,text_range}
This simplifies api as we are not duplicating code from syntax crate
2021-02-13 22:04:52 +03:00
bors[bot]
3fdc556632
Merge #7662
7662: Group generate getter/setter assist r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-13 18:59:52 +00:00
Lukas Wirth
ed1f2b58f7 Group generate getter/setter assist 2021-02-13 19:58:58 +01:00
bors[bot]
205e72f34d
Merge #7596
7596: Move CodeLens to ide crate r=ivan770 a=ivan770

Closes #7579

Co-authored-by: ivan770 <leshenko.ivan770@gmail.com>
2021-02-13 17:50:55 +00:00
ivan770
13e9d9809a
Remove CodeLensResolveData mention from lsp-extensions.md 2021-02-13 19:36:29 +02:00
Benjamin Bouvier
4a6e602c94 Allow automatically detect the rustc-src directory (fixes #3517).
If the configured rustcSource is set to "discover", try to automatically
detect a source from the sysroot rustc directory.
2021-02-13 18:20:46 +01:00
ivan770
4c2b201b7d
Make annotations tests similar to those in runnables 2021-02-13 19:18:13 +02:00
Lukas Wirth
8ac6041bcf Only use HIR when searching for enum constructors, otherwise fall back to AST 2021-02-13 17:57:14 +01:00
bors[bot]
2967e783ac
Merge #7659
7659: Improve "Generate From impl" r=Veykril a=jDomantas

* Allows any field type. Previously it was restricted to path types, but I don't see why it couldn't apply to all other types too. (the main reason for is PR is that I'm too lazy to write out `From<&'static str>` by hand 😄)
* More correct handling for generic enums - previously it wouldn't emit generic params on the impl.
* Also accepts variants with named field.

The impl generation code got mostly copy-pasted from generate_impl assist - please tell if there's an easy way to avoid this duplication.

Co-authored-by: Domantas Jadenkus <djadenkus@gmail.com>
2021-02-13 15:56:17 +00:00
ivan770
ee049b256a
Improve runnable annotations order, fix incorrect ignore detection 2021-02-13 15:47:53 +02:00
Domantas Jadenkus
b07f530e3a cargo fmt 2021-02-13 15:34:40 +02:00
ivan770
c46b32c449
Added annotation tests 2021-02-13 15:27:04 +02:00
Domantas Jadenkus
375c13cd44 make it work for record-style variants 2021-02-13 14:57:06 +02:00
Domantas Jadenkus
6799088579 update doc 2021-02-13 14:46:41 +02:00
Domantas Jadenkus
3a4d273ac2 handle generic enums 2021-02-13 14:46:28 +02:00
Domantas Jadenkus
e63116c74f allow any field type 2021-02-13 14:29:26 +02:00
Domantas Jadenkus
fee05b0491 use Self instead of enum name 2021-02-13 14:27:38 +02:00
ivan770
02ad828c6d
Fix incorrect references annotation 2021-02-13 13:22:12 +02:00
ivan770
185da286d2
Moved CodeLens to ide crate 2021-02-13 13:07:47 +02:00
bors[bot]
11ebbac3a4
Merge #7658
7658: Build dist-x86_64-unknown-linux-musl releases r=lnicola a=andylizi

Closes #4956.

* Artifact sample: [rust-analyzer-x86_64-unknown-linux-musl.gz](https://github.com/rust-analyzer/rust-analyzer/files/5975504/rust-analyzer-x86_64-unknown-linux-musl.gz)
* Build time: ~14m
```
$ ls -lh
-rwxr-xr-x    1 root     root       29.7M Feb 13 18:24 rust-analyzer-x86_64-unknown-linux-musl

$ ldd rust-analyzer-x86_64-unknown-linux-musl
        /lib/ld-musl-x86_64.so.1 (0x7f2751f13000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x7f2750a78000)
        libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f2751f13000)

$ ./rust-analyzer-x86_64-unknown-linux-musl --version
rust-analyzer 63fcf65
```

I can do `aarch64-unknown-linux-musl` if it's also needed.

Co-authored-by: andylizi <andylizi666@gmail.com>
2021-02-13 11:06:04 +00:00
andylizi
726f9e3163
Build dist-x86_64-unknown-linux-musl releases 2021-02-13 18:45:07 +08:00
Lukas Wirth
c395dd1032 Implement constructor usage search for almost all items
For all struct kinds, unions and enums, as well as for record- and
tuple-variants but not for unit-variants, as these have no trailing
character we can anchor the search to. Functionality wise it is
implemented though.
2021-02-12 21:30:55 +01:00
bors[bot]
935830d05b
Merge #7655
7655: Include a commit log summary in the changelog r=matklad a=lnicola

This version omits any direct pushes, and maybe even pull requests merged from the GitHub UI. But I think it makes writing the release notes easier.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-02-12 18:20:27 +00:00
bors[bot]
88253907f4
Merge #7358
7358: Refactor reference searching to work with the ast  r=matklad a=Veykril

Addresses #4290

This PR is still a bit unpolished. Its main purpose for now is to discuss the direction of the changes as to whether this seems to be the right approach or not. I annotated a few parts with reviews to give a better overwiew without having to read into it too much.

Big part of the diff are test output changes in the `references` module.


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-12 18:01:36 +00:00
Lukas Wirth
fd6cf4d566 Update references test output 2021-02-12 19:00:37 +01:00
Lukas Wirth
c5be0b2589 Use NameLike in FileReference directly as its not exported from ide anymore 2021-02-12 18:58:29 +01:00
Lukas Wirth
d644728d82 Refactor reference searching to work with the ast 2021-02-12 18:58:28 +01:00
Lukas Wirth
43ccbf4360 Remove unused ReferenceSearchResult functions 2021-02-12 18:58:28 +01:00
Laurențiu Nicola
8814d1368d Include a commit log summary in the changelog 2021-02-12 19:53:58 +02:00
bors[bot]
4d51b56444
Merge #7650
7650: Add `find_impl_block_end` assist helper r=Veykril a=yoshuawuyts

Fixes #7605. This makes it so assists can use helpers to either append a method to the start or the end of an `impl` block. Thanks!

@Veykril if this is merged, perhaps it could be good to update the gif in https://github.com/rust-analyzer/rust-analyzer/pull/7617#issuecomment-776622135 ? -- this should fix the ordering issue when generating multiple methods.

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2021-02-12 17:16:02 +00:00
bors[bot]
29bc6b45fb
Merge #7639
7639: Bump rust to latest stable 1.50 r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-02-12 17:02:42 +00:00
kjeremy
cb24d323fe Bump rust to latest stable 1.50 2021-02-12 12:00:05 -05:00
Yoshua Wuyts
ac959b82b3 Add find_impl_block_end assist helper 2021-02-12 17:59:08 +01:00
bors[bot]
cf44953210
Merge #7652
7652: Fix slow tests sometimes failing r=flodiebold a=flodiebold

In some situations we reloaded the workspace in the tests after having reported
to be ready. There's two fixes here:
1. Add a version to the VFS config and include that version in progress reports,
so that we don't think we're done prematurely;
2. Delay status transitions until after changes are applied. Otherwise the last
change during loading can potentially trigger a workspace reload, if it contains
interesting changes.


Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2021-02-12 16:45:58 +00:00
Florian Diebold
8c196056d5 Remove pinned Rust version again 2021-02-12 16:31:16 +01:00
Florian Diebold
a7387cae2c Fix slow tests sometimes failing
In some situations we reloaded the workspace in the tests after having reported
to be ready. There's two fixes here:
1. Add a version to the VFS config and include that version in progress reports,
so that we don't think we're done prematurely;
2. Delay status transitions until after changes are applied. Otherwise the last
change during loading can potentially trigger a workspace reload, if it contains
interesting changes.
2021-02-12 16:31:16 +01:00
bors[bot]
777d936c17
Merge #7653
7653: Document config pattern r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-02-12 15:10:50 +00:00
Aleksey Kladov
799810eaaa Document config pattern 2021-02-12 18:10:16 +03:00
bors[bot]
dee5aba43a
Merge #7644
7644: Primitive completion r=jonas-schievink a=jonas-schievink

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

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-12 13:18:30 +00:00
bors[bot]
a044ac980c
Merge #7638 #7648
7638: libloading 0.7 r=kjeremy a=kjeremy

See https://docs.rs/libloading/0.7.0/libloading/changelog/r0_7_0/index.html

7648: fix nightly warning `legacy_derive_helpers` r=lnicola a=peddermaster2

With a recent nightly (e.g. 2021-02-10) a warning comes up. This PR reorders the attributes to fix the warning.

See https://github.com/rust-lang/rust/issues/79202

Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Peter Wischer <peter.wischer@lwl.org>
2021-02-12 13:01:44 +00:00
Peter Wischer
f18fc5a0ae fix nightly warning legacy_derive_helpers
see https://github.com/rust-lang/rust/issues/79202
2021-02-12 13:57:38 +01:00
bors[bot]
e0fc2af118
Merge #7651
7651: Pin Rust to 1.49.0 on CI r=jonas-schievink a=jonas-schievink



Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-12 12:06:26 +00:00
Jonas Schievink
70f388cedb Pin Rust to 1.49.0 on CI 2021-02-12 13:05:56 +01:00
Jonas Schievink
e938d769d9 Complete builtin type paths 2021-02-11 19:52:46 +01:00
Jonas Schievink
216dc856c5 Wrap BuiltinType in code model 2021-02-11 19:52:33 +01:00
kjeremy
61092bd900 libloading 0.7
See https://docs.rs/libloading/0.7.0/libloading/changelog/r0_7_0/index.html
2021-02-11 10:07:49 -05:00
bors[bot]
b0f20a795d
Merge #7631
7631: Add test for #1165 r=jonas-schievink a=jonas-schievink

Closes #1165

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-10 17:43:06 +00:00
Jonas Schievink
925c51aef3 Add test for #1165
Closes #1165
2021-02-10 18:42:35 +01:00