Commit graph

13311 commits

Author SHA1 Message Date
Lukas Wirth
86e5406539 Fix rename trying to edit the same range multiple times 2021-10-02 18:50:21 +02:00
Aleksey Kladov
7dbf24fc7a minor: dead code 2021-10-02 15:42:10 +03:00
Aleksey Kladov
d5c5b7cd12 internal: remove deprecated method 2021-10-02 15:28:55 +03:00
Aleksey Kladov
9c74a5b2c0 minor: reduce duplication 2021-10-02 15:24:32 +03:00
Aleksey Kladov
f04f8ddb0d minor: regen 2021-10-02 15:20:16 +03:00
Aleksey Kladov
f3a1ff786f minor: generated code readability 2021-10-02 15:20:03 +03:00
bors[bot]
a6e6f9c58b
Merge #10427
10427: minor r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-10-02 10:21:07 +00:00
Aleksey Kladov
393f80e036 minor 2021-10-02 13:20:45 +03:00
bors[bot]
5ff551d86f
Merge #10426
10426: internal: use naming that matches intended use-case r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-10-02 10:06:24 +00:00
Aleksey Kladov
12103b16de internal: untangle usages of ReferenceCategory somewhat
Not everything that can be read or write is a reference, let's try to
use more precise types.
2021-10-02 13:02:06 +03:00
Aleksey Kladov
76e875542a fix: remove semicolon diagnostics only highlights the semi 2021-10-02 12:54:10 +03:00
Aleksey Kladov
46eb03d99a internal: use naming that matches intended use-case 2021-10-02 12:18:18 +03:00
zhoufan
0ee6b70b34 Parse outer attributes on StructPatternEtCetera 2021-10-02 09:57:44 +08:00
nathan.whitaker
a3661b3900 Add whitespace b/w lifetime and mut in expansion 2021-10-01 15:29:26 -04:00
Cassandra McCarthy
d5cf9f4add
docs: add note about vscode-vim in on_enter
I found myself search for this, so building off of #3013 and #3308, I
hope this note is useful.
2021-10-01 14:12:32 -04:00
Laurențiu Nicola
035cb443aa Bump notify 2021-10-01 18:57:04 +03:00
Laurențiu Nicola
ffa8270f6a Bump memmap2 2021-10-01 18:55:52 +03:00
Laurențiu Nicola
34adcc800c Bump libc 2021-10-01 18:51:45 +03:00
Jonas Schievink
033f87c2f0 Add some profiling calls to name resolution 2021-10-01 15:30:00 +02:00
bors[bot]
0646d5cf9e
Merge #10413
10413: fix: Fix format highlighting with `concat!` and `unreachable!` r=jonas-schievink a=jonas-schievink

Last item in https://github.com/rust-analyzer/rust-analyzer/issues/10394, closes https://github.com/rust-analyzer/rust-analyzer/issues/10394

Also documents why/how `is_format_string` even works, since I found that nontrivial.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-10-01 11:31:32 +00:00
Jonas Schievink
3bc0d89ade Fix format highlighting with concat! 2021-10-01 13:28:05 +02:00
bors[bot]
47c079a037
Merge #10403
10403: feat: Add semantic token modifier for crate root r=Veykril a=lhvy

Resolves #9073

I managed to implement crate root highlighting for crates mentioned specifically by name (e.g. `serde` in `use serde::Serialize;`), but not for crates referred to with `crate` or `super`. How could I implement this?

> P.S. I'm participating in [Hacktoberfest 2021](https://hacktoberfest.digitalocean.com/). If this PR is up to standard and merged, I'd appreciate if the `hacktoberfest-accepted` label could be added. Thanks!

Co-authored-by: lhvy <me@lhvy.dev>
2021-10-01 11:18:52 +00:00
lhvy
dbb02370a4
Add semantic token modifier for crate root 2021-10-01 20:52:13 +10:00
Jonas Schievink
cca6ee5757 Expand asm! to format_args! 2021-10-01 12:33:18 +02:00
bors[bot]
8b45de596f
Merge #10411
10411: fix: Parenthesize expressions in `if_to_bool_then` assist where required r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-01 10:20:06 +00:00
Lukas Wirth
816fafd997 Parenthesize expressions in if_to_bool_then assist where required 2021-10-01 12:19:01 +02:00
bors[bot]
c30a6a2974
Merge #10406
10406: internal: Restructure syntax element highlighting into node and token branches r=Veykril a=Veykril

