Commit Graph

1573 Commits

Author SHA1 Message Date
bors[bot]
7a564af989
Merge #11935
11935: feat: Switch to LSP inlay hints r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-04-11 09:29:15 +00:00
Lukas Wirth
2d445de170 minor: bump lsp-server version 2022-04-09 00:13:47 +02:00
Laurențiu Nicola
d3d6267112 Switch to LSP inlay hints 2022-04-08 14:10:24 +03:00
Lukas Wirth
3a847eacc8 fix: Show the path to be created in the unresolved-module fix label 2022-04-04 16:04:09 +02:00
bors[bot]
bc0825d135
Merge #10802
10802: Allow clients to configure the global workspace search limit r=Veykril a=knutwalker

Playing around with [helix](https://helix-editor.com) I realized that the global worksapce symbol search works different compared to vs-code.
Helix requires all possible symbols in one query and does no subsequent refinement searched.
This PR adds a configuration option to override the default search limit with the default being the currently hardocded value.
Helix users can increment this limit for their instance with a config like

```toml
[[language]]
name = "rust"
language-server = { command = "rust-analyzer" }
[language.config]
workspace = { symbol = { search = { limit = 65536 }}}
```

Other editors are not affected by this change.


Co-authored-by: Paul Horn <dev@knutwalker.engineer>
2022-04-03 12:03:46 +00:00
bors[bot]
5b5ca0bd17
Merge #11866
11866: fix: Prevent underflow in range conversion  r=Veykril a=skyfmmf

Previously, when line numbers of Rust spans were converted to LSP ranges, they could underflow resulting in very large line numbers. As an underflow is always wrong, prevent it and use 0 instead.

This was noticed when opening an empty file in `src/bin/` of a library crate. In this case rustc produces a span with `"line_start": 0, "line_end": 0` resulting in the underflow.

Co-authored-by: Felix Maurer <felix@felix-maurer.de>
2022-04-03 11:49:23 +00:00
hkalbasi
003a6b74e4 suggest infered type in auto complete 2022-04-03 11:17:33 +04:30
Lukas Wirth
f610e2c2ed Simplify completion import insertion 2022-04-02 01:42:21 +02:00
bors[bot]
50225fe630
Merge #11869
11869: fix: code blocks with tilde also works like code block r=Veykril a=moreal

The `rustdoc` uses the `pulldown_cmark` package to parse *doc_comment* and the package also treat triple `~` characters also as code block fences. So when we run `cargo doc`, they will be placed also.

<img width="965" alt="image" src="https://user-images.githubusercontent.com/26626194/161208072-5a09a209-57fc-4a52-b190-b0a9be9ffcd6.png">

But `rust-analyzer` doesn't support it so it doesn't have any injected code highlights and any `Run doctest` hint. This pull request tries to allow also them. 🙇🏻‍♂️ 

Before:

<img width="224" alt="image" src="https://user-images.githubusercontent.com/26626194/161207405-b1d6cfda-82b1-4f60-8e42-c51d0ed98f38.png">

After:

<img width="161" alt="image" src="https://user-images.githubusercontent.com/26626194/161207693-8e39997c-9ca6-4e69-8c65-e9b70899f7db.png">


Co-authored-by: Lee Dogeon <dev.moreal@gmail.com>
2022-04-01 12:40:51 +00:00
Lee Dogeon
e3f32d13e1 Code blocks with tilde also works like code block 2022-04-01 20:29:32 +09:00
Felix Maurer
feb8ccacba Add test against line number underflow 2022-03-31 23:37:23 +02:00
Felix Maurer
a98ffe4268 Prevent underflow when converting line numbers
Previously, when line numbers of Rust spans were converted to LSP
ranges, they could underflow resulting in very large line numbers. As
an underflow is always wrong, prevent it and use 0 instead.
2022-03-31 23:00:48 +02:00
Jonas Schievink
ec2d023383 Add "view file text" command to debug sync issues 2022-03-31 14:50:33 +02:00
bors[bot]
e30747dfa8
Merge #11793
11793: LSIF: consolidate references into a single edge where possible. r=Veykril a=khuey



Co-authored-by: Kyle Huey <khuey@kylehuey.com>
2022-03-25 22:46:15 +00:00
Jonas Schievink
44a99d6e49 Disable experimental diagnostics by default 2022-03-24 17:00:17 +01:00
Kyle Huey
af1aa86ac0 Preserve order when grouping references. 2022-03-22 12:38:59 -07:00
Kyle Huey
0583919919 LSIF: consolidate references into a single edge where possible. 2022-03-22 12:00:52 -07:00
Lukas Wirth
8e91bb7660 minor: Bump dependencies 2022-03-22 17:42:24 +01:00
Lukas Wirth
ecf2c98859 fix: Fix lifetime elision hint configuration key 2022-03-22 16:28:36 +01:00
bors[bot]
966b692422
Merge #11771
11771: feat: Visualize compiler inserted reborrows via inlay hints r=Veykril a=Veykril

Disabled by default.

![image](https://user-images.githubusercontent.com/3757771/159165178-baaf968a-4381-468e-933f-5326ca1b203d.png)

Closes https://github.com/rust-analyzer/rust-analyzer/issues/11275


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 13:47:16 +00:00
Lukas Wirth
37b48ceb8f feat: Visualize compiler inserted reborrows via inlay hints 2022-03-20 14:38:16 +01:00
bors[bot]
7315d97347
Merge #11755
11755: feat: Implement lifetime elision hints r=Veykril a=Veykril

With names on:
![Code_erl26zKvuf](https://user-images.githubusercontent.com/3757771/159134856-e2c75d2d-f17c-45c7-9a78-3da5ee8b1acd.png)
With names off:
![Code_MRP1Pbfe9d](https://user-images.githubusercontent.com/3757771/159134857-30fac3a1-825e-4f49-ba9b-9fa0bb215694.png)


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-19 19:15:06 +00:00
Lukas Wirth
7da5b80f25 Change skip trivial behaviour 2022-03-19 20:12:14 +01:00
Lukas Wirth
7ab0aaa82a Add option to skip trivial cases 2022-03-19 19:01:19 +01:00
Lukas Wirth
45756c823f Use numbers for lifetimes by default, add setting to prefer using parameter names 2022-03-19 18:11:56 +01:00
Jonas Schievink
55d2a25123 Rename call info to "signature help"
It is no longer limited to just calls
2022-03-18 20:19:35 +01:00
Jonas Schievink
0642724e94 Provide signature help when editing generic args 2022-03-18 19:59:41 +01:00
Lukas Wirth
673e2b1d8f feat: Implement lifetime elision hints 2022-03-18 18:11:16 +01:00
Laurențiu Nicola
86b1ef9ab2 Bump deps 2022-03-17 19:24:37 +02:00
bors[bot]
3bff42fd14
Merge #11734
11734: internal: Bump `xshell` and fix `dist` r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-03-17 06:54:27 +00:00
Laurențiu Nicola
be6d5001e4 Bump xshell and fix dist 2022-03-17 08:53:33 +02:00
Lukas Wirth
bd17933c31 feat: Add return type hints for closures with block bodies 2022-03-16 21:25:03 +01:00
Laurențiu Nicola
620411df80 Mark chaining hints as types, since that's what they are 2022-03-16 07:46:09 +02:00
Aleksey Kladov
56e43c34e7 ⬆️ xshell 2022-03-14 14:57:24 +00:00
Matthias Krüger
56e4ea59d9 more clippy fixes:
clippy::match_like_matches_macro
clippy::to_string_in_format_args
clippy::single_char_add_str
clippy::filter_map_identity
clippy::clone_on_copy
clippy::useless_format
clippy::unused_unit
2022-03-12 16:50:49 +01:00
Matthias Krüger
77790f2b8e fix clippy::needless_return 2022-03-12 16:50:49 +01:00
Matthias Krüger
d64d711db2 fix clippy::map_flatten 2022-03-12 16:50:49 +01:00
Matthias Krüger
1f70886b15 fix clippy::single_char_pattern 2022-03-12 16:50:49 +01:00
Matthias Krüger
7912e33ed6 fix clippy::needless_borrow 2022-03-12 16:50:49 +01:00
Lukas Wirth
21af9ba4f0 minor: Pad type inlay hints if no colons are requested 2022-03-12 14:08:39 +01:00
Lukas Wirth
119ba82e4b minor: add missing definitions of lsp_ext::InlayHintLabel 2022-03-12 01:08:33 +01:00
Lukas Wirth
62265ee9cb fix: Allow configuration of colons in inlay-hints 2022-03-11 21:15:36 +01:00
Lukas Wirth
a9dd606387 fix: Show what file paths were expected for unresolved modules 2022-03-11 17:08:30 +01:00
Laurențiu Nicola
4a6ee4517a Add back colons around inlay hints 2022-03-08 12:01:02 +02:00
Laurențiu Nicola
8e3057d0a7 Improve inlay hint padding 2022-03-07 19:18:36 +02:00
bors[bot]
49646b71d4
Merge #11445
11445: Upstream inlay hints r=lnicola a=lnicola

Closes https://github.com/rust-analyzer/rust-analyzer/issues/2797
Closes https://github.com/rust-analyzer/rust-analyzer/issues/3394 (since now resolve the hints for the range given only, not for the whole document. We don't actually resolve anything due to [hard requirement](https://github.com/rust-analyzer/rust-analyzer/pull/11445#issuecomment-1035227434) on label being immutable. Any further heavy actions could go to the `resolve` method that's now available via the official Code API for hints)

Based on `@SomeoneToIgnore's` branch, with a couple of updates:

 - I squashed, more or less successfully, the commits on that branch
 - downloading the `.d.ts` no longer works, but you can get it manually from https://raw.githubusercontent.com/microsoft/vscode/release/1.64/src/vscode-dts/vscode.proposed.inlayHints.d.ts
 - you might need to pass `--enable-proposed-api matklad.rust-analyzer`
 - if I'm reading the definition right, `InlayHintKind` needs to be serialized as a number, not string
 - this doesn't work anyway -- the client-side gets the hints, but they don't display

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-03-07 16:49:12 +00:00
Laurențiu Nicola
88a2141b77 Add inlayHints cap 2022-03-07 18:48:27 +02:00
Laurențiu Nicola
26d2e88b04 Fix parameter hint position 2022-03-07 15:24:54 +02:00
Laurențiu Nicola
b9d74fe2ed Update LSP docs 2022-03-07 15:09:31 +02:00
Lukas Wirth
93b09ca067 Update tidy ignore list 2022-03-06 19:18:40 +01:00