about summary refs log tree commit diff
path: root/src/tools/rust-analyzer
AgeCommit message (Collapse)AuthorLines
2024-06-09feat: Compute native diagnostics in parallelLukas Wirth-26/+73
2024-06-09internal: better print style for hirYoung-Flash-2/+16
2024-06-08Auto merge of #17365 - DropDemBits:diagnostic-snippet-cap, r=Veykrilbors-6/+13
internal: Expose snippet capability to diagnostic quickfixes Fixes #16767
2024-06-08Auto merge of #17368 - Veykril:dist-fix, r=Veykrilbors-5/+3
fix: Fix generated markers not being patchable in package.json I think the newlines are tripping up CI, so I hope clearing the property to leave an empty object won't make VSCode made here.
2024-06-08fix: Fix generated markers not being patchable in package.jsonLukas Wirth-5/+3
2024-06-07internal: Expose snippet capability to diagnostic quickfixesDropDemBits-6/+13
2024-06-07Auto merge of #17359 - Veykril:status-bar, r=Veykrilbors-24/+46
Add version info to status bar item
2024-06-07Add version info to status bar itemLukas Wirth-24/+46
2024-06-07fix: Fix renaming imports of foreign items touching foreign sourcesLukas Wirth-11/+30
2024-06-07Auto merge of #17058 - alibektas:13529/ratoml, r=Veykrilbors-541/+2099
feat: TOML based config for rust-analyzer > Important > > We don't promise _**any**_ stability with this feature yet, any configs exposed may be removed again, the grouping may change etc. # TOML Based Config for RA This PR ( addresses #13529 and this is a follow-up PR on #16639 ) makes rust-analyzer configurable by configuration files called `rust-analyzer.toml`. Files **must** be named `rust-analyzer.toml`. There is not a strict rule regarding where the files should be placed, but it is recommended to put them near a file that triggers server to start (i.e., `Cargo.{toml,lock}`, `rust-project.json`). ## Configuration Types Previous configuration keys are now split into three different classes. 1. Client keys: These keys only make sense when set by the client (e.g., by setting them in `settings.json` in VSCode). They are but a small portion of this list. One such example is `rust_analyzer.files_watcher`, based on which either the client or the server will be responsible for watching for changes made to project files. 2. Global keys: These keys apply to the entire workspace and can only be set on the very top layers of the hierarchy. The next section gives instructions on which layers these are. 3. Local keys: Keys that can be changed for each crate if desired. ### How Am I Supposed To Know If A Config Is Gl/Loc/Cl ? #17101 ## Configuration Hierarchy There are 5 levels in the configuration hierarchy. When a key is searched for, it is searched in a bottom-up depth-first fashion. ### Default Configuration **Scope**: Global, Local, and Client This is a hard-coded set of configurations. When a configuration key could not be found, then its default value applies. ### User configuration **Scope**: Global, Local If you want your configurations to apply to **every** project you have, you can do so by setting them in your `$CONFIG_DIR/rust-analyzer/rust-analyzer.toml` file, where `$CONFIG_DIR` is : | Platform | Value | Example | | ------- | ------------------------------------- | ---------------------------------------- | | Linux | `$XDG_CONFIG_HOME` or `$HOME`/.config | /home/alice/.config | | macOS | `$HOME`/Library/Application Support | /Users/Alice/Library/Application Support | | Windows | `{FOLDERID_RoamingAppData}` | C:\Users\Alice\AppData\Roaming | ### Client configuration **Scope**: Global, Local, and Client Previously, the only way to configure rust-analyzer was to configure it from the settings of the Client you are using. This level corresponds to that. > With this PR, you don't need to port anything to benefit from new features. You can continue to use your old settings as they are. ### Workspace Root Configuration **Scope**: Global, Local Rust-analyzer already used the path of the workspace you opened in your Client. We used this information to create a configuration file that won't affect your other projects and define global level configurations at the same time. ### Local Configuration **Scope**: Local You can also configure rust-analyzer on a crate level. Although it is not an error to define global ( or client ) level keys in such files, they won't be taken into consideration by the server. Defined local keys will affect the crate in which they are defined and crate's descendants. Internally, a Rust project is split into what we call `SourceRoot`s. This, although with exceptions, is equal to splitting a project into crates. > You may choose to have more than one `rust-analyzer.toml` files within a `SourceRoot`, but among them, the one closer to the project root will be
2024-06-07Auto merge of #17308 - mathew-horner:prefer-workspace, r=Veykrilbors-1/+46
Add preference modifier for workspace-local crates when using auto import. `@joshka` pointed out some odd behavior of auto import ordering. It doesn't seem that the current heuristics were applying any sort of precedence to imports from the workspace. I've went ahead and added that. I hope to get some feedback on the modifier numbers here. I just went with something that felt like it balanced giving more power to workspace crates without completely ignoring relative path distance. closes https://github.com/rust-lang/rust-analyzer/issues/17303
2024-06-07Fix processing of ratoml filesLukas Wirth-166/+115
2024-06-06chore: Prefer tracing span shorthand macrosWilfred Hughes-275/+240
2024-06-06fix: incorrect formatting of hover actionsroife-2/+2
2024-06-06Auto merge of #17352 - roife:fix-issue-17338, r=Veykrilbors-1/+30
fix: do not resolve prelude within block modules fix #17338 (continuing from #17251). In #17251, we injected preludes into non-top-level modules, which leading to r-a to directly resolve names in preludes in block modules. This PR fix it by checking whether the module is a pseudo-module introduced by blocks. (similar to what we do for extern preludes)
2024-06-06test: add regression test for prelude shadowing in block modulesroife-0/+24
2024-06-06fix: do not resolve prelude within block modulesroife-1/+6
2024-06-06Fix file loading of r-a toml filesLukas Wirth-90/+37
2024-06-06Auto merge of #17346 - ChosenName:master, r=Veykrilbors-1399/+2221
Changed package.json so vscode extension settings have submenus There are a lot of options that are a part of rust-analyzer, sometimes it can be hard to find an option that you are looking for. To fix this I have put all configurations into categories based on their names. I have also changed the schema in `crates/rust-analyzer/src/config.rs` to reflect this. Currently for each generated entry the title is redeclared, this does function but I am prepared to change this if it is a problem.
2024-06-06Auto merge of #17350 - Wilfred:mark_missing_file_unused, r=Veykrilbors-10/+2
fix: Highlight unlinked files consistently with inactive files Currently, rust-analyzer highlights the entire region when a `cfg` is inactive (e.g. `#[cfg(windows)]` on a Linux machine). However, unlinked files only highlight the first three characters of the file. This was introduced in #8444, but users have repeatedly found themselves with no rust-analyzer support for a file and unsure why (see e.g. #13226 and the intentionally prominent pop-up added in PR #14366). (Anecdotally, we see this issue bite our users regularly, particularly people new to Rust.) Instead, highlight the entire inactive file, but mark it as all as unused. This allows users to hover and run the quickfix from any line. Whilst this is marginally more prominent, it's less invasive than a pop-up, and users do want to know why they're getting no rust-analyzer support in certain files. Before (note the subtle grey underline is only at the beginning of the first line): ![Screenshot 2024-06-05 at 5 41 17 PM](https://github.com/rust-lang/rust-analyzer/assets/70800/96f5d778-612e-4838-876d-35d9647fe2aa) After (user can hover and fix from any line): ![Screenshot 2024-06-05 at 5 42 13 PM](https://github.com/rust-lang/rust-analyzer/assets/70800/6af90b79-018c-42b9-b3c5-f497de2ccbff)
2024-06-05fix: Highlight unlinked files consistently with inactive filesWilfred Hughes-10/+2
Currently, rust-analyzer highlights the entire region when a `cfg` is inactive (e.g. `#[cfg(windows)]` on a Linux machine). However, unlinked files only highlight the first three characters of the file. This was introduced in #8444, but users have repeatedly found themselves with no rust-analyzer support for a file and unsure why (see e.g. #13226 and the intentionally prominent pop-up added in PR #14366). (Anecdotally, we see this issue bite our users regularly, particularly people new to Rust.) Instead, highlight the entire inactive file, but mark it as all as unused. This allows users to hover and run the quickfix from any line. Whilst this is marginally more prominent, it's less invasive than a pop-up, and users do want to know why they're getting no rust-analyzer support in certain files.
2024-06-05chore: Update Cargo.lock to avoid yanked versionWilfred Hughes-2/+2
2024-06-05Keep config diagnostics across changesLukas Wirth-100/+213
2024-06-05Diagnose most incorrect ra-toml config errorsLukas Wirth-25/+135
2024-06-05Auto merge of #17348 - regexident:fix-type-or-const-param-source, r=Veykrilbors-2/+2
Use `.get(…)` instead of `[…]` in `TypeOrConstParam::source(…)` and `LifetimeParam::source(…)` Resolves #17344.
2024-06-05Resolve #17344 by using `.get(…)` instead of `[…]` in ↵Vincent Esche-2/+2
`TypeOrConstParam::source(…)` (… and `LifetimeParam::source(…)`)
2024-06-05Fix local configs allowing to contain global changesLukas Wirth-15/+17
2024-06-05Shuffle around some of the configs between the levelsLukas Wirth-315/+278
2024-06-05Apply requested changes round 3Ali Bektas-31/+36
2024-06-05Apply requested changes round 2Ali Bektas-1269/+1159
2024-06-05Apply suggested changesAli Bektas-299/+1878
2024-06-05Add debug info to invalid offset errorLukas Wirth-2/+3
2024-06-04fmtChosenName-4/+4
2024-06-04fmtChosenName-5/+4
2024-06-04Update dist.rsChosenName-2/+5
2024-06-04Update config.rsChosenName-2/+4
2024-06-04fmtChosenName-2/+6
2024-06-04Fix typosChosenName-2/+2
2024-06-04Update config.rsChosenName-6/+14
2024-06-04Update package.jsonChosenName-1392/+2198
2024-06-04Use dyn cache for Semantics macro resolutionLukas Wirth-41/+44
2024-06-04Cache parse trees in `Semantics`Lukas Wirth-4/+22
2024-06-04Cache `file_to_def` in `SourceToDefCtx`Lukas Wirth-28/+40
2024-06-04Try caching macro calls more aggressivelyLukas Wirth-303/+385
2024-06-04Auto merge of #17341 - Veykril:inert-attr, r=Veykrilbors-162/+155
internal: Cleanup some inert attribute stuff
2024-06-04Cleanup some inert attribute stuffLukas Wirth-162/+155
2024-06-04Auto merge of #17282 - jkelleyrtp:jk/filter-by-underscorte, r=Veykrilbors-1/+29
Feat: hide double underscored symbols from symbol search Fixes #17272 by changing the default behavior of query to skip results that start with `__` (two underscores). Not sure if this has any far reaching implications - a review would help to understand if this is the right place to do the filtering, and if it's fine to do it by default on the query. If you type `__` as your search, then we'll show the matching double unders, just in case you actually need the symbol.
2024-06-04Recognize `__` prefixes for symbol search queryLukas Wirth-16/+8
2024-06-03Add fuel to `find_path`Lukas Wirth-1/+15
2024-06-03Remove an allocation in `find_path::find_local_import_locations`Lukas Wirth-23/+17