Gets rid of all the unseemly unwraps 
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-30 19:46:57 +00:00
Lukas Wirth
c5ceaefa09 Restructure syntax element highlighting 2021-09-30 21:44:56 +02:00
bors[bot]
8bf2d4fe62
Merge #10404
10404: minor: Simplify r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10405
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-30 18:38:39 +00:00
Lukas Wirth
0c7ea0c9a1 Fix add missing semantic token modifier in SUPPORTED_MODIFIERS 2021-09-30 20:38:05 +02:00
Lukas Wirth
a33939565d Simplify 2021-09-30 19:12:37 +02:00
bors[bot]
4f3ce62b0d
Merge #10402
10402: fix: Don't show flyimport completions in use renames r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10367
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-30 16:18:09 +00:00
Lukas Wirth
d7d16a7ac9 Don't show flyimport completions in use renames 2021-09-30 18:15:55 +02:00
bors[bot]
529b7a4167
Merge #10398
10398: Give defaultLibrary semantic token modifier to items from standard library r=Veykril a=lhvy

Fixes #8999, fixes #2155

`builtInCrates` could be an alternate name to `defaultLibrary`, which one is better?

> P.S. I'm participating in [Hacktoberfest 2021](https://hacktoberfest.digitalocean.com/). If this PR is up to standard and merged, I'd appreciate if the `hacktoberfest-accepted` label could be added. Thanks!

Co-authored-by: lhvy <me@lhvy.dev>
Co-authored-by: Lucas <me@lhvy.dev>
2021-09-30 16:10:23 +00:00
lhvy
0b2ba8be68
Fix builtin_crates return type change 2021-10-01 02:05:00 +10:00
bors[bot]
26a10767cb
Merge #10401
10401: minor: Test runnables check for test prefix and suffix in attributes only r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10393
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-30 16:03:03 +00:00
Lukas Wirth
b742dd313e Test runnables check for test prefix and suffix in attributes only 2021-09-30 18:02:44 +02:00
lhvy
64cbdf6d55
Add comment 2021-10-01 01:58:11 +10:00
Lucas
6606b49710
Reduce allocation in builtin_crates
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-01 01:56:30 +10:00
lhvy
f713cfb818
Remove unneeded semantic token definition 2021-10-01 01:55:29 +10:00
bors[bot]
7a36993892
Merge #10400
10400: fix: fix format string highlighting for `todo!` and `unimplemented!` r=jonas-schievink a=jonas-schievink

Part of https://github.com/rust-analyzer/rust-analyzer/issues/10394

These macros require us to see through the `const_format_args!` invocation the panic macros generate, for that we have to add it to our supported built-in macros.

I've also made the macros in the test `#[macro_export]` (turns out they didn't all resolve correctly before this), which changes the output slightly.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-30 15:33:07 +00:00
Jonas Schievink
4465685878 Work around tidy check 2021-09-30 17:32:18 +02:00
lhvy
2b3baa8503
Give defaultLibrary semantic token modifier to items from standard library 2021-10-01 01:19:24 +10:00
bors[bot]
73562aa168
Merge #10399
10399: minor: don't drop binders when doing autoderef r=lnicola a=iDawer

This fixes #10396 panic introduced in #10373

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-09-30 15:17:12 +00:00
Jonas Schievink
b994469a13 Add const_format_args! builtin macro, fix highlighting 2021-09-30 17:16:39 +02:00
Dawer
df4bb02b6f minor: don't drop binders when doing autoderef 2021-09-30 19:57:15 +05:00
Jonas Schievink
375a0ff785 Use itertools 2021-09-30 16:37:12 +02:00
Jonas Schievink
b8437f71b6 Less hacky assert! expansion 2021-09-30 16:30:26 +02:00
Jonas Schievink
368c5f6023 Fix format string highlighting in panic! 2021-09-30 15:53:47 +02:00
Ariel Davis
00a615b819 Add pub(super) along with pub(crate) and pub as a completion keyword 2021-09-29 21:55:15 -07:00
bors[bot]
b21f15a237
Merge #10389
10389: fix: use the right `HirFileId` when expanding macros in fn parameters r=Veykril a=SkiFire13

