Commit Graph

19310 Commits

Author SHA1 Message Date
bors[bot]
e372bdce2e
Merge #10338
10338: fix: Fix diagnostics in unnamed consts r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-24 18:42:44 +00: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
bors[bot]
5d948ca6db
Merge #10335
10335: internal: Avoid some `Arc` cloning r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-24 16:57:37 +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
bors[bot]
ef3a2603d6
Merge #10329
10329: Fix link to "Auto Import" r=lnicola a=carlos-menezes

https://github.com/rust-analyzer/rust-analyzer.github.io/pull/147#issuecomment-926600543


Co-authored-by: Carlos Menezes <carlos-menezes212@hotmail.com>
2021-09-24 14:02:16 +00:00
Carlos Menezes
8ad484b341 Add missing files 2021-09-24 14:53:11 +01: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
bors[bot]
e6b64fdcdd
Merge #10328
10328: fix: Fix incorrect mod.rs handling in unlinked_file fixes r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-24 12:21:12 +00:00
Lukas Wirth
bd8c95a580 Fix incorrect mod.rs handling in unlinked_file fixes 2021-09-24 14:20:43 +02:00
bors[bot]
d598d0b4f1
Merge #10322
10322: internal: Split the hover module up r=Veykril a=Veykril

cc https://github.com/rust-analyzer/rust-analyzer/issues/10107
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-23 18:36:44 +00:00
Lukas Wirth
e60f3d265f Split the hover module up 2021-09-23 20:36:15 +02:00
bors[bot]
839885930c
Merge #10321
10321: fix: Change the global setting when toggling inlay hints r=lnicola a=lnicola

Closes #10318

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-09-23 18:06:08 +00:00
bors[bot]
61bb0cfbbe
Merge #10320
10320: feat: Hover/GotoDef works in macro invocations and on doc attribute strings r=Veykril a=Veykril

![image](https://user-images.githubusercontent.com/3757771/134554781-b903d33d-674f-4ed4-8acb-71ff5913f1cb.png)
cc https://github.com/rust-analyzer/rust-analyzer/issues/10271 


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-23 17:56:55 +00:00
Laurențiu Nicola
db5e01189a Change the global setting when toggling inlay hints 2021-09-23 20:45:45 +03: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
bors[bot]
eb727c7222
Merge #10319
10319: internal: Cleanup hover a bit r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-23 14:28:27 +00:00
Lukas Wirth
42eb4efb5b Cleanup 2021-09-23 16:28:03 +02:00
bors[bot]
88a214f2dc
Merge #10315
10315: Fix title of User Manual page r=lnicola a=terrynsun

Asciidoc uses the first line of a doc as the title, so you can't put
comments before the heading.

---
I had an old copy of the Manual page open and I noticed that the "User Manual" heading (and page title) had disappeared in the live version:

![image](https://user-images.githubusercontent.com/2858750/134455658-3885b754-9eae-4dca-a6d4-4b1453910850.png)

With this change (and how it was a few days ago):

![image](https://user-images.githubusercontent.com/2858750/134455865-5acc7538-ccf8-4346-941f-3a5561b3181e.png)


Co-authored-by: Terry Sun <terrynsun@gmail.com>
2021-09-23 04:55:34 +00:00
Terry Sun
04e1d72354 Fix title of User Manual page
Asciidoc uses the first line of a doc as the title, so you can't put
comments before the heading.
2021-09-22 21:39:21 -07:00
bors[bot]
075fe761f3
Merge #10313
10313: Mark large benchmark data files as binary to filter greps r=lnicola a=joshtriplett

When doing a git grep (of rust-analyzer or of rust-lang/rust with
--recurse-submodules), if the grep happens to match within the large
benchmark data files, the resulting long single lines can cause a text
pager or editor to slow down and distract from more useful matches.

These test data files aren't formatted for human consumption, so mark
them as binary, which causes git grep to instead just state that they
match without printing the matching "line".

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-09-22 20:04:30 +00:00
Josh Triplett
dfd28c1764 Mark large benchmark data files as binary to filter greps
When doing a git grep (of rust-analyzer or of rust-lang/rust with
--recurse-submodules), if the grep happens to match within the large
benchmark data files, the resulting long single lines can cause a text
pager or editor to slow down and distract from more useful matches.

These test data files aren't formatted for human consumption, so mark
them as binary, which causes git grep to instead just state that they
match without printing the matching "line".
2021-09-22 12:51:58 -07: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
bors[bot]
6b77e320f0
Merge #10306
10306: Generate function assist creates bad param names for const/static item args r=XFFXFF a=XFFXFF

Try to fix #10278 

Co-authored-by: zhoufan <1247714429@qq.com>
2021-09-21 22:54:56 +00:00
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
bors[bot]
254022c13c
Merge #10304
10304: internal: Generate ast nodes for each ast trait r=Veykril a=Veykril

Generate a `DynTrait` node per ast trait that implements the trait itself as well as conversions via the `AstNode` trait. This is a trick already employed in `hir_def::attr` with `AttrsOwner` where it was manually implemented for.

This basically gives us stack trait objects for these(only useful for `hir_def::attr` currently) as well as simple conversions of `SyntaxNode` to a trait, in cases where only a result of a function call of such a trait is of interest.

It doesn't have many uses yet but as its autogenerated it doesn't add any maintenance costs. 

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-21 14:15:53 +00:00
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
bors[bot]
168b00fbba
Merge #10303
10303: internal: Add a mirror function-like proc-macro expander for tests r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-21 12:56:37 +00:00
Lukas Wirth
ba84b91e78 Add a mirror function-like proc-macro expander for tests 2021-09-21 14:55:54 +02:00
bors[bot]
063df5a482
Merge #10301
10301: minor: Merge iter_for_each_to_for and for_to_iter_for_each assists modules r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-21 08:34:51 +00: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
bors[bot]
6a98383fa5
Merge #10299
10299: minor: Rename some assists r=Veykril a=Veykril

Trying to make our assist names a bit more uniform
`fill_match_arms` -> `add_missing_match_arms`
`infer_function_return_type` -> `add_return_type`
`replace_impl_trait_with_generic` -> `introduce_named_generic`
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-20 22:54:39 +00: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