Commit graph

21492 commits

Author SHA1 Message Date
Bogdan Mircea
4382331a36 project-model: fix JSON project PackageRoot buildfile inclusion 2025-01-07 13:47:17 +02:00
Vishruth-Thimmaiah
cb0221d774
fix: do not offer completions within macro strings 2025-01-07 17:02:28 +05:30
Alex Kirszenberg
fe54502f11 lint 2025-01-07 12:07:37 +01:00
Alex Kirszenberg
f2b789c36e fix: Fix diagnostics not clearing between flychecks 2025-01-07 11:11:04 +01:00
Laurențiu Nicola
cd12ef8547
Merge pull request #18853 from ChayimFriedman2/no-completion
Fix case where completion inside macro that expands to `#[test]` was unavailable
2025-01-07 06:44:50 +00:00
David Barsky
140f91b045 fix: clear diagnostics on cancel unconditionally, fixing #18854 2025-01-06 18:41:21 -05:00
Giga Bowser
54d9b5a31a internal: Migrate if let <=> match assists to SyntaxEditor 2025-01-06 15:58:39 -06:00
Giga Bowser
eb2ce57a3e internal: Migrate replace_let_with_if_let assist to SyntaxEditor 2025-01-06 15:58:39 -06:00
Giga Bowser
796041acce internal: Add some pattern constructors to SyntaxFactory 2025-01-06 15:58:39 -06:00
Giga Bowser
ce2398fee8 internal: Add some expr constructors to SyntaxFactory 2025-01-06 15:58:39 -06:00
Giga Bowser
f5ff966dea internal: Add some path constructors to SyntaxFactory 2025-01-06 15:58:39 -06:00
Giga Bowser
551f1d00dd internal: make::expr_match should return ast::MatchExpr 2025-01-06 15:58:39 -06:00
Giga Bowser
32ff06d51c internal: Generally improve make::match_arm
`make::match_arm` should take a single `ast::Pat`, and callers can handle creating an `ast::OrPat` if need be. It should also take a proper `ast::MatchGuard`, instead of making one itself.
2025-01-06 15:58:39 -06:00
Giga Bowser
905e1e1fc0 internal: move make::expr_unit to make::ext::expr_unit
`expr_unit` is just a shortcut for a common expression, so it belongs in `make::ext`
2025-01-06 15:58:39 -06:00
Giga Bowser
f388482119 internal: make::expr_tuple should return ast::TupleExpr 2025-01-06 15:32:08 -06:00
Giga Bowser
c549be9ab6 internal: make::expr_if should return ast::IfExpr 2025-01-06 15:32:08 -06:00
Giga Bowser
913d197a04 internal: make::expr_prefix should return ast::PrefixExpr 2025-01-06 15:32:08 -06:00
Giga Bowser
159731022f internal: Generalize make::expr_from_text to types which implement Into<ast::Expr>
This will help with specializing the various `make::expr_*` functions later
2025-01-06 15:32:08 -06:00
Chayim Refael Friedman
b24142b50b Fix case where completion inside macro that expands to #[test] was unavailable
We ignore `#[test]` in the def map, so that's why it failed.
2025-01-06 22:02:24 +02:00
Laurențiu Nicola
bfb81275fb
Merge pull request #18852 from ChayimFriedman2/proc-macro-panic
fix: Fix a bug that was caused by fixup reversing
2025-01-06 18:38:24 +00:00
Chayim Refael Friedman
f7c4833830 Fix a bug that was caused by fixup reversing 2025-01-06 20:06:20 +02:00
Lukas Wirth
72b9427162
Merge pull request #18846 from Veykril/push-kmspklwynynu
minor: New clippy lints
2025-01-06 17:12:14 +00:00
Lukas Wirth
4b6007115a minor: New clippy lints 2025-01-06 17:57:17 +01:00
Lukas Wirth
dd73ff4ee4 fix: Fix non-cargo flychecks immediately clearing received diagnostics 2025-01-06 13:44:30 +01:00
Lukas Wirth
47ee513fa4
Merge pull request #18836 from Veykril/push-kksuoxxptvty
fix: Be more permissive with completion resolve data
2025-01-06 10:37:01 +00:00
Lukas Wirth
8a9cacb22d fix: Be more permissive with completion resolve data 2025-01-06 11:22:42 +01:00
Lukas Wirth
c89c03fd5a
Merge pull request #18845 from Veykril/push-yyuolqomnkys
fix: Fix flycheck getting confused which package to check
2025-01-06 10:21:26 +00:00
Lukas Wirth
e4bf6e1bc3 fix: Fix flycheck getting confused which package to check 2025-01-06 11:05:51 +01:00
Lukas Wirth
5769685199
Merge pull request #18843 from Veykril/push-usuzxtzsnrpt
fix: Handle newstyle `rustc_intrinsic` safety correctly
2025-01-06 09:00:32 +00:00
Lukas Wirth
e462ee79e4 fix: Handle newstyle rustc_intrinsic safety correctly 2025-01-06 09:47:31 +01:00
Lukas Wirth
cf2bfd427a fix: Fix relative .cargo env vars not working 2025-01-06 08:50:41 +01:00
Chayim Refael Friedman
ce323627c5 Support the new CoercePointee derive 2025-01-04 18:35:53 +02:00
Lukas Wirth
061d257e90
Merge pull request #18835 from Veykril/push-wnmwwoktmpyt
Hide synthetic locals from completions
2025-01-04 16:03:00 +00:00
Lukas Wirth
bf7597cd5a Hide synthetic locals from completions 2025-01-04 16:48:08 +01:00
Lukas Wirth
a440fcb698
Merge pull request #18806 from LHolten/deduplicate-crate-graph
fix: Deduplicate crate graph
2025-01-03 14:56:14 +00:00
Lukas Wirth
fd2cb645b7
Merge pull request #18830 from alibektas/18814
fix: 18814
2025-01-03 13:52:09 +00:00
Ali Bektas
a0898b9698 fix: 18814 2025-01-03 14:36:40 +01:00
Laurențiu Nicola
c528b56b92
Merge pull request #18828 from lnicola/edition-description
minor: Add description field to edition manifest
2025-01-03 12:47:18 +00:00
Lukas Wirth
3d6300330d
Merge pull request #18827 from Veykril/push-zqsplmtwsxxk
minor: Honor `CARGO_TARGET_DIR` for cargo target dir config
2025-01-03 12:43:43 +00:00
Laurențiu Nicola
c8da114dfd Add description field to edition manifest 2025-01-03 14:32:35 +02:00
Lukas Wirth
7d203673f5 minor: Honor CARGO_TARGET_DIR for cargo target dir config 2025-01-03 13:28:52 +01:00
Lukas Wirth
ce6053cbd6
Merge pull request #18826 from Veykril/push-qnsqormwlwqm
fix: Clear flycheck diagnostics per package properly
2025-01-03 12:26:33 +00:00
Lukas Wirth
6e5e44d0fd fix: Clear flycheck diagnostics per package properly 2025-01-03 13:12:05 +01:00
Lukas Wirth
b67de74de9
Merge pull request #18825 from Veykril/push-sllokkprznkq
minor: Encode TraitData bools as bitflags
2025-01-03 12:01:08 +00:00
Lukas Wirth
4d66fa797f minor: Encode TraitData bools as bitflags 2025-01-03 12:46:07 +01:00
Lukas Wirth
db55d9ade0
Merge pull request #18822 from bryceberger/targetdir-absolute
allow targetDir to be an absolute path
2025-01-03 11:33:57 +00:00
Lukas Wirth
b6910ed1b2
Merge pull request #18327 from ChayimFriedman2/flat-tt
Store token trees in contiguous `Vec` instead of as a tree
2025-01-03 11:31:58 +00:00
Bryce Berger
5c143aa65d
allow targetDir to be an absolute path 2025-01-02 15:51:54 -05:00
Chayim Refael Friedman
ceba289f80 Store token trees in contiguous Vec instead of as a tree
I expected this to be faster (due to less allocations and better cache locality), but benchmarked it is not (neither it is slower). Memory usage, however, drops by ~50mb (of `analysis-stats .`). I guess tt construction is just not hot.

