Commit Graph

21167 Commits

Author SHA1 Message Date
Laurențiu Nicola
4a6ee4517a Add back colons around inlay hints 2022-03-08 12:01:02 +02:00
bors[bot]
0f5df8e177
Merge #11656
11656: Fix package.json key replacement r=lnicola a=lnicola

CC #11653

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-03-08 06:34:49 +00:00
Laurențiu Nicola
a87e67360c Fix package.json replacement 2022-03-08 08:34:03 +02:00
bors[bot]
722cc0039f
Merge #11653
11653: fix: client distribution string replacement looking for wrong key r=Veykril a=Veykril

cc https://github.com/rust-analyzer/rust-analyzer/pull/11445
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-08 01:33:18 +00:00
Lukas Wirth
d425c5b534 fix: client distribution string replacement looking for wrong key 2022-03-08 02:32:35 +01:00
bors[bot]
3f4a095d3e
Merge #11647
11647: Improve inlay hint padding r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-03-07 17:19:43 +00: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
97109d73f8 Add missing parameter 2022-03-07 15:42:20 +02:00
Laurențiu Nicola
26d2e88b04 Fix parameter hint position 2022-03-07 15:24:54 +02:00
Laurențiu Nicola
04128de553 Bump esbuild 2022-03-07 15:24:42 +02:00
Laurențiu Nicola
b9d74fe2ed Update LSP docs 2022-03-07 15:09:31 +02:00
bors[bot]
18d0faf027
Merge #11645
11645: Update manual.adoc r=lnicola a=vi

Resolves #11507

Co-authored-by: Vitaly Shukela <vi0oss@gmail.com>
2022-03-07 11:24:52 +00:00
Vitaly Shukela
6e62d93c95
Update manual.adoc
Resolves #11507
2022-03-07 14:22:07 +03:00
bors[bot]
31ad347b0e
Merge #11644
11644: Emit more detailed highlighting for `%`, `>>`, `<<` r=Veykril a=arzg

These are currently just given `operator`, when `%` can be grouped under `arithmetic`, and `>>` and `<<` can be grouped under `bitwise`.

Co-authored-by: Luna Razzaghipour <aramisnoah@gmail.com>
2022-03-07 10:05:31 +00:00
Luna Razzaghipour
6da1228898
Emit more detailed highlighting for %, >>, << 2022-03-07 20:16:03 +11:00
bors[bot]
5fae65dd28
Merge #11639
11639: internal: Re-arrange ide_db modules r=Veykril a=Veykril

Thins out the `helpers` module by giving some items more appropriate places to live
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-06 18:31:30 +00:00
Lukas Wirth
93b09ca067 Update tidy ignore list 2022-03-06 19:18:40 +01:00
Lukas Wirth
ab21cf2f4f internal: Re-arrange ide_db modules 2022-03-06 19:04:04 +01:00
bors[bot]
b9538122f2
Merge #11637
11637: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-06 16:56:29 +00:00
Lukas Wirth
c1f91c93b2 minor: Simplify 2022-03-06 17:56:02 +01:00
bors[bot]
5b9e46b960
Merge #11633
11633: Automatically change text color in logo based on dark mode r=Veykril a=arzg

Currently the black text in the logo in the README just has a white stroke so it’s readable in dark mode. This PR adds automatic detection of whether the user is using system dark mode, and if they are changes the text colour to white and removes the stroke.

Before:

<img width="910" alt="Screen Shot 2022-03-06 at 10 54 35 pm" src="https://user-images.githubusercontent.com/31783266/156921920-7ac88aa4-bab6-44c2-be37-30338a2d9ec9.png">

After (now in Chrome because this doesn’t seem to work in Safari):

<img width="822" alt="Screen Shot 2022-03-06 at 11 10 12 pm" src="https://user-images.githubusercontent.com/31783266/156922615-41fe63e0-7901-4cb1-a229-6d37b6e4369a.png">
<img width="820" alt="Screen Shot 2022-03-06 at 11 10 25 pm" src="https://user-images.githubusercontent.com/31783266/156922619-1bdd5b9c-89ac-4fe1-bf17-1a1ac4ead805.png">

Co-authored-by: Luna Razzaghipour <aramisnoah@gmail.com>
2022-03-06 12:22:35 +00:00
Luna Razzaghipour
710948efa7
Automatically change text color in logo based on dark mode 2022-03-06 23:06:53 +11:00
bors[bot]
2eb312a444
Merge #11632
11632: Bring back syntax highlighting in test data r=matklad a=matklad

