Commit graph

21201 commits

Author SHA1 Message Date
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
bors[bot]
f8329ba987
Merge #11140
11140: Preserve order of generic args r=HKalbasi a=HKalbasi

https://github.com/rust-lang/rust/pull/90207 removed order restriction of generic args, i.e. const generics can now become before of type generics. We need to preserve this order to analyze correctly, and this PR does that.

It also simplifies implementation of const generics a bit IMO.

Implementing default generics the same problem of #7434, we need lower them to body and then evaluate them.


Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2022-03-04 12:55:07 +00:00
hkalbasi
660fd4ab41 Resolve only type params in type ns 2022-03-04 12:30:53 +03:30
hkalbasi
4fa8749c44 Preserve order of generic args 2022-03-04 11:46:14 +03:30
Laurențiu Nicola
4b16b9b74b Fix formatting 2022-03-04 08:15:17 +02:00
Laurențiu Nicola
9d43291533 Drop hint conversion 2022-03-04 08:08:59 +02:00
Laurențiu Nicola
8454358ba4 Bump vscode 2022-03-04 08:08:59 +02:00
Kirill Bulatov
5de5e450cb Remove debugging leftovers 2022-03-04 08:08:59 +02:00
Kirill Bulatov
b1d8dae930 Load hints for part of the file only 2022-03-04 07:45:51 +02:00
Kirill Bulatov
9c0c199e96 Clean up the redundant hints code and config 2022-03-04 07:45:51 +02:00
Laurențiu Nicola
0b69717ab6 Fixes 2022-03-04 07:45:51 +02:00
Laurențiu Nicola
5a49dbd2e0 Update inlay hints for upstream 2022-03-04 07:45:51 +02:00
Laurențiu Nicola
2ae8248cee Add log messages 2022-03-04 07:45:51 +02:00
Laurențiu Nicola
0f396d670b Bump deps 2022-03-04 07:45:51 +02:00
Kirill Bulatov
55371be807 Add experimental VSCode api 2022-03-04 07:45:51 +02:00
Tianyi Song
89a19f57f8 Lower string literals with real val, not default 2022-03-04 10:16:35 +08:00
bors[bot]
9d473a0b9f
Merge #11616
11616: fix: Fix semantic highlighting breaking for lifetimes in macros r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-03 22:25:42 +00:00