Fixes #10388

Co-authored-by: Giacomo Stevanato <giaco.stevanato@gmail.com>
2021-09-29 19:20:12 +00:00
Giacomo Stevanato
034dd41ea8 Add regression test 2021-09-29 21:08:44 +02:00
Giacomo Stevanato
624ee23147 Use the right HirFileId for LowerCtx when expanding macros in fn parameter types 2021-09-29 21:06:37 +02:00
bors[bot]
ee12b0f173
Merge #10181
10181: Begining of lsif r=HKalbasi a=HKalbasi

This PR adds a `lsif` command to cli, which can be used as `rust-analyzer lsif /path/to/project > dump.lsif`. It now generates a valid, but pretty useless lsif (only supports folding ranges). The propose of this PR is to discussing about the structure of lsif generator, before starting anything serious.

cc `@matklad` #8696 #3098


Co-authored-by: hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
2021-09-29 13:13:03 +00:00
hamidreza kalbasi
5bd0f50111 remove glob import and cancellables 2021-09-29 16:25:10 +03:30
bors[bot]
1bd14e0530
Merge #10385
10385: Make `extern crate test;` work r=jonas-schievink a=jonas-schievink

This implements support for dependencies that are not added to the extern prelude of a crate, and add the `test` crate from the sysroot as such a dependency.

This does mean we now index `test` on startup, but I didn't notice much of a difference (and also, r-a can be used while it is still indexing).

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

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-28 19:48:03 +00:00
Jonas Schievink
0e6922f8a8 Implicitly depend on test 2021-09-28 21:39:41 +02:00
bors[bot]
629db286d1
Merge #10373
10373: fix: `into_iterator` not completed on `Vec<{unknown}>` r=iDawer a=iDawer

Fixes  #10297 

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-09-28 19:38:59 +00:00
Dawer
f222665ebe fix: replace errors in a type when doing autoderef 2021-09-29 00:26:58 +05:00
Jonas Schievink
0b76b29512 support non-extern-prelude dependencies 2021-09-28 21:23:46 +02:00
bors[bot]
cd9f27d424
Merge #10382
10382: fix: Fix inline_call breaking RecordExprField shorthands r=Veykril a=Veykril

Fixes #10349
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-28 17:23:11 +00:00
Lukas Wirth
774a8cf08b Fix inline_call breaking RecordExprField shorthands 2021-09-28 19:22:32 +02:00
bors[bot]
c6d95657ee
Merge #10305
10305: Move `GenericParams`'s handling of `impl Trait` into `fn_data_query` r=flodiebold a=SkiFire13

Fixes #10286

Co-authored-by: Giacomo Stevanato <giaco.stevanato@gmail.com>
2021-09-28 16:30:07 +00:00
longfangsong
7e3224f419 Address comments 2021-09-28 10:20:35 +08:00
龙方淞
51b1f7707b Update crates/vfs/src/vfs_path.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-28 10:20:35 +08:00
龙方淞
8f5e8e0a13 Update crates/ide_assists/src/handlers/move_from_mod_rs.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-28 10:20:35 +08:00
longfangsong
0049b5b0bc initial commit 2021-09-28 10:20:29 +08:00
bors[bot]
533ca584c3
Merge #10378
10378: fix: Implement most proc_macro span handling methods r=jonas-schievink a=jonas-schievink

This closes https://github.com/rust-analyzer/rust-analyzer/issues/10368 – some APIs are still missing, but they are either for unstable features or require https://github.com/rust-analyzer/rust-analyzer/issues/9403

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-27 18:00:08 +00:00
Jonas Schievink
577aedb8cf Implement most proc_macro span handling methods 2021-09-27 19:58:07 +02:00
bors[bot]
afa9e31b80
Merge #10377
10377: fix: fix proc macro crash on nightly r=jonas-schievink a=jonas-schievink

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

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-27 17:43:32 +00:00
Jonas Schievink
9641bc7369 Implement save_span / recover_proc_macro_span 2021-09-27 19:42:39 +02:00
bors[bot]
bcf04b19f8
Merge #10375
10375: minor: Use SmallVec<[_; 1]> in `descend_into_macros_impl` r=Veykril a=Veykril

