Commit Graph

21519 Commits

Author SHA1 Message Date
bors[bot]
f6bf7a3e41
Merge #11886
11886: add test for postfix completion relevance r=matklad a=matklad

Follow up to #11857, add a test and cov-marks

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2022-04-03 11:13:46 +00:00
Aleksey Kladov
a8f460209d add test for postfix completion relevance
Follow up to #11857, add a test and cov-marks
2022-04-03 12:13:26 +01:00
bors[bot]
40cba42e47
Merge #11821
11821: minor: Bump npm deps r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-04-03 07:14:14 +00:00
bors[bot]
4204e35563
Merge #11879
11879: Suggest infered type in auto complete r=HKalbasi a=HKalbasi

fix #11855

It doesn't work for return types and consts (so their tests are failing) because I can't find their body node in the original file. (Are these original and fake file documented somewhere?)

Also it currently needs to type first character of the type (or manual ctrl+space) to open the auto complete panel, is it possible to open it automatically on typing `:` and `->`?


Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2022-04-03 07:05:41 +00:00
Laurențiu Nicola
a7e83418d5 Load @hpcc-js/wasm as a script, not worker 2022-04-03 10:05:39 +03:00
hkalbasi
003a6b74e4 suggest infered type in auto complete 2022-04-03 11:17:33 +04:30
bors[bot]
ba9aed19c7
Merge #11877
11877: fix: splitting path of a glob import wrongly adds `self` r=Veykril a=iDawer

Close  #11703 

`ast::UseTree::split_prefix` handles globs now.
Removed an extra branch for globs in `ide_db::imports::merge_imports::recursive_merge` (superseeded by split_prefix).

Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2022-04-02 22:12:59 +00:00
bors[bot]
d312b4519a
Merge #11882
11882: internal: Record outline child modules with missing backing file in def map r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-04-02 14:19:38 +00:00
Lukas Wirth
1da2d82f58 internal: outline child modules with missing backing file 2022-04-02 16:17:54 +02:00
bors[bot]
0ff3d568ac
Merge #11881
11881: fix: Don't rely on lang items to find primitive impls r=flodiebold a=flodiebold

rustc has removed the use of lang items to mark the primitive impls, so just look through the crate graph for them (this should be fine performance-wise since we cache the crates that contain these impls).

Fixes #11876.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-04-02 13:40:08 +00:00
Florian Diebold
b898808a35 fix: Don't rely on lang items to find primitive impls
rustc has removed the use of lang items to mark the primitive impls, so
just look through the crate graph for them (this should be fine
performance-wise since we cache the crates that contain these impls).

Fixes #11876.
2022-04-02 15:32:40 +02:00
bors[bot]
5fe366c649
Merge #11878
11878: fix: Paper over GAT panic r=flodiebold a=flodiebold

TIL that Chalk expects the arguments to a generic associated type to come *before* the ones for the parent trait, not *after* as we have been doing with all other nested generics. Fixing this requires a larger refactoring, so for now this just papers over the problem by completely ignoring parameters of associated types.

Fixes #11769.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-04-02 12:41:14 +00:00
Florian Diebold
019f48673a fix: Paper over GAT panic
TIL that Chalk expects the arguments to a generic associated type to
come *before* the ones for the parent trait, not *after* as we have been
doing with all other nested generics. Fixing this requires a larger
refactoring, so for now this just papers over the problem by completely
ignoring parameters of associated types.

Fixes #11769.
2022-04-02 13:14:42 +02:00
iDawer
c8c21aabff fix: merge_imports::recursive_merge exiting early 2022-04-02 14:18:42 +05:00
bors[bot]
0fe74175e2
Merge #11875
11875: internal: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-04-01 23:43:28 +00:00
Lukas Wirth
f610e2c2ed Simplify completion import insertion 2022-04-02 01:42:21 +02:00
Lukas Wirth
28251e486c Cleanup relevance scoring 2022-04-02 01:19:33 +02:00
bors[bot]
a9ae0b0855
Merge #11857
11857: Lower postfix suggestions in completions list r=Veykril a=avrong

Fixes #11850

Adds a parameter for postfix suggestions in `CompletionRelevance`, and basing on it, decreases relevance score of such items in completion list

Co-authored-by: Aleksei Trifonov <avrong@avrong.me>
2022-04-01 21:42:54 +00:00
bors[bot]
0e02522b1b
Merge #11874
11874: minor: enum variant wording r=Veykril a=jakevossen5

As discussed on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/generate.20_.20for.20.22an.20enum.20variant.22



Co-authored-by: Jake Vossen <jake@vossen.dev>
2022-04-01 21:30:32 +00:00
Jake Vossen
93a8fcf7a8 enum variant wording 2022-04-01 14:22:49 -06:00
Aleksei Trifonov
eda4046a05 Introduce postfix item types 2022-04-01 20:50:27 +03:00
bors[bot]
ce8e028e9b
Merge #11872
11872: internal: Remove `PathResolution::AssocItem` r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-04-01 17:12:44 +00:00
Lukas Wirth
c290e68ff9 internal: Remove PathResolution::AssocItem 2022-04-01 18:32:05 +02:00
bors[bot]
ee84622c92
Merge #11796
11796: minor: Remove sponsors from readme files r=Veykril a=Veykril

No need to merge this now though

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-04-01 15:51:29 +00:00
bors[bot]
f8a21e4c70
Merge #11870
11870: Recover from missing type annotation r=Veykril a=HKalbasi

We were missing the init expression in case of `let x: = 2`, which breaks type inference of that variable (previously x were `{unknown}`, now it is `i32`).


Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2022-04-01 15:33:01 +00:00
bors[bot]
b337a49d21
Merge #11871
11871: internal: Move `rust.ungram` into `rust-analyzer/crates/syntax` r=Veykril a=Veykril