This also simplifies using even less memory for token trees by compressing equal span, which I plan to do right after.

Some workflows are more easily expressed with a flat tt, while some are better expressed with a tree. With the right helpers, though (which was mostly a matter of trial and error), even the worst workflows become very easy indeed.
2025-01-02 19:21:46 +02:00
lucasholten
81153940be Remove rust-analyzer duplicate crates integration tests 2025-01-02 15:52:06 +01:00
lucasholten
cdc972499e Automatically sort crate graph 2025-01-02 15:50:51 +01:00
dfireBird
83fcdbf3f6
fix no space insert before and after if value is only spaces 2025-01-02 16:28:25 +05:30
Chayim Refael Friedman
bb400ca121 Fix overflow detection in MIR evaluation
With a bit of higher-order macros everything sorts out well.

And also fix a discovered bug when comparing long strings.
2025-01-02 11:51:12 +02:00
Lukas Wirth
189baf661e fix: Fix flycheck cancellations leaving stale errors 2025-01-02 09:36:54 +01:00
lucasholten
86441c5bb9 Fix tests 2025-01-01 16:42:29 +01:00
lucasholten
e12fe30351 Remove load_cargo_with_fake_sysroot 2025-01-01 16:24:21 +01:00
Lukas Wirth
7e639ee3dd
Merge pull request #18179 from ChayimFriedman2/omit-trait-completion
feat: Allow excluding specific traits from completion
2025-01-01 14:34:56 +00:00
Lukas Wirth
1adc805dfa Cleanup 2025-01-01 15:21:54 +01:00
Lukas Wirth
5303dc5d99 Revamp auto-import exclude config 2025-01-01 15:06:44 +01:00
Lukas Wirth
c5bda0d3f7 Simplify completion config path resolutions 2025-01-01 14:32:45 +01:00
Lukas Wirth
45954ebaa4 Reduce the default autoimport exclusion list 2025-01-01 14:32:45 +01:00
Lukas Wirth
e5950cd41d
Merge pull request #18809 from Veykril/push-ktwrzsmzlplw
internal: Do not render closure ids in hover messages
2025-01-01 12:55:37 +00:00
Chayim Refael Friedman
a02a1afc92 Allow flyimporting excluded trait items if there is an exact match in the name
I.e. with `fn foo()`, don't complete at `x.fo|`, but complete (with imports) for `x.foo|`, since this is less likely to have false positives.