A lot of descends don't actually descend in which case we don't wanna allocate
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-27 17:19:55 +00:00
Lukas Wirth
dedc2368b9 Use SmallVec<[_; 1]> in descend_into_macros_impl 2021-09-27 19:18:26 +02:00
Jonas Schievink
d05eae6ada Make stringify! prettify its input
This will insert whitespace if the invocation is inside another macro
2021-09-27 19:02:03 +02:00
Dawer
11aed78e2b fix: replace errors in receiver type when iterating method candidates 2021-09-27 21:46:00 +05:00
bors[bot]
f22eea9053
Merge #10372
10372: minor: Cleanup descend_into_macros_impl r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-27 16:45:40 +00:00
Lukas Wirth
75660ff94f Cleanup descend_into_macros_impl 2021-09-27 18:44:40 +02:00
bors[bot]
ffcaceb80f
Merge #10366
10366: feat: Enable attribute proc macros by default r=lnicola a=lnicola

Closes #9868

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-09-27 15:12:44 +00:00
Laurențiu Nicola
81891f7abe Enable attribute proc macros by default 2021-09-27 18:11:31 +03:00
Giacomo Stevanato
49ba313679 Update failing test 2021-09-27 16:59:25 +02:00
Giacomo Stevanato
7f76a73a38 Add regression test 2021-09-27 16:59:25 +02:00
Giacomo Stevanato
0d49da5e18 Move GenericParams's handling of impl Trait into GenericParams::generic_params_query 2021-09-27 16:59:25 +02:00
Giacomo Stevanato
72bb49467d Remove SourceMap 2021-09-27 15:23:50 +02:00
Giacomo Stevanato
fe2b1615de Remove GenericParams::new 2021-09-27 15:20:40 +02:00
Giacomo Stevanato
6e4bf22724 Make impls of HasChildSource and ChildBySource for GenericDefId not use GenericParams::new 2021-09-27 15:20:40 +02:00
Lukas Wirth
b6ed91a6de Rename *Owner traits to Has* 2021-09-27 12:54:24 +02:00
Lukas Wirth
a28c5d7311 Rename Dyn* nodes to Any* nodes 2021-09-27 12:45:36 +02:00
Aleksey Kladov
2bf81922f7 internal: more reasonable grammar for blocks
Consider these expples

        { 92 }
  async { 92 }
    'a: { 92 }
   #[a] { 92 }

Previously the tree for them were

  BLOCK_EXPR
    { ... }

  EFFECT_EXPR
    async
    BLOCK_EXPR
      { ... }

  EFFECT_EXPR
    'a:
    BLOCK_EXPR
      { ... }

  BLOCK_EXPR
    #[a]
    { ... }

