Commit graph

11309 commits

Author SHA1 Message Date
bors[bot]
49a5d6a8d4
Merge #7698
7698: Add new LSP extension for workspace symbol lookup r=matklad a=alcroito

As well as all symbol types (functions, modules).

Remove outdated documentation regarding symbol lookup filtering.

Closes #4881

Co-authored-by: alcroito <placinta@gmail.com>
2021-05-18 19:20:51 +00:00
bors[bot]
16b03d21dc
Merge #8871
8871: internal: Simplify `DefCollector::resolve_macros` r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-05-18 19:02:32 +00:00
Jonas Schievink
4884d9ec1d Simplify DefCollector::resolve_macros 2021-05-18 17:51:02 +02:00
rainy-me
e0b01f34bb Add pub mod option for UnlinkedFile 2021-05-18 08:11:07 +09:00
alcroito
1f7d2a6c22 Add new LSP extension for workspace symbol lookup
The new extension allows filtering of workspace symbool lookup
results by search scope or search kind.

Filtering can be configured in 3 different ways:

 - The '#' or '*' markers can be added inline with the symbol lookup
   query.

   The '#' marker means symbols should be looked up in the current
   workspace and any dependencies. If not specified, only current
   workspace is considered.

   The '*' marker means all kinds of symbols should be looked up
   (types, functions, etc). If not specified, only type symbols are
   returned.

 - Each LSP request can take an optional search_scope or search_kind
   argument query parameter.

 - Finally there are 2 global config options that can be set for all
   requests served by the active RA instance.

Add support for setting the global config options to the VSCode
extension.
The extension does not use the per-request way, but it's useful for
other IDEs.

The latest version of VSCode filters out the inline markers, so
currently the only reasonable way to use the new functionality is
via the global config.
2021-05-18 00:40:30 +02:00
Jamie Cunliffe
74f8fe7763 Extract function assist will add async if required
The extract function assist will check for an AWAIT_EXPR in the body
and if found, will add async to the generated function.
2021-05-17 18:17:29 +01:00
Aleksey Kladov
459b0332d3 internal: use more evocative test folder name 2021-05-17 19:01:54 +03:00
Aleksey Kladov
41510f437e minor: adjust config name 2021-05-17 18:37:06 +03:00
bors[bot]
f9d4a9eaee
Merge #8795
8795: Allow semantic tokens for strings to be disabled r=matklad a=djrenren

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

Pretty straightforward change, but open to any suggestions if there's a more recommended testing strategy than what I went with.

Co-authored-by: John Renner <john@jrenner.net>
2021-05-17 14:41:56 +00:00
bors[bot]
6aac6bcc74
Merge #8858
8858: Ignore macro import from `extern crate self` r=jonas-schievink a=ivan770

Closes #8834

Co-authored-by: ivan770 <leshenko.ivan770@gmail.com>
2021-05-17 10:16:05 +00:00
Aleksey Kladov
75a0123614 fix: don't add extra whitespace around fields
closes #8785
2021-05-17 12:45:01 +03:00
ivan770
999217374f
Added cov mark 2021-05-17 11:37:24 +02:00
Aleksey Kladov
21918c6f5e minor: add missing tests 2021-05-17 12:37:22 +03:00
Aleksey Kladov
fa7fc0e5cb internal: scalable module structure for fixits 2021-05-17 12:04:17 +03:00
Aleksey Kladov
db8fbb99ce minor: extract fix to file 2021-05-17 11:40:34 +03:00
bors[bot]
b82458818d
Merge #8845
8845: Generate the impl block via generate_trait_impl_text_from_impl r=Veykril a=hi-rustin

Try to close https://github.com/rust-analyzer/rust-analyzer/issues/8827

Co-authored-by: hi-rustin <rustin.liu@gmail.com>
2021-05-16 19:32:40 +00:00
ivan770
a79b54ef73
Fix #8834 2021-05-16 20:05:52 +02:00
bors[bot]
ef6df1d994
Merge #8853
8853: Tag Self in impls as a TypeAlias r=matklad a=Veykril

bors r+
Fixes #4398

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-16 17:35:40 +00:00
Aleksey Kladov
1859df37fd internal: use mutable syntax trees when filling fields 2021-05-16 18:10:56 +03:00
Lukas Wirth
90230e882d Tag Self in impls as a TypeAlias 2021-05-16 15:12:58 +02:00
Aleksey Kladov
9df0a23368 internal: use standard test style 2021-05-16 15:14:57 +03:00
Aleksey Kladov
e4a7b44e55 internal: use mutable trees when filling match arms 2021-05-16 15:10:18 +03:00
Aleksey Kladov
4e142757e1 minor: use uniform names 2021-05-16 14:18:49 +03:00
bors[bot]
a57bd59f35
Merge #8813
8813: Get some more array lengths! r=lf- a=lf-

This is built on #8799 and thus contains its changes. I'll rebase it onto master when that one gets merged. It adds support for r-a understanding the length of:

* `let a: [u8; 2] = ...`
* `let a = b"aaa"`
* `let a = [0u8; 4]`

I have added support for getting the values of byte strings, which was not previously there. I am least confident in the correctness of this part and it probably needs some more tests, as we currently have only one test that exercised that part (!).

