Commit Graph

13934 Commits

Author SHA1 Message Date
Aleksey Kladov
726da9884b avoid speculation when completing macros 2021-12-28 16:52:15 +03:00
Aleksey Kladov
42ff46c1e8 minor 2021-12-27 21:45:42 +03:00
Aleksey Kladov
8e9734e18f fix line endings 2021-12-26 18:46:21 +03:00
Aleksey Kladov
b360ea91f2 internal: move inline parser tests to parser crate 2021-12-26 18:19:09 +03:00
Aleksey Kladov
0f74758fea internal: move outlined parser tests 2021-12-26 17:58:33 +03:00
Aleksey Kladov
f4cb0ff9be internal: move ws attachment logic to the parser crate
This has to re-introduce the `sink` pattern, because doing this purely
with iterators is awkward :( Maaaybe the event vector was a false start?

But, anyway, I like the current factoring more -- it sort-of obvious
that we do want to keep ws-attachment business in the parser, and that
we also don't want that to depend on the particular tree structure. I
think `shortcuts` module achieves that.
2021-12-26 16:47:10 +03:00
Aleksey Kladov
f692fafee8 rename 2021-12-25 22:03:57 +03:00
Aleksey Kladov
74de79b1da internal: rename 2021-12-25 22:02:26 +03:00
Aleksey Kladov
d0d05075ed internal: replace TreeSink with a data structure
The general theme of this is to make parser a better independent
library.

The specific thing we do here is replacing callback based TreeSink with
a data structure. That is, rather than calling user-provided tree
construction methods, the parser now spits out a very bare-bones tree,
effectively a log of a DFS traversal.

This makes the parser usable without any *specifc* tree sink, and allows
us to, eg, move tests into this crate.

Now, it's also true that this is a distinction without a difference, as
the old and the new interface are equivalent in expressiveness. Still,
this new thing seems somewhat simpler. But yeah, I admit I don't have a
suuper strong motivation here, just a hunch that this is better.
2021-12-25 22:02:26 +03:00
hkalbasi
e6139cf47b show values of constants in hover 2021-12-23 17:53:46 +03:30
bors[bot]
578269e613
Merge #11093
11093: fix: Do not complete `Drop::drop`, complete `std::mem::drop` instead r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/5005
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-22 01:48:31 +00:00
Lukas Wirth
85ed5a3182 Make hover test not relient on minicore structure 2021-12-22 02:36:31 +01:00
Lukas Wirth
5360c9bd22 fix: Do not complete Drop::drop, complete std::mem::drop instead 2021-12-22 02:25:38 +01:00
bors[bot]
d4c5bf7828
Merge #11092
11092: internal: Directly use self param in completions instead of searching r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-21 23:20:16 +00:00
Lukas Wirth
276687a6ee internal: Directly use self param in completions instead of searching 2021-12-22 00:18:39 +01:00
bors[bot]
47fad0ed73
Merge #11071 #11090
11071: feat: Build and publish pre-release Code extension versions r=matklad a=lnicola

Closes #11026

11090: internal: Deduplicate lower ctx hygiene field r=Veykril a=Veykril

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-21 17:37:56 +00:00
Lukas Wirth
e76e0e843d Simplify 2021-12-21 18:28:04 +01:00
Lukas Wirth
0b1c434d53 Deduplicate lower ctx hygiene field 2021-12-21 18:27:54 +01:00
Lukas Wirth
60dfe8ceed Replace a few String instances with SmolStr in completions 2021-12-21 16:57:16 +01:00
Lukas Wirth
7f7a3644b3 Fully render type alias completions from hir 2021-12-21 16:36:23 +01:00
Lukas Wirth
40d5c58a80 Fully render const item completions from hir 2021-12-21 16:35:51 +01:00
Lukas Wirth
929cae74b1 fmt +stable 2021-12-21 15:48:12 +01:00
Lukas Wirth
95ae67b0b0 Simplify type alias rendering, remove constructor structs 2021-12-21 15:37:43 +01:00
Lukas Wirth
97f7865c56 Simplify macro rendering, remove constructor structs 2021-12-21 15:20:15 +01:00
Lukas Wirth
2b60d80eaf Simplify const rendering, remove constructor structs 2021-12-21 15:04:19 +01:00
Lukas Wirth
e99ed3e407 Simplify enum variant rendering, remove constructor structs 2021-12-21 15:01:52 +01:00
Lukas Wirth
a720fc8e3a Simplify function rendering, remove constructor structs 2021-12-21 14:51:06 +01:00
Lukas Wirth
22b2c2fdf7 Simplify 2021-12-21 14:07:48 +01:00
Lukas Wirth
539b0c2582 fix: Fix inline local assist not working in let stmt initializer 2021-12-21 14:03:59 +01:00
Lukas Wirth
8e084132f8 internal: Do less work in hir::Semantics 2021-12-21 13:38:58 +01:00
Laurențiu Nicola
01143c6600 Fix typo in reformat number assist label 2021-12-21 09:45:20 +02:00
bors[bot]
851af5a52b
Merge #11074
11074: Bump default CHALK_SOLVER_MAX_SIZE to 150 r=lnicola a=lnicola

Fixes #11072

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-20 18:38:47 +00:00
Laurențiu Nicola
3f3aee53b4 Bump default CHALK_SOLVER_MAX_SIZE to 150 2021-12-20 20:35:45 +02:00
bors[bot]
c5722a66c5
Merge #11073
11073: fix: Fix windows not finding the pdb file r=lnicola a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-20 18:20:08 +00:00
Lukas Wirth
4a5c8c6ad2 fix: Fix windows not finding the pdb file 2021-12-20 19:17:31 +01:00
bors[bot]
d3aa2579cc
Merge #11069
11069: fix: Partially fix `ide_db::search` for crate roots r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10007
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-20 16:50:35 +00:00
Lukas Wirth
5206946674 fix: Partially fix ide_db::search for crate roots 2021-12-20 17:48:47 +01:00
bors[bot]
8dc3a270f6
Merge #11067
11067: internal: Store function param names in ItemTree r=Veykril a=Veykril

This prevents us reparsing source files for completions, sometimes slowing them down massively if the source file is not cached at the expense of a slightly bigger memory usage.

related info https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Completion.20performance

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-20 14:43:39 +00:00
Lukas Wirth
8eb7ee9099 Update test output 2021-12-20 15:43:15 +01:00
Lukas Wirth
cd9d76e0ca internal: Store function param names in ItemTree 2021-12-20 15:24:37 +01:00
bors[bot]
f46731a230
Merge #11028
11028: Bump MSRV (1.57) r=Veykril a=iDawer

This bumps MSRV on all crates to 1.57 except `la-arena`

#10986 requires >=1.57 

Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2021-12-20 13:45:35 +00:00
Lukas Wirth
f609efff87 Simplify 2021-12-20 14:38:22 +01:00
bors[bot]
14ff3d7e5f
Merge #11065
11065: internal: Don't kick off inference in `Semantics::descend_into_macros_impl` r=Veykril a=Veykril

We do not need inference info here so there is no point in calculating it
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-20 12:49:48 +00:00
Lukas Wirth
a574434c3f Simplify NameClass::classify 2021-12-20 13:47:06 +01:00
Lukas Wirth
37a87708ae internal: Don't kick off inference in Semantics::descend_into_macros_impl 2021-12-20 13:19:48 +01:00
bors[bot]
48d6cef436
Merge #10484
10484: internal: Update match checking algorithm r=lnicola a=iDawer

Sync match checking algorithm with rust-lang/rust f31622a50 2021-11-12 (https://github.com/rust-lang/rust/pull/90813)

This update brings huge simplification to the match checking and introduces an easy to use machinery for pattern destructuring and also:

1. Add a function to do post-inference normalization `hir_ty::infer::normalize(...)`.
2. Store binding modes in `InferenceResult`.

Todo:

- [x] Rebase & test (https://github.com/rust-analyzer/rust-analyzer/pull/10484#issuecomment-996669665)

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2021-12-20 12:05:23 +00:00
bors[bot]
2ca3834c9f
Merge #11062
11062: fix: Don't say "a reference to" for `Copy` types in the generate getter assist r=Veykril a=patrick-gu

This changes the generate getter assist to not say "a reference to" in the documentation stub if the type is `Copy`, as the getter does not return a reference.

To determine whether the type is `Copy`, I have added an `is_copy` method to `ReferenceConversion`.

Co-authored-by: patrick-gu <55641350+patrick-gu@users.noreply.github.com>
2021-12-20 09:14:38 +00:00
patrick-gu
76b50f14f7 Don't say "a reference to" for Copy types
This changes the generate getter assist to not say "a reference to" in the documentation stub if the type is Copy, as the getter does not return a reference.
2021-12-19 17:28:31 -08:00
iDawer
a9ad7be748 Respect binding mode of a binding pattern for exhaustiveness check 2021-12-20 00:14:39 +05:00
iDawer
b17aefb83a internal: Normalize field type after substituting 2021-12-20 00:14:39 +05:00