I opted to only do that for flyimport, even though for basic imports there can also be snippet completion (completing the params list for a method), since this is less universally applicable and seems not so useful.
2025-01-01 13:54:23 +01:00
Chayim Refael Friedman
7e6ade117c Allow excluding specific traits from completion
To be accurate, only their methods are excluded, the trait themselves are still available.

I also excluded a bunch of std traits by default. Some less opinionated, like `AsRef`, which should never be used directly except in generic scenarios (and won't be excluded there), some more opinionated, like the ops traits, which I know some users sometimes want to use directly. Either way it's configurable.

It should be pretty easy to extend support to excluding only specific methods, but I didn't do that currently.

Traits configured to be excluded are resolved in each completion request from scratch. If this proves too expensive, it is easy enough to cache them in the DB.
2025-01-01 13:49:35 +01:00
Lukas Wirth
a612fc9a16
Merge pull request #18757 from roife/fix-17812
feat: support updating snapshot tests with codelens/hovering/runnables
2025-01-01 12:44:55 +00:00
Lukas Wirth
721e43e9d3 internal: Do not render closure ids in hover messages
They are not useful
2025-01-01 13:41:07 +01:00
Chayim Refael Friedman
085ad10794
Merge pull request #18797 from profetia/issue10583
Fix replace-if-let-with-match generates non-exhausive match
2024-12-31 15:40:55 +00:00
lucasholten
947dfdce0c Add back optimizations 2024-12-31 15:48:58 +01:00
lucasholten
e15df1f414 Add back tests removed in #18080 2024-12-31 15:48:58 +01:00
lucasholten
6043412342 Add back crate graph deduplication 2024-12-31 15:47:29 +01:00
lucasholten
c46e9c48b0 Remove CARGO_RUSTC_CURRENT_DIR 2024-12-31 15:47:29 +01:00
yanglsh
60c3fb12d3 Fix replace-if-let-with-match generates non-exhausive match 2024-12-31 07:40:45 -07:00
Lukas Wirth
4284637e64 Base relative cargo configs onto the manifest
This is not correct, but should be equivalent in most cases
2024-12-31 14:52:00 +01:00
Lukas Wirth
fd4635c99c fix: Populate cargo config env vars for crates 2024-12-31 14:32:35 +01:00
Lukas Wirth
c86dd17cb3
Merge pull request #18802 from roife/fix-18800
fix: incorrect file_id used for ranges in outgoing calls
2024-12-31 12:33:51 +00:00
Lukas Wirth
0e716dfdba
Merge pull request #18805 from Veykril/push-pzurvxvoolxs
internal: Implement `<RaSpanServer as SourceFile>::eq`
2024-12-31 12:15:38 +00:00
roife
a48bfa9213 fix: incorrect file_id used for ranges in outgoing calls 2024-12-31 20:10:22 +08:00
Lukas Wirth
6b56af7688 Implement <RaSpanServer as SourceFile>::eq 2024-12-31 13:00:46 +01:00
Lukas Wirth
d30bd5fbb5 Remove recursion_limit special casing in tests 2024-12-31 13:00:23 +01:00
Lukas Wirth
add0963033
Merge pull request #18758 from mgsloan/scip-unique-symbols
Improve SCIP symbols
2024-12-31 09:25:30 +00:00
roife
edaf62e7d9 feat: show go-to-type-def actions for subst when hovering 2024-12-31 13:05:29 +08:00
Michael Sloan
5f7425ca20 Move container_to_definition function into enclosing_definition 2024-12-30 13:52:09 -07:00
Michael Sloan
37cee9fdaa Remove erroneous omit of inherent impls
Should have been included in 34dc94bb2d
2024-12-30 13:51:41 -07:00
Michael Sloan
d72aec09d2 TODO -> FIXME 2024-12-30 13:51:32 -07:00
Michael Sloan
03cb63cc75 Make impl HirDisplay for TraitRef provide just the trait type 2024-12-30 13:34:02 -07:00
yanglsh
fc847323f9 Add test cases for #10583 2024-12-30 12:07:35 -07:00
roife
7b3dffd657 refactor snapshot-tests detection in runnables 2024-12-30 23:56:31 +08:00
dfireBird
92f8fef527
Fix render of literal to be rendered in codeblock 2024-12-30 20:03:10 +05:30
Lukas Wirth
2e13684be1
Merge pull request #18790 from ChayimFriedman2/proper-make
internal: Create a quoting mechanism instead of textual AST make
2024-12-30 11:39:29 +00:00
Lukas Wirth
bd083d0cd9
Merge pull request #18794 from 1hakusai1/fix_fill_match_arm_in_tokio_main
Fix bug of "fill match arm" action in tokio::main macro
2024-12-30 11:30:32 +00:00
Lukas Wirth
83188757d8
Merge pull request #18793 from ChayimFriedman2/fixup
minor: Remove unneeded conversions
2024-12-30 11:20:49 +00:00
1hakusai1
9451d64315 Fix bug of "fill match arm" action in tokio::main macro
https://github.com/rust-lang/rust-analyzer/issues/18027
2024-12-30 20:06:17 +09:00
Chayim Refael Friedman
393a7410fb Remove unneeded conversions 2024-12-30 13:04:19 +02:00
Lukas Wirth
3f04e3682c
Merge pull request #18792 from Veykril/push-wonkvzozmmwz
Decouple proc-macro server protocol from the server implementation
2024-12-30 11:00:08 +00:00
Lukas Wirth
b2d9486ebd Move proc-macro protocol into legacy module 2024-12-30 11:47:08 +01:00
Lukas Wirth
f5a6826137 Cleanup proc-macro dylib handling 2024-12-30 11:14:27 +01:00
Lukas Wirth
714b81bec1 Decouple proc-macro server protocol from the server implementation 2024-12-30 10:33:57 +01:00
roife
f8c04166dc fix: avoid generating colliding names in extract_variable 2024-12-30 15:30:05 +08:00
Chayim Refael Friedman
791a63255b Move some more AST makers to the quote macro
And implement addons as necessary.

There are many more makers to be moved, and I'm not completely satisfied with this (due to the ease of making a mistake in the AST structure, and slightly less but also because of the need to remember whitespaces), but this is already enough to see how this will look like.
2024-12-30 05:46:06 +02:00
Chayim Refael Friedman
abd7263179 Create a quote!-like API for crafting AST nodes
Instead of messing with textual `make`.

And port one `make` helper to it, for the sake of testing.
2024-12-30 04:54:39 +02:00