21622 Commits

Author SHA1 Message Date
bors
702da50daa Auto merge of #136117 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2025-01-29 08:43:30 +00:00
Marijn Schouten
e766255067 parse_format optimize import use 2025-01-28 19:33:00 +01:00
Lukas Wirth
6e4d64ea4a
Merge pull request #19034 from ChayimFriedman2/complete-hidden-variant
fix: Don't complete doc(hidden) enum variants and use trees
2025-01-26 06:47:34 +00:00
Chayim Refael Friedman
be9710ea6f
Merge pull request #19033 from ChayimFriedman2/span-1
fix: Make proc_macro span's line & column 1-indexed, as documented
2025-01-26 06:41:54 +00:00
Chayim Refael Friedman
3f2fb17042 Make proc_macro span's line & column 1-indexed, as documented
That is, make the fake number that we return 1 and not 0.
2025-01-26 08:27:24 +02:00
Chayim Refael Friedman
f7746cffc2 Don't complete doc(hidden) enum variants and use trees
Also refactor the check a bit.
2025-01-26 00:13:11 +02:00
Lukas Wirth
90bf50c011
Merge pull request #19020 from ShoyuVanilla/issues-19007
fix: Prevent infinite recursion of bounds formatting
2025-01-25 19:03:54 +00:00
Shoyu Vanilla
3fe7415c83 fix: Prevent infinite recursion of bounds formatting 2025-01-26 03:37:00 +09:00
Lukas Wirth
d6bf619606
Merge pull request #19030 from Veykril/push-wuzvopyooznm
fix: Fix markdown horizontal ruler sometimes being treated as a heading
2025-01-25 13:22:39 +00:00
Lukas Wirth
79699e0a6c fix: Fix markdown horizontal ruler sometimes being treated as a heading 2025-01-25 14:07:54 +01:00
Lukas Wirth
090a145d44 Use strict_provenance 2025-01-25 13:47:07 +01:00
Lukas Wirth
ae74cc3b88 Skip redundant path search in resolve_completion_edits 2025-01-25 13:03:01 +01:00
Lukas Wirth
5df0b592c1
Merge pull request #19028 from Veykril/push-vuytpkvqzwzs
fix: Fix flyimport not filtering via stability of import path
2025-01-25 11:34:36 +00:00
Lukas Wirth
b31f53e0d6 Fix flyimport not filtering via stability of import path 2025-01-25 12:18:54 +01:00
Lukas Wirth
fbf3d08a30
Merge pull request #19026 from Veykril/push-wrxrutptywzx
Only collect implicit visibile use symbols if they have renames
2025-01-25 10:27:26 +00:00
Lukas Wirth
7acf8dcf7b Only collect implicit visibile use symbols if they have renames
Otherwise this will pollute the index too much with unnecessary symbols
2025-01-25 11:12:06 +01:00
Lukas Wirth
e22bcfbf57
Merge pull request #18973 from ThouCheese/feat/nice-niches
Make niches into nices
2025-01-25 09:17:05 +00:00
Lukas Wirth
914da2ece3
Merge pull request #19023 from Wilfred/sequence_type_names
minor: Suggest better names when a type is a sequence
2025-01-25 08:13:42 +00:00
Wilfred Hughes
4c34352517 minor: Suggest better names when a type is a sequence
Previously, we'd suggest a type of `vec` for a value of type `Vec<T>`,
which is rarely what the user wants. We also had no suggestions for
values of type `&[T]`.

