about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-08-22Thread file id through descension API for semantic highlightingLukas Wirth-75/+117
2024-08-22Rename macro descension functionsLukas Wirth-19/+16
2024-08-22Fully remove old macro descension APILukas Wirth-103/+66
2024-08-22Remove DescendPreference::SameKindLukas Wirth-37/+53
2024-08-22Drop MacroInputKindLukas Wirth-74/+24
2024-08-22Remove DescendPreference::SameTextLukas Wirth-229/+304
2024-08-22Auto merge of #17939 - ShoyuVanilla:maybe-sized-fix, r=Veykrilbors-0/+4
fix: Wrong `Sized` predicate for `generic_predicates_for_param` I found this gathers wrong `Self: Sized` bound while implementing object safety, though I couldn't find proper test for this. If we call `generic_predicates_for_param` to `Bar` in the following code; ```rust trait Foo<T: ?Sized> {} trait Bar<T: Foo<Self> + ?Sized> {} ``` it returns `T: Sized` and `Self: Sized` bound, because normaly, the `?Sized` bound applied properly in L1059 with; https://github.com/rust-lang/rust-analyzer/blob/3723e5910c14f0ffbd13de474b8a8fcc74db04ce/crates/hir-ty/src/lower.rs#L1035-L1061 But we filter them before it is lowered with that function here; https://github.com/rust-lang/rust-analyzer/blob/3723e5910c14f0ffbd13de474b8a8fcc74db04ce/crates/hir-ty/src/lower.rs#L1540-L1586 So, the `?Sized` bounded params are not gathered into `ctx.unsized_types` and thus we are applying them implicit `Sized` bound here; https://github.com/rust-lang/rust-analyzer/blob/3723e5910c14f0ffbd13de474b8a8fcc74db04ce/crates/hir-ty/src/lower.rs#L1591-L1602
2024-08-22fix: Wrong `Sized` predicate for `generic_predicates_for_param`Shoyu Vanilla-0/+4
2024-08-20Auto merge of #17913 - alibektas:ratoml_improvements, r=alibektasbors-113/+164
fix: Add workspace level config to ratoml
2024-08-20Auto merge of #17930 - Veykril:config-user-config, r=alibektasbors-65/+75
Remove the ability to configure the user config path Being able to do this makes little sense as this is effectively a cyclic dependency (and we do not want to fixpoint this really).
2024-08-20Old configs are backAli Bektas-0/+61
2024-08-20Next up : generating configs for workspace level configsAli Bektas-110/+48
2024-08-20Define workspace level configs.Ali Bektas-90/+142
2024-08-20Auto merge of #17932 - Veykril:default-reply-lat-sensitive, r=Veykrilbors-4/+14
fix: Fix panics for semantic highlighting at startup Without this we might try to process semantic highlighting requests before the database has entries for the given file resulting in a panic. There is no work to be done either way so delay this like we do with other request handlers.
2024-08-20fix: Fix panics for semantic highlighting at startupLukas Wirth-4/+14
2024-08-19Auto merge of #17886 - Wilfred:prime_caches_quiescent, r=Veykrilbors-4/+19
internal: ServerStatusParams should consider 'prime caches' in quiescent status Priming caches is a performance win, but it takes a lock on the salsa database and prevents rust-analyzer from responding to e.g. go-to-def requests. This causes confusion for users, who see the spinner next to rust-analyzer in the VS Code footer stop, so they start attempting to navigate their code. Instead, set the `quiescent` status in LSP to false during cache priming, so the VS Code spinner persists until we can respond to any LSP request.
2024-08-19ServerStatusParams should consider 'prime caches' in quiescent statusWilfred Hughes-4/+19
Priming caches is a performance win, but it takes a lock on the salsa database and prevents rust-analyzer from responding to e.g. go-to-def requests. This causes confusion for users, who see the spinner next to rust-analyzer in the VS Code footer stop, so they start attempting to navigate their code. Instead, set the `quiescent` status in LSP to false during cache priming, so the VS Code spinner persists until we can respond to any LSP request.
2024-08-19Auto merge of #17924 - ShoyuVanilla:issue-17921, r=Veykrilbors-11/+85
fix: Panic when a TAIT exists in a RPIT Fixes #17921 When there is a TAIT inside of a RPIT like; ```rust trait Foo {} type Bar = impl Foo; fn foo<A>() -> impl Future<Output = Bar> { .. } ``` while inferencing `fn foo`, `insert_inference_vars_for_impl_trait` tries to substitute impl trait bounds of `Bar`, i.e. `Implemented(Foo)` with RPITs `placeholders`, and this causes panic https://github.com/rust-lang/rust-analyzer/blob/fa003262474185fd62168379500fe906b331824b/crates/hir-ty/src/infer.rs#L903-L905
2024-08-19fix: Panic when a TAIT exists in a RPITShoyu Vanilla-11/+85
2024-08-19Allow user config to not existLukas Wirth-15/+10
2024-08-19Remove the ability to configure the user config pathLukas Wirth-66/+81
2024-08-19Auto merge of #17929 - Veykril:invocation-loc-docs, r=Veykrilbors-23/+29
minor: Improve documentation for `InvocationStrategy` cc https://github.com/rust-lang/rust-analyzer/pull/17888
2024-08-19Improve documentation for `InvocationStrategy`Lukas Wirth-23/+29
2024-08-19Auto merge of #17928 - roife:fix-issue-17869, r=Veykrilbors-8/+89
fix: keep comments in convert_while_to_loop Fix #17869.
2024-08-19fix: keep comments in convert_while_to_looproife-8/+89
2024-08-19Auto merge of #17888 - Tyrubias:remove-invocation-location, r=Veykrilbors-173/+33
chore(config): remove `invocationLocation` in favor of `invocationStrategy` These flags were added to help rust-analyzer integrate with repos requiring non-Cargo invocations. The consensus is that having two independent settings are no longer needed. This change removes `invocationLocation` in favor of `invocationStrategy` and changes the internal representation of `InvocationStrategy::Once` to hold the workspace root. Closes #17848.
2024-08-19chore(config): remove `invocationLocation` in favor of `invocationStrategy`Victor Song-173/+33
These flags were added to help rust-analyzer integrate with repos requiring non-Cargo invocations. The consensus is that having two independent settings are no longer needed. This change removes `invocationLocation` in favor of `invocationStrategy` and changes the internal representation of `InvocationStrategy::Once` to hold the workspace root.
2024-08-19Auto merge of #17925 - darichey:issue-17767, r=Veykrilbors-5/+21
Include generics when lowering extern type Fixes #17767
2024-08-18Include generics when lowering extern typeDavid Richey-5/+21
2024-08-17Auto merge of #17915 - Veykril:offline-no-deps, r=Veykrilbors-24/+85
feat: Make rust-analyzer work partially when offline Helps out with https://github.com/rust-lang/rust-analyzer/issues/12499 a bit
2024-08-17Adress new clippy::large_enum_variant diagnosticsLukas Wirth-7/+10
2024-08-17feat: Make rust-analyzer work partially when missing an internet connectionLukas Wirth-17/+75
2024-08-17Auto merge of #17916 - ShoyuVanilla:issue-17711, r=Veykrilbors-18/+50
fix: Wrong BoundVar index when lowering impl trait parameter of parent generics Fixes #17711 From the following test code; ```rust //- minicore: deref use core::ops::Deref; struct Struct<'a, T>(&'a T); trait Trait {} impl<'a, T: Deref<Target = impl Trait>> Struct<'a, T> { fn foo(&self) -> &Self { self } fn bar(&self) { let _ = self.foo(); } } ``` when we call `register_obligations_for_call` for `let _ = self.foo();`, https://github.com/rust-lang/rust-analyzer/blob/07659783fdfd4ec0a0bffa93017e33e31e567e42/crates/hir-ty/src/infer/expr.rs#L1939-L1952 we are querying `generic_predicates` and it has `T: Deref<Target = impl Trait>` predicate from the parent `impl Struct`; https://github.com/rust-lang/rust-analyzer/blob/07659783fdfd4ec0a0bffa93017e33e31e567e42/crates/hir-ty/src/lower.rs#L375-L399 but as we can see above, lowering `TypeRef = impl Trait` doesn't take into account the parent generic parameters, so the `BoundVar` index here is `0`, as `fn foo` has no generic args other than parent's, But this `BoundVar` is pointing at `'a` in `<'a, T: Deref<Target = impl Trait>>`. So, in the first code reference `register_obligations_for_call`'s L:1948 - `.substitute(Interner, parameters)`, we are substituting `'a` with `Ty`, not `Lifetime` and this makes panic inside the chalk. This PR fixes this wrong `BoundVar` index in such cases
2024-08-17fix: Wrong BoundVar index when lowering impl trait parameter of parent genericsShoyu Vanilla-18/+50
2024-08-17Auto merge of #17917 - ShoyuVanilla:pin-rowan, r=lnicolabors-1/+1
Pin `rowan` to `0.15.15` To prevent #17914, I think that it would be safer pinning this before we fix it correctly
2024-08-17Pin `rowan` to `0.15.15`Shoyu Vanilla-1/+1
2024-08-16Auto merge of #17909 - darichey:remove-discoverProjectRunner, r=lnicolabors-12/+0
Remove rust-analyzer.workspace.discoverProjectRunner The functionality for this vscode config option was removed in #17395, so it doesn't do anything anymore.
2024-08-16Remove rust-analyzer.workspace.discoverProjectRunnerDavid Richey-12/+0
2024-08-16Auto merge of #17900 - darichey:exclude-vendored-libraries, r=davidbarskybors-19/+95
Add scip/lsif flag to exclude vendored libaries #17809 changed StaticIndex to include vendored libraries. This PR adds a flag to disable that behavior. At work, our monorepo has too many rust targets to index all at once, so we split them up into several shards. Since all of our libraries are vendored, if rust-analyzer includes them, sharding no longer has much benefit, because every shard will have to index the entire transitive dependency graphs of all of its targets. We get around the issue presented in #17809 because some other shard will index the libraries directly.
2024-08-16Auto merge of #17905 - ChayimFriedman2:edition-dependent-raw-keyword, r=Veykrilbors-1245/+2480
fix: Properly account for editions in names This PR touches a lot of parts. But the main changes are changing `hir_expand::Name` to be raw edition-dependently and only when necessary (unrelated to how the user originally wrote the identifier), and changing `is_keyword()` and `is_raw_identifier()` to be edition-aware (this was done in #17896, but the FIXMEs were fixed here). It is possible that I missed some cases, but most IDE parts should properly escape (or not escape) identifiers now. The rules of thumb are: - If we show the identifier to the user, its rawness should be determined by the edition of the edited crate. This is nice for IDE features, but really important for changes we insert to the source code. - For tests, I chose `Edition::CURRENT` (so we only have to (maybe) update tests when an edition becomes stable, to avoid churn). - For debugging tools (helper methods and logs), I used `Edition::LATEST`. Reviewing notes: This is a really big PR but most of it is mechanical translation. I changed `Name` displayers to require an edition, and followed the compiler errors. Most methods just propagate the edition requirement. The interesting cases are mostly in `ide-assists`, as sometimes the correct crate to fetch the edition from requires awareness (there may be two). `ide-completions` and `ide-diagnostics` were solved pretty easily by introducing an edition field to their context. `ide` contains many features, for most of them it was propagated to the top level function and there the edition was fetched based on the file. I also fixed all FIXMEs from #17896. Some required introducing an edition parameter (usually not for many methods after the changes to `Name`), some were changed to a new method `is_any_identifier()` because they really want any possible keyword. Fixes #17895. Fixes #17774.
2024-08-16Properly account for editions in namesChayim Refael Friedman-1245/+2480
This PR touches a lot of parts. But the main changes are changing `hir_expand::Name` to be raw edition-dependently and only when necessary (unrelated to how the user originally wrote the identifier), and changing `is_keyword()` and `is_raw_identifier()` to be edition-aware (this was done in #17896, but the FIXMEs were fixed here). It is possible that I missed some cases, but most IDE parts should properly escape (or not escape) identifiers now. The rules of thumb are: - If we show the identifier to the user, its rawness should be determined by the edition of the edited crate. This is nice for IDE features, but really important for changes we insert to the source code. - For tests, I chose `Edition::CURRENT` (so we only have to (maybe) update tests when an edition becomes stable, to avoid churn). - For debugging tools (helper methods and logs), I used `Edition::LATEST`.
2024-08-16Auto merge of #17595 - dfireBird:infer-lt, r=flodieboldbors-85/+109
Implement lifetime inferring
2024-08-16implement basic inferring of lifetimesdfireBird-85/+109
2024-08-16Auto merge of #17903 - tmandry:graceful-exit, r=Veykrilbors-1/+0
Allow flycheck process to exit gracefully Assuming it isn't cancelled. Closes #17902. The only place CommandHandle::join() is used is when the flycheck command finishes, so this commit changes the behavior of the method itself. The only reason I can see for the existing behavior is if the command is somehow holding onto a build lock longer than it should, this would force it to be released. But it would be a pretty heavy-handed way to solve that issue. I'm not aware of this occurring in practice.
2024-08-16Auto merge of #17908 - ChayimFriedman2:usages-word-boundaries, r=Veykrilbors-0/+14
Test for word boundary in `FindUsages` This speeds up short identifiers search significantly, while unlikely to have an effect on long identifiers (the analysis takes much longer than some character comparison). Tested by finding all references to `eq()` (from `PartialEq`) in the rust-analyzer repo. Total time went down from 100s to 10s (a 10x reduction!). Feel free to close this if you consider this a non-issue, as most short identifiers are local.
2024-08-16Auto merge of #17907 - ChayimFriedman2:no-once_cell, r=Veykrilbors-54/+49
internal: Replace once_cell with std's recently stabilized OnceCell/Lock and LazyCell/Lock This doesn't get rid of the once_cell dependency, unfortunately, since we have dependencies that use it, but it's a nice to do cleanup. And when our deps will eventually get rid of once_cell we will get rid of it for free.
2024-08-16Test for word boundary in `FindUsages`Chayim Refael Friedman-0/+14
This speeds up short identifiers search significantly, while unlikely to have an effect on long identifiers (the analysis takes much longer than some character comparison). Tested by finding all references to `eq()` (from `PartialEq`) in the rust-analyzer repo. Total time went down from 100s to 10s (a 10x reduction!).
2024-08-16Replace once_cell with std's recently stabilized OnceCell/Lock and LazyCell/LockChayim Refael Friedman-54/+49
This doesn't get rid of the once_cell dependency, unfortunately, since we have dependencies that use it, but it's a nice to do cleanup. And when our deps will eventually get rid of once_cell we will get rid of it for free.
2024-08-15Allow flycheck process to exit gracefullyTyler Mandry-1/+0
Assuming it isn't cancelled. Closes #17902. The only place CommandHandle::join is used is when the flycheck command finishes, so this commit changes the behavior of the method itself.
2024-08-15Add scip/lsif flag to exclude vendored libariesDavid Richey-19/+95