cc #11597

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2022-03-06 08:44:54 +00:00
Aleksey Kladov
cf70ed5eac Bring back syntax highlighting in test data
cc #11597
2022-03-06 08:43:18 +00:00
bors[bot]
fc350ead05
Merge #11631
11631: internal: Refactor syntax_highlighting r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-06 03:19:54 +00:00
Lukas Wirth
97076c074d internal: Simplify and optimize syntax_highlighting 2022-03-06 03:49:54 +01:00
bors[bot]
96c11f5fd6
Merge #11630
11630: fix: Recognize `Self` as a proper keyword r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-05 23:48:54 +00:00
Lukas Wirth
e8edbb5d6f Add a macro case for the keyword highlighting test fixture 2022-03-06 00:26:15 +01:00
Lukas Wirth
d460b7c9d1 Fix extern crate self having self unresolved 2022-03-06 00:17:40 +01:00
Lukas Wirth
e5bb661b7a Highlight Self as a keyword by default 2022-03-06 00:13:45 +01:00
Lukas Wirth
0bb631bf71 Simplify 2022-03-05 23:53:24 +01:00
Lukas Wirth
b454f11f38 Fix hover for Self keyword 2022-03-05 23:47:44 +01:00
bors[bot]
b032993733
Merge #11629
11629: fix: Fix macro-calls expanding to items in if/while conditions r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-05 22:34:59 +00:00
Lukas Wirth
5c0aee013e Fix highlighting of Self 2022-03-05 23:34:37 +01:00
Lukas Wirth
a148c49f1c Fix test fixture 2022-03-05 23:21:20 +01:00
Lukas Wirth
c0d6471143 fix: Recognize Self as a proper keyword 2022-03-05 23:20:06 +01:00
Lukas Wirth
a548958cdf fix macro-calls always expanding to expressions in LetStmt 2022-03-05 22:04:06 +01:00
Lukas Wirth
bb47c5f56c fix: Fix macro-calls expanding to items in if/while conditions 2022-03-05 21:58:51 +01:00
bors[bot]
8f504dc873
Merge #11598
11598: feat: Parse destructuring assignment r=Veykril a=ChayimFriedman2

Part of #11532.

Lowering is not as easy and may not even be feasible right now as it requires generating identifiers: `(a, b) = (b, a)` is desugared into
```rust
{
    let (<gensym_a>, <gensym_b>) = (b, a);
    a = <gensym_a>;
    b = <gensym_b>;
}
```

rustc uses hygiene to implement that, but we don't support hygiene yet.

However, I think parsing was the main problem as lowering will just affect type inference, and while `{unknown}` is not nice it's much better than a syntax error.

I'm still looking for the best way to do lowering, though.

Fixes #11454.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2022-03-05 11:31:29 +00:00
bors[bot]
e844b1570a
Merge #11574
11574: Small refactor text edit 2nd r=Veykril a=HansAuger

Some more changes to text_edit. Basic idea is to make `Indel` implement `PartialOrd` to take advantage of some sweet sweet iteration, most notably itertool's `merge`.



Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2022-03-05 11:20:05 +00:00
bors[bot]
79a7ba0bdf
Merge #11623
11623: fix: Add type variable table to InferenceTableSnapshot r=flodiebold a=tysg

Fixes #11601. 

I observed that removing the `rollback` line in 6fc3d3aa4c fixes the issue.  

Looking at the stacktrace, I believe not restoring `type_variable_table` causes `type_variable_table` and `var_unification_table` to go out of sync, then when `hir_ty::infer::unify::InferenceTable::new_var` tries to extend `type_variable_table` to be the same length as `var_unification_table`, problems will arise.

However, I cannot pinpoint exactly how or where the vector capacity overflow happens, so my understanding might not be correct after all. 

Co-authored-by: Tianyi Song <42670338+tysg@users.noreply.github.com>
2022-03-05 10:32:07 +00:00
Tianyi Song
c49bcc7814 Add type variable table to InferenceTableSnapshot 2022-03-05 17:59:28 +08:00
bors[bot]
f1f9163b27
Merge #11622
11622: show variadic args in hover function signature r=Veykril a=euclio

The current behavior is to ignore the ellipsis.

Co-authored-by: Andy Russell <arussell123@gmail.com>
2022-03-04 23:20:29 +00:00
Andy Russell
49fab593ad
show variadic args in hover function signature 2022-03-04 16:44:31 -05:00
bors[bot]
908c17bfa6
Merge #11595
11595: fix: lower string literals with actual value instead of default r=lnicola a=tysg

Fixes #11582. Some questions below in the code review section.

Co-authored-by: Tianyi Song <42670338+tysg@users.noreply.github.com>
2022-03-04 20:21:43 +00:00
bors[bot]
a474535e44
Merge #11620
11620: feat: Support locals with multiple declaration sites r=Veykril a=Veykril

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

This implements the first approach of https://github.com/rust-analyzer/rust-analyzer/issues/8860#issuecomment-845461773:
> treat every Local as having potentially many sources?

The way this is written does allow changing to a MultiLocal approach instead though, I'll investigate whether that turns out to be better or not.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-04 19:47:39 +00:00
Lukas Wirth
4a866fc672 Simplify 2022-03-04 20:23:25 +01:00
Lukas Wirth
32bf7af83e Support locals with multiple declaration sites 2022-03-04 19:49:08 +01:00