Instead, try to pluralise the inner type name, and fall back to
`items`.
2025-01-24 11:30:19 -08:00
David Richey
c0c7d5a2e1 Explicitly add buildfiles when constructing ProjectFolders 2025-01-24 09:59:06 -06:00
Lukas Wirth
6e4c29f7ce
Merge pull request #19018 from Veykril/push-wxqqunxwrply
internal: Record the use tree index in glob imports
2025-01-24 14:27:49 +00:00
Lukas Wirth
a62e2f513a
Merge pull request #18991 from Veykril/push-rmqmnrymwmoz
Keep already computed inlay hint properties instead of late resolving them
2025-01-24 14:27:43 +00:00
Lukas Wirth
41e6a8747d Lazily compute location links in type hints again 2025-01-24 15:13:10 +01:00
Lukas Wirth
433888c4b2 Record the use tree index in glob imports 2025-01-24 15:12:48 +01:00
Shoyu Vanilla
649e65ce1e Add a new failing test that overflows stack 2025-01-24 23:06:02 +09:00
Lukas Wirth
3a163faba1
Merge pull request #19012 from ShoyuVanilla/arbitrary-self
feat: Implement `arbitrary-self-types`
2025-01-24 14:04:34 +00:00
Shoyu Vanilla
f4dfbc38c8 feat: Implement arbitrary-self-types 2025-01-24 22:50:59 +09:00
Lukas Wirth
0f6feb032f
Merge pull request #19017 from Veykril/push-uktrsknwmsvy
fix: Fix flycheck panicking with "once" invocation strategy
2025-01-24 13:37:17 +00:00
Lukas Wirth
1329e6be49
Merge pull request #18993 from ChayimFriedman2/iter-config
feat: Provide a config to control auto-insertion of `await` and `iter()`
2025-01-24 13:31:30 +00:00
Lukas Wirth
8acea502ee
Merge pull request #18994 from Wilfred/failed_rustc_cfg_as_warning
internal: Treat cfg fetching failures as a warning
2025-01-24 13:31:00 +00:00
Lukas Wirth
93de80d833
Merge pull request #19016 from Veykril/push-moqnsytyrupu
fix: Fix `ItemScope` not recording glob imports
2025-01-24 13:25:39 +00:00
Lukas Wirth
3ab96c40b3 fix: Fix flycheck panicking with "once" invocation strategy
We only ever have one flycheck runner no matter the number of workspaces, so just kick off flycheck for it immediately
2025-01-24 14:23:11 +01:00
Lukas Wirth
3b88a2f134 Fix ItemScope not recording glob imports
This caused us other code to incorrectly assume in dealing with a declaration when in fact it was dealing with a glob imported definition
2025-01-24 14:11:45 +01:00
David Richey
1b6f95e885 Check cfg when collecting macro defs 2025-01-23 17:36:45 -06:00
Teodor Tanasoaia
90533a0ad5
increase AUTODEREF_RECURSION_LIMIT to 20
The limit was introduced in https://github.com/rust-lang/rust-analyzer/pull/1408#discussion_r294059044 to avoid infinite cycles but it effectively caps the number of derefs to 10. Types like `ID3D12Device14` from the `windows` crate run into this because it derefs to `ID3D12Device13`, 13 to 12 and so on. Increasing it to 20 is a quick fix; a better cycle detection method would be nicer long term.
2025-01-22 22:21:02 +01:00
Wilfred Hughes
86a4b2fdd7 manual: Document all rust-project.json fields
Ensure that all the fields that rust-analyzer understands are in the
manual, they all have doc comments, and they use consistent
punctuation (`;` rather than mixing `,` and `;`).

Whilst we're here, fix the `sysroot_src` example and add 2024 as a
legal value for Rust edition.
2025-01-21 12:00:13 -08:00
Wilfred Hughes
8f6a1e5ee5 internal: Treat cfg fetching failures as a warning
If the user doesn't have rustc on $PATH, rust-analyzer won't be able
to run `rustc --print cfg`. This isn't really an error, as
rust-analyzer can still proceed without it.

This is particularly noticeable when loading crates defined in a
rust-project.json. Until the configuration is loaded, the opened files
are briefly treated as detached files and users see this error.

Environments with rust-project.json generally have a sysroot and rustc
elsewhere, so the error confuses users.
2025-01-21 11:07:07 -08:00
Chayim Refael Friedman
47f4f3f0b2 Provide a config to control auto-insertion of await and iter() 2025-01-21 18:51:09 +02:00
Lukas Wirth
f5b86e056b Keep already computed inlay hint properties instead of late resolving them 2025-01-21 16:16:51 +01:00
Lukas Wirth
1977aa99b0 Make InlayHint::linked_location computation lazy 2025-01-21 16:16:50 +01:00
Luuk Wester
5ad3de8b29 remove is_pwr2 2025-01-21 14:47:07 +01:00
Luuk Wester
705eb84941 switch from using leading zeros to trailing zeros 2025-01-21 14:45:30 +01:00
Lukas Wirth
831e3535e6 Fix Param::as_local treating closures wrong 2025-01-21 11:15:36 +01:00
Chayim Refael Friedman
8e0bc9f67f Sort completion items that skip await and iter() behind those that don't
I don't think my ranking is perfect, because it places them even behind snippet completions, but this is something.
2025-01-21 11:44:38 +02:00
Luuk Wester
6b6e019593 make large niche description more terse, switch to using u128::is_power_of_two 2025-01-21 10:33:28 +01:00
Lukas Wirth
2c040c03cf
Merge pull request #18986 from Veykril/push-zlwvwlowpzqm
Goto `Display::fmt` when invoked on `to_string`
2025-01-21 09:25:05 +00:00
Lukas Wirth
76585539f5 Cleanup Name string rendering 2025-01-21 10:05:32 +01:00
Lukas Wirth
c78cc2baa9
Merge pull request #18977 from ChayimFriedman2/fix-upmapping
fix: Fix missing upmapping in trait impls completion
2025-01-21 07:41:22 +00:00
Chayim Refael Friedman
ce1759635b Fix another bug with completion of trait items inside macros
This time, when completing the keyword (e.g. `fn` + whitespace).

The bug was actually a double-bug:
First, we did not resolve the impl in the macro-expanded file but in the real file, which of course cannot work.
Second, in analysis the whitespace was correlated with the `impl` and not the incomplete `fn`, which caused fake (where we insert an identifier after the whitespace) and real expansions to go out of sync, which failed analysis. The fix is to skip whitespaces in analysis.
2025-01-20 21:21:42 +02:00
Lukas Wirth
a3eee10638 Goto Display::fmt when invoked on to_string 2025-01-20 17:00:28 +01:00