As you see, it gets progressively worse :) The last two items are
especially odd. The last one even violates the balanced curleys
invariant we have (#10357) The new approach is to say that the stuff in
`{}` is stmt_list, and the block is stmt_list + optional modifiers

  BLOCK_EXPR
    STMT_LIST
      { ... }

  BLOCK_EXPR
    async
    STMT_LIST
      { ... }

  BLOCK_EXPR
    'a:
    STMT_LIST
      { ... }

  BLOCK_EXPR
    #[a]
    STMT_LIST
      { ... }
2021-09-26 19:16:09 +03:00
bors[bot]
c51a3c78cf
Merge #10358
10358: internal: Remove inherent methods from ast nodes that do non-syntactic complex tasks  r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-26 14:49:25 +00:00
Lukas Wirth
151afdfe5c Remove inherent methods from ast node that carry semantic meaning 2021-09-26 16:49:03 +02:00
bors[bot]
cd7b26c6eb
Merge #10352
10352: feat: Implement inline callers assist r=Veykril a=Veykril

Fixes #7242

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-26 14:02:25 +00:00
Lukas Wirth
215a077ee4 Remove imports when inlining all calls in a file 2021-09-26 16:01:54 +02:00
Lukas Wirth
79c70d0ad3 Simplify 2021-09-26 14:56:43 +02:00
Lukas Wirth
1a50f904ef Reject recursive calls in inline_call 2021-09-26 14:55:03 +02:00
Aleksey Kladov
defe805fb7 internal: fix and force-disable block validation ;-(
Originally we tried to maintain the invariant that `{}` always match.
That is, that in the parse tree the pair of corresponding `{}` is always
first and last tokens of some nodes.

We had the code to validate that, but apparently it's been broken for
**years** since we introduced tokens/nodes split. Fixing it now makes
some tests fail.

It's unclear if we want to keep this invariant: there's a strong
motivation for breaking it in the following case:

```
use std::{ // unclosed paren

fn main() {

}

} // don't actually want to pair up this with the one from `use`
```

So let's fix the code, but disable it for the time being
2021-09-26 15:49:23 +03:00
hamidreza kalbasi
7377120fee add some tests 2021-09-26 12:48:53 +03:30
bors[bot]
0618100855
Merge #10354
10354: internal: overhaul expression attribute parsing r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-26 08:23:29 +00:00
hamidreza kalbasi
13d36e96c2 use crates io version 2021-09-26 10:39:23 +03:30
hamidreza kalbasi
48bebeaa32 support goto definition and find references 2021-09-26 10:04:02 +03:30
hamidreza kalbasi
f2775ac2e9 reuse hover results with resultset 2021-09-26 10:04:02 +03:30
hamidreza kalbasi
70061d2b7e move lsif types to lsp types crate 2021-09-26 10:04:02 +03:30
hamidreza kalbasi
e803bd25c4 add hover 2021-09-26 10:04:02 +03:30
hamidreza kalbasi
1103e390e0 cfg unix for tests with unix path 2021-09-26 10:04:02 +03:30
hamidreza kalbasi
5163201847 use utf16 instead of utf8 2021-09-26 10:04:02 +03:30
hamidreza kalbasi
557210a688 Begining of lsif 2021-09-26 10:04:02 +03:30
Aleksey Kladov
56964c9bd3 feat: allow attributes on all expressions
Attrs are syntactically valid on any expression, even if they are not
allowed semantically everywhere yet.
2021-09-25 22:19:27 +03:00
Aleksey Kladov
7dc331faef fix: correct extend_to logic in parser
Previously we swapped to events in the buffer, but that might be wrong
if there aer `forward_parent` links pointing to the swapped-out node.

Let's do the same via parent links instead, keeping the nodes in place
2021-09-25 22:09:50 +03:00
Lukas Wirth
1ccb21a0ca feat: Implement inline callers assist 2021-09-25 18:39:43 +02:00
bors[bot]
d401f2a062
Merge #10211
10211: assists: Promote module to folder r=jonas-schievink a=longfangsong

Close part of #10143.

This PR adds a assist to promote module to directory, which means make a .rs file module into a directory style module with the same name.

![未命名(1)](https://user-images.githubusercontent.com/13777628/132958377-14555d6f-a64a-4b9b-9154-90a3b86fd685.gif)


Co-authored-by: longfangsong <longfangsong@icloud.com>
2021-09-25 15:32:00 +00:00
Aleksey Kladov
6997adfee7 simplify attribute parsing 2021-09-25 18:07:51 +03:00
longfangsong
22abbe86f3 Address comments 2021-09-25 22:48:57 +08:00
bors[bot]
0cb9ee2054
Merge #10346
10346: minor: align code with code-style r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-25 11:56:23 +00:00
Aleksey Kladov
5767f31cbf minor: align code with code-style 2021-09-25 14:55:42 +03:00
Aleksey Kladov
929fca5adc minore: improve consistency 2021-09-25 14:36:46 +03:00
Aleksey Kladov
f27cda6865 minor: more condensed tests 2021-09-25 14:24:57 +03:00
Aleksey Kladov
f692be853b minor: link my own pratt parsing article :-) 2021-09-25 14:20:34 +03:00
Aleksey Kladov
d72f7cf3af internal: add => () rule; emphasize n_items rule 2021-09-25 14:10:25 +03:00
Aleksey Kladov
1567bbb73e minor: more focusted tests 2021-09-25 14:04:27 +03:00
Aleksey Kladov
a6f17f7436 minor: more readable code 2021-09-25 13:27:53 +03:00
Jonas Schievink
7860d6ade6 Fix item-level lazy macro errors 2021-09-24 21:17:25 +02:00
Jonas Schievink
5967f3d3a9 Fix diagnostics in unnamed consts 2021-09-24 20:41:24 +02:00
bors[bot]
8b08666343
Merge #10334
10334: Give rustfmt spawn error context. r=jonas-schievink a=aDotInTheVoid

This mean if you misconfigure to

```json
{
    "rust-analyzer.rustfmt.overrideCommand": [
        "./nonono"
    ]
}
```

The error message is

```
[Error - 17:54:33] Request textDocument/formatting failed.
  Message: Failed to spawn "./nonono"
  Code: -32603 
```

instead of

```
[Error - 17:56:12] Request textDocument/formatting failed.
  Message: No such file or directory (os error 2)
  Code: -32603 
```

I'm not sure how to test this, or if it needs a test.

Co-authored-by: Nixon Enraght-Moony <nixon.emoony@gmail.com>
2021-09-24 17:07:18 +00:00
Jonas Schievink
b8eb63f2b2 Avoid some Arc cloning 2021-09-24 18:57:08 +02:00
Nixon Enraght-Moony
720a3da4ac Give rustfmt spawn error context. 2021-09-24 17:51:47 +01:00
bors[bot]
eb17e90eba
Merge #10105
10105: RfC: Use `todo!()` instead of `()` for missing fields r=jonas-schievink a=jo-so

Most commonly a field of a struct can be initialized with its default value than an empty tuple.

Co-authored-by: Jörg Sommer <joerg@jo-so.de>
2021-09-24 15:12:17 +00:00
bors[bot]
377476ac45
Merge #10332
10332: minor: Allow overwriting RUST_BACKTRACE for the server manually r=jonas-schievink a=Veykril

Trying to figure out why we aren't getting backtraces for windows builds from CI, this let's one set the backtraces to `FULL`
Might be cc https://github.com/rust-lang/rust/issues/87481
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-24 14:59:02 +00:00
bors[bot]
2117ba0235
Merge #10331
10331: minor: Include macro path in eager macro resolve error r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-24 14:51:19 +00:00
Lukas Wirth
983e19c868 Allow setting RUST_BACKTRACE for the server manually 2021-09-24 15:38:00 +02:00
Jonas Schievink
af3d6a4b61 Include macro path in eager macro resolve error 2021-09-24 15:34:57 +02:00
Carlos Menezes
0c49e3883c
Fix link to "Auto Import" 2021-09-24 13:59:44 +01:00
Lukas Wirth
bd8c95a580 Fix incorrect mod.rs handling in unlinked_file fixes 2021-09-24 14:20:43 +02:00
Lukas Wirth
e60f3d265f Split the hover module up 2021-09-23 20:36:15 +02:00
Lukas Wirth
22c6f0a8a5 Support goto_def for intra-doc-links in macro invocations 2021-09-23 19:17:29 +02:00
Lukas Wirth
d99adc5738 Make hover work for intra doc links in macro invocations 2021-09-23 17:32:39 +02:00
Lukas Wirth
42eb4efb5b Cleanup 2021-09-23 16:28:03 +02:00
bors[bot]
8a82e6c492
Merge #10284
10284: internal: definition based hover functions r=Veykril a=HKalbasi

This is part of #10181 but since it is blocked and `hover.rs` is moving quickly so will cause conflicts, I submitted this PR.

This PR extract some parts of `hover` to `find_definition` (maybe this need to be moved to some other file?) and `hover_for_definition`, with those functions I will be able to calculate definition of every token, and calculate hover (and probably other queries) for each definition only once.

Co-authored-by: hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
2021-09-22 15:23:23 +00:00
hamidreza kalbasi
589c1dfa04 move function to defs.rs 2021-09-22 18:35:54 +03:30
hamidreza kalbasi
18e6b508dd remove dead code 2021-09-22 11:44:23 +03:30
hamidreza kalbasi
569ac5bee1 use find_definition in go to 2021-09-22 11:37:26 +03:30
zhoufan
8690cfb868 Change the style of the code 2021-09-22 06:32:23 +08:00
zhoufan
7912d3a4b3 Generate function assist creates bad param names for const/static item args 2021-09-22 00:15:57 +08:00
hamidreza kalbasi
887b7ddc37 fix derive hover in macro 2021-09-21 19:55:57 +04:30
Lukas Wirth
83e97adfff Simplify 2021-09-21 16:15:30 +02:00
Lukas Wirth
b36f12dba5 Simplify 2021-09-21 16:05:21 +02:00
Lukas Wirth
6d6e0b8f21 Generate ast nodes for each ast trait 2021-09-21 15:52:11 +02:00
Lukas Wirth
ba84b91e78 Add a mirror function-like proc-macro expander for tests 2021-09-21 14:55:54 +02:00
Lukas Wirth
8b1e8197fe Merge iter_for_each_to_for and for_to_iter_for_each assists modules 2021-09-21 10:34:11 +02:00
Lukas Wirth
8b2be8572f Rename some assists 2021-09-21 00:54:09 +02:00
longfangsong
cd599ec202 Address comments 2021-09-20 21:37:18 +08:00
bors[bot]
f1d7f98ed0
Merge #10293
10293: fix: Don't bail on parse errors in macro input for builtin expansion r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-19 22:33:42 +00:00
Lukas Wirth
e7e87fc69d Don't bail on parse errors in macro input for builtin expansion 2021-09-20 00:33:13 +02:00
bors[bot]
b7bedf16a1
Merge #10289
10289: fix: Only strip derive attributes when preparing macro input r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10246
cc https://github.com/rust-analyzer/rowan/pull/114, follow up to https://github.com/rust-analyzer/rust-analyzer/pull/10025

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-19 21:46:51 +00:00
Lukas Wirth
a6dde501df Only strip derive attributes when preparing macro input 2021-09-19 23:38:38 +02:00
Lukas Wirth
9c39363ada Simplify 2021-09-19 23:34:07 +02:00
Lukas Wirth
3987bf5d6f Simplify 2021-09-19 19:00:06 +02:00
Aleksey Kladov
a6181bfdb7 internal: more focused tests for const arguments 2021-09-19 16:35:10 +03:00
Aleksey Kladov
09531b703d minor: simplify 2021-09-19 14:50:53 +03:00
hamidreza kalbasi
0777698f29 internal: definition based hover functions 2021-09-19 16:15:44 +04:30
Aleksey Kladov
0005678649 minor: simplify 2021-09-19 14:26:35 +03:00
Aleksey Kladov
f99bdf4cc0 fix: don't allow two turbo-fishes in generic arguments 2021-09-19 12:09:50 +03:00
Aleksey Kladov
8ae1f9c335 internal: add erroneous test for double turbo fish
We parse `f` successfully, but that is a bug.
2021-09-19 11:42:10 +03:00
Aleksey Kladov
8009ccc27d minor: improve readability 2021-09-19 11:34:25 +03:00
Aleksey Kladov
25adc5e9f0 minor: reduce duplication 2021-09-19 11:19:31 +03:00
bors[bot]
7729473dd2
Merge #10276
10276: internal: parser cleanup r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-18 13:09:51 +00:00
Aleksey Kladov
fbb6a6a95b fix: correctly handle jointness 2021-09-18 16:09:12 +03:00
Aleksey Kladov
c0556bd8c1 minor: improve readability 2021-09-18 15:56:26 +03:00
Aleksey Kladov
ed84717869 internal: better naming 2021-09-18 15:55:07 +03:00
Aleksey Kladov
3dc2aeea0f internal: parser cleanup 2021-09-18 15:46:28 +03:00
Aleksey Kladov
af9fd37cd9 internal: minimize use_tree parser tests
The code here is intentionally dense and does exactly what is written.
Explaining semantic difference between Rust 2015 and 2018 doesn't help
with understanding syntax. Better to just add more targeted tests.
2021-09-18 15:22:49 +03:00
bors[bot]
dd12521ac9
Merge #10275
10275: internal: parser cleanups r=Veykril a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-18 12:20:55 +00:00
Aleksey Kladov
1d2e9818d6 internal: parser cleanups 2021-09-18 14:53:46 +03:00
Aleksey Kladov
aaadaa40bd internal: more focused trait item parsing tests 2021-09-18 14:34:29 +03:00
Lukas Wirth
6465868449 Make inlay hints work in attributed items 2021-09-18 13:19:29 +02:00
Lukas Wirth
11a17c803f Add multi-token mapping test for goto_definition 2021-09-18 12:00:12 +02:00
bors[bot]
a435e49d34
Merge #10252
10252: fix: make `goto_definition` multi-token mapping aware r=Veykril a=XFFXFF

Implement #10070 in  [`goto_definition`](https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/goto_definition.rs)

Co-authored-by: zhoufan <1247714429@qq.com>
2021-09-18 01:21:43 +00:00
zhoufan
227450f9b9 do comment handling on the original token 2021-09-18 08:22:57 +08:00
bors[bot]
7c03200d70
Merge #10267
10267: Narrow "if-let to match" assist available range r=Veykril a=rainy-me

ref: https://github.com/rust-analyzer/rust-analyzer/issues/10220

Co-authored-by: rainy-me <github@rainy.me>
2021-09-17 22:44:39 +00:00
Aleksey Kladov
3474e3b3b1 intenral: more local tests for statics 2021-09-18 01:02:43 +03:00
Aleksey Kladov
1feb8e89d5 minor: cleanup const parsing 2021-09-18 00:58:35 +03:00
Aleksey Kladov
46326b8db7 minor: better test placement 2021-09-18 00:54:03 +03:00
Aleksey Kladov
2195ecd7e7 internal: cleanup adt parsing 2021-09-18 00:50:27 +03:00
Aleksey Kladov
d890c767c4 internal: cleanup item parsing 2021-09-18 00:33:42 +03:00
Aleksey Kladov
ec2043a082 minor: parser cleanup 2021-09-18 00:14:20 +03:00
Aleksey Kladov
4d2956e775 minor: simplify 2021-09-17 23:31:37 +03:00
rainy-me
11fbafdee3 Narrow "if-let to match" assist available range 2021-09-18 05:28:52 +09:00
Aleksey Kladov
366d3d7544 minor: cleanup 2021-09-17 23:27:26 +03:00
bors[bot]
4badd2faf8
Merge #10265
10265: internal: parser cleanups r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-17 19:27:32 +00:00
Aleksey Kladov
329b01ca67 minor: simplify 2021-09-17 22:26:39 +03:00
Aleksey Kladov
77e8421d0f internal: more local parsing tests for macros 2021-09-17 22:21:57 +03:00
Aleksey Kladov
073d5f7733 internal: more focused parsing tests 2021-09-17 22:15:12 +03:00
Aleksey Kladov
55078c81e0 internal: more local test for mod item 2021-09-17 21:53:24 +03:00
Aleksey Kladov
715cd8d938 internal: more local parsing tests 2021-09-17 21:49:01 +03:00
Aleksey Kladov
f632b5e481 internal: parser cleanups 2021-09-17 21:40:28 +03:00
bors[bot]
d44779f8a5
Merge #10260
10260: fix: fix names generation in `Generate function` r=Veykril a=iDawer

- Improve fn name computation (close #10176).
- Handle tuple indexing expressions in argument position (should close  #10241)

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-09-17 18:35:36 +00:00
Dawer
0ff271d38f fix completion handler trying to seek outside of character boundaries.
With this patch, in these examples
```rust
fn main() {
    "⊞$0";
}
```

```rust
struct S {
д$0 u8
}
```
entering ':' character in `$0` places shouldn't cause panics.
2021-09-17 23:04:20 +05:00
bors[bot]
00b19846c9
Merge #10257
10257: assists: turn while into loop r=Veykril a=agluszak

Implements an assist to turn a `while` loop into a `loop` loop, as requested in #10214. 
I'm not sure sure what the guidelines are regarding naming assists convert_x_to_y vs replace_x_with_y.

This is my first commit to rust-analyzer :D Thank you `@matklad` for your awesome Explaining rust-analyzer series <3

Closes #10214 

Co-authored-by: Andrzej Głuszak <gluszak.andrzej@gmail.com>
2021-09-16 21:04:42 +00:00
Andrzej Głuszak
11a56f886b assists: turn while into loop 2021-09-16 22:20:27 +02:00
Dawer
1d94e234d5 Handle tuple indexing expression in argument position in Generate function 2021-09-16 23:45:41 +05:00
Dawer
4dc33140a3 Imrove fn name computation in Generate function 2021-09-16 21:03:37 +05:00
teor
e0a501424c
Fix a comment typo in autoderef.rs 2021-09-16 13:47:01 +10:00