Fixes #2922.

Co-authored-by: Jade <software@lfcode.ca>
2021-05-16 01:53:12 +00:00
Jade
de0ed9860d Address final feedback
* rename ConstExtension->ConstExt
* refactor a manual construction of a Const
2021-05-15 18:51:18 -07:00
bors[bot]
92abc56bc9
Merge #8848
8848: Attach comments to ast::Impl r=Veykril a=Veykril

bors r+
Fixes #8847

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-15 15:32:54 +00:00
Lukas Wirth
4b5b54279a Attach comments to ast::Impl 2021-05-15 17:32:28 +02:00
Lukas Wirth
3da52d2e93 simplify 2021-05-15 17:22:39 +02:00
hi-rustin
f5ea2a2ab0 Remove attrs 2021-05-15 21:12:06 +08:00
hi-rustin
696a8bf870 Address comments and add more tests
Fix tests

Fmt code
2021-05-15 20:44:45 +08:00
hi-rustin
3f0222565d Generate the impl block via generate_trait_impl_text 2021-05-15 11:29:33 +08:00
Lukas Wirth
5b247780d4 simplify 2021-05-15 01:09:53 +02:00
bors[bot]
e5e6c363dc
Merge #8840
8840: fix: false positive "Missing match arm" when a tuple pattern is shorter than scrutinee type. r=Veykril a=iDawer

![Screenshot_20210515_003035](https://user-images.githubusercontent.com/7803845/118320023-2bcb7380-b4eb-11eb-9de6-d8762f981dc2.jpg)
Match checking diagnostic shouldn't fire when there is type mismatches.

rust-analyzer fd109fb58 2021-05-10 dev

(This is part of the preparation for https://github.com/rust-analyzer/rust-analyzer/pull/8717)

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-05-14 19:57:52 +00:00
Dawer
2abb4c99fe Fix false positive "Missing match arm". 2021-05-15 00:18:59 +05:00
bors[bot]
260bcd942b
Merge #8839
8839: minor: more useful bench r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-05-14 17:24:39 +00:00
Aleksey Kladov
ee1c23c78c minor: more useful bench 2021-05-14 20:23:29 +03:00
bors[bot]
e7b8e6fbca
Merge #8819
8819: Use package root as `cargo check` working directory r=matklad a=bcully

Cargo commands are affected by the `.cargo/config` files above
their working directory. If cargo is invoked from above the directory
holding `Cargo.toml`, it may not pick up important settings like
registry replacements, causing it to behave differently or even fail.

Most cargo invocations are currently setting their working directories
to the directory containing `Cargo.toml`, but a couple of paths remain
in which cargo is invoked from the default workspace root instead.

This change fixes that, resolving some cargo check failures that I
experienced in a multi-root workspace in which packages used different
registries.

Co-authored-by: Brendan Cully <brendan@cully.org>
2021-05-14 17:15:21 +00:00
Aleksey Kladov
883dd1568f internal: use more mutable APIs 2021-05-14 20:00:35 +03:00
Aleksey Kladov
6c21d04307 internal: use standard style for tests 2021-05-14 18:53:53 +03:00
Aleksey Kladov
cea589b3b5 internal: rewrite assoc item manipulaion to use mutable trees 2021-05-14 18:47:08 +03:00
Aleksey Kladov
73123a7550 internal: remove SyntaxRewriter 2021-05-14 16:40:11 +03:00
Aleksey Kladov
873717190d internal: remove more of the SyntaxRewriter 2021-05-14 16:28:59 +03:00
Aleksey Kladov
0650f77dd9 internal: remove one more immutable tree 2021-05-14 16:19:27 +03:00
hi-rustin
765ccf2eca Address comments 2021-05-14 17:47:16 +08:00
Jade
78d6b88f21 Add more tests, refactor array lengths/consteval work
Fix #2922: add unknown length as a condition for a type having unknown.

Incorporate reviews:

* Extract some of the const evaluation workings into functions
* Add fixmes on the hacks
* Add tests for impls on specific array lengths (these work!!! 😁)
* Add tests for const generics (indeed we don't support it yet)
2021-05-14 01:39:28 -07:00
hi-rustin
b98c119ba6 Apply async semantic token modifier to async/await keywords
Only async semantic token modifier
2021-05-14 10:47:00 +08:00
bors[bot]
9803a9a148
Merge #8830
8830: feat: Implement bulitin macro `concat_idents` r=edwin0cheng a=edwin0cheng

cc  #8828

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-05-13 22:44:34 +00:00
Edwin Cheng
bbc151ef32 Implement concat_idents 2021-05-14 06:42:10 +08:00
bors[bot]
9c8c72b7c4
Merge #8822
8822: minor: Cleanup imports r=Veykril a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-05-13 20:38:56 +00:00
bors[bot]
1552fdd3bc
Merge #8814
8814: fix: Keep doc comments and outer attrs on "Move module to file" assist r=Veykril a=Jesse-Bakker

Fixes #8804


Co-authored-by: Jesse Bakker <github@jessebakker.com>
2021-05-13 17:37:52 +00:00