This makes updating the grammar a lot simpler for us. Though removing it from ungrammar can't be done without bumping it to 2.0 so I'll leave it in there for the time being.
cc https://github.com/rust-analyzer/ungrammar/pull/47

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-04-01 15:17:03 +00:00
Lukas Wirth
0d1d1dc3d9 internal: Move rust.ungram into rust-analyzer/crates/syntax 2022-04-01 17:12:33 +02:00
iDawer
b4c608896c fix: splitting path of a glob import wrongly adds self
`ast::UseTree::split_prefix` handles globs now.
Removed an extra branch for globs in `ide_db::imports::merge_imports::recursive_merge` (superseeded by split_prefix).
2022-04-01 19:12:50 +05:00
hkalbasi
049f0a6d2c recover from missing type annotation 2022-04-01 17:20:54 +04:30
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
bors[bot]
244ee65bbe
Merge #11867
11867: create generate is, as, try_into group r=Veykril a=jakevossen5

Fixes #11636 

In `generate_enum_projection_method.rs`, the changes to the function are from `cargo fmt`, I made the same change as I did in `generate_enum_is_method.rs`.

Co-authored-by: Jake Vossen <jake@vossen.dev>
2022-04-01 10:18:15 +00:00
Jake Vossen
bccf013010 create generate is, as, try_into group 2022-03-31 21:22:08 -06: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 Bushart
c039810b16 Fix: Select correct insert position for disabled group import
The logic for importing with and without `group_imports` differed
significantly when no previous group existed. This lead to the problem
of using the wrong position when importing inside a module (#11585) or
when inner attributes are involved.
The existing code for grouped imports is better and takes these things
into account.

This PR changes the flow to use the pre-existing code for adding a new
import group even for the non-grouped import settings.
Some coverage markers are updated and the `group` is removed, since they
are now invoked in both cases (grouping and no grouping).

Tests are updated and two tests (empty module and inner attribute) are
added.

Fixes #11585
2022-03-31 18:15:01 +00:00
bors[bot]
a1d684e951
Merge #11863
11863: fix: allow varargs in any param position r=jonas-schievink a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/3578 and aligns us with the Rust reference.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-03-31 14:04:38 +00:00
Jonas Schievink
42ecf406e8 Remove parser restriction on varargs positioning 2022-03-31 16:03:27 +02:00
bors[bot]
9b000b544b
Merge #11827
11827: internal: Enforce Invariant that Resolver always contains a ModuleScope r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-31 13:01:10 +00:00
bors[bot]
9da9418661
Merge #11861
11861: internal: Add "view file text" command to debug sync issues r=jonas-schievink a=jonas-schievink

I saw a file sync bug the other day but didn't know how to further debug it. This command might give a clue as to what's wrong and help debug issues like https://github.com/rust-analyzer/rust-analyzer/issues/4829.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-03-31 12:52:11 +00:00
Jonas Schievink
ec2d023383 Add "view file text" command to debug sync issues 2022-03-31 14:50:33 +02:00
Lukas Wirth
75689f2ad8 internal: Enforce Resolver to always have a module scope 2022-03-31 11:12:08 +02:00
Aleksei Trifonov
41d8369d1c Fix formatting 2022-03-31 02:59:15 +03:00
Aleksei Trifonov
0d1f4f9b27 Lower postfix suggestions in completions list 2022-03-31 02:27:33 +03:00
Lukas Wirth
ef92453dfe internal: Refactor FamousDefs builtin crate search 2022-03-30 22:23:54 +02:00
bors[bot]
259182b50b
Merge #11852
11852: Type mismatch when last expression is noreturn asm r=lnicola a=weirdsmiley

When last expression in a function body is noreturn asm, then analyzer
complains about the type mismatch by highlighting entire body. This
fixes it by introducing loop {} in the expanded code.

Fixes: [#11820](https://github.com/rust-analyzer/rust-analyzer/issues/11820)

Co-authored-by: Manas <manas18244@iiitd.ac.in>
2022-03-30 13:48:50 +00:00
Manas
1be8b2ff98 Type mismatch when last expression is noreturn asm
When last expression in a function body is noreturn asm, then analyzer
complains about the type mismatch by highlighting entire body. This
fixes it by introducing loop {} in the expanded code.
2022-03-30 19:07:02 +05:30
bors[bot]
c8d0a90145
Merge #11849
11849: docs(auto_import): change by_self -> self and by_crate -> crate r=Veykril a=gibfahn



---

#### Commits _(oldest to newest)_

6b38c2d75 docs(auto_import): change by_self -> self and by_crate -> crate

Keep things consistent with the package.json , which uses `self` and
`crate` instead of `by_self` and `by_crate`. Both names are in fact
allowed as aliases, but we should be consistent so that people reading
the docs and using a schema do not see red squiggles.

<br/>

Co-authored-by: Gibson Fahnestock <gibfahn@gmail.com>
2022-03-30 11:52:50 +00:00
Gibson Fahnestock
6b38c2d75e
docs(auto_import): change by_self -> self and by_crate -> crate
Keep things consistent with the package.json , which uses `self` and
`crate` instead of `by_self` and `by_crate`. Both names are in fact
allowed as aliases, but we should be consistent so that people reading
the docs and using a schema do not see red squiggles.
2022-03-30 12:33:07 +01:00
bors[bot]
63c4d6b20d
Merge #11844
11844: Fix divergence detection for bare match arms r=flodiebold a=flodiebold

Fixes #11814 and #11837.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-03-29 19:58:14 +00:00