Commit graph

255293 commits

Author SHA1 Message Date
Wilfred Hughes
22ee477606 chore: Prefer tracing span shorthand macros 2024-06-06 16:52:25 -07:00
bors
4739660378 Auto merge of #17353 - roife:fix-issue-12728, r=Veykril
fix: incorrect formatting of hover actions

fix #12728.

### Changes

- Use ` | ` as the separator for actions. (I'm not sure why we use `___` previously)
- Reorder actions to match codelens
2024-06-06 13:49:08 +00:00
roife
8573eb2060 fix: incorrect formatting of hover actions 2024-06-06 21:07:59 +08:00
bors
49dd2d3d29 Auto merge of #17352 - roife:fix-issue-17338, r=Veykril
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-06 09:40:39 +00:00
roife
07fde0779e test: add regression test for prelude shadowing in block modules 2024-06-06 17:03:40 +08:00
roife
6561b71eed fix: do not resolve prelude within block modules 2024-06-06 16:55:09 +08:00
bors
56a298bf3d Auto merge of #17346 - ChosenName:master, r=Veykril
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-06 08:03:17 +00:00
bors
b8e94ddb7d Auto merge of #17350 - Wilfred:mark_missing_file_unused, r=Veykril
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-06 07:49:58 +00:00
bors
3a99bb063a Auto merge of #17349 - Wilfred:update_libc, r=lnicola
chore: Update Cargo.lock to avoid yanked version

Building rust-analyzer currently generates a warning because libc 0.2.154 has been yanked. Update to 0.2.155 in Cargo.lock.
2024-06-06 04:11:34 +00:00
Wilfred Hughes
901c01c279 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.
2024-06-05 17:44:07 -07:00
Wilfred Hughes
9e31bce003 chore: Update Cargo.lock to avoid yanked version 2024-06-05 17:36:36 -07:00
bors
6e7eecc423 Auto merge of #17348 - regexident:fix-type-or-const-param-source, r=Veykril
Use `.get(…)` instead of `[…]` in `TypeOrConstParam::source(…)` and `LifetimeParam::source(…)`

Resolves #17344.
2024-06-05 10:34:31 +00:00
Vincent Esche
bd5f27605a Resolve #17344 by using .get(…) instead of […] in TypeOrConstParam::source(…)
(… and `LifetimeParam::source(…)`)
2024-06-05 11:03:56 +02:00
bors
02c178b780 Auto merge of #17347 - Veykril:inv-offset-err, r=Veykril
minor: Add debug info to invalid offset error

cc https://github.com/rust-lang/rust-analyzer/issues/17289
2024-06-05 08:21:47 +00:00
Lukas Wirth
9559894312 Add debug info to invalid offset error 2024-06-05 10:20:05 +02:00
ChosenName
ca07bf2f8d fmt 2024-06-04 22:16:08 -06:00
ChosenName
728001eb33 fmt 2024-06-04 22:12:54 -06:00
ChosenName
d47848ec99
Update dist.rs 2024-06-04 21:44:07 -06:00
ChosenName
adb7de2c69
Update config.rs 2024-06-04 21:39:37 -06:00
ChosenName
e592d8866f
fmt 2024-06-04 21:35:41 -06:00
ChosenName
48f1b49721
Fix typos 2024-06-04 21:30:36 -06:00
ChosenName
dc1074862b
Update config.rs 2024-06-04 21:09:21 -06:00
ChosenName
b885cea989
Update package.json 2024-06-04 21:08:30 -06:00
bors
4c007c86bb Auto merge of #17004 - Veykril:ide-macro-caching, r=Veykril
Try caching macro calls more aggressively in Semantics
2024-06-04 14:28:52 +00:00
Lukas Wirth
6eab89fd37 Use dyn cache for Semantics macro resolution 2024-06-04 16:25:38 +02:00
Lukas Wirth
8d5e14d408 Cache parse trees in Semantics 2024-06-04 15:29:24 +02:00
Lukas Wirth
c5a5c93ed9 Cache file_to_def in SourceToDefCtx 2024-06-04 15:23:02 +02:00
Lukas Wirth
98769133c6 Try caching macro calls more aggressively 2024-06-04 15:23:00 +02:00
bors
59c3a3a86b Auto merge of #17341 - Veykril:inert-attr, r=Veykril
internal: Cleanup some inert attribute stuff
2024-06-04 10:42:15 +00:00
Lukas Wirth
211af03439 Cleanup some inert attribute stuff 2024-06-04 12:38:20 +02:00
bors
33a902147f Auto merge of #17282 - jkelleyrtp:jk/filter-by-underscorte, r=Veykril
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-04 08:37:56 +00:00
Lukas Wirth
93b87e9719 Recognize __ prefixes for symbol search query 2024-06-04 10:36:04 +02:00
bors
845754af9c Auto merge of #17340 - Veykril:find-path2, r=Veykril
internal: Improve `find_path` performance

cc https://github.com/rust-lang/rust-analyzer/issues/17339, db80216dac3d972612d8e2d12ade3c28a1826ac2 should fix a case where we don't reduce our search space appropriately. This also adds a fuel system which really shouldn't ever be hit, hence why it warns
2024-06-03 18:08:17 +00:00
Lukas Wirth
59cef9c624 Add fuel to find_path 2024-06-03 20:07:00 +02:00
Lukas Wirth
1eecc1863a Remove an allocation in find_path::find_local_import_locations 2024-06-03 19:57:49 +02:00
Lukas Wirth
1244fc5044 Simplify 2024-06-03 19:46:40 +02:00
Lukas Wirth
45a1662c80 Deduplicate 2024-06-03 19:26:11 +02:00
Lukas Wirth
cd265cab64 Fix find_path search not reducing scope appropriately for foreign items 2024-06-03 19:21:19 +02:00
Lukas Wirth
b26a06f678 Simplify 2024-06-03 19:06:58 +02:00
bors
bdd2bd1925 Auto merge of #17329 - Nilstrieb:rustc_deprecated_safe_2024, r=Veykril
Don't mark `#[rustc_deprecated_safe_2024]` functions as unsafe

`std::env::set_var` will be unsafe in edition 2024, but not before it. I couldn't quite figure out how to check for the span properly, so for now we just turn the false positives into false negatives, which are less bad.
2024-06-03 12:44:21 +00:00
bors
af65ff500a Auto merge of #17315 - hamirmahal:style/simplify-string-interpolation, r=Veykril
style: simplify string interpolation
2024-06-03 12:29:27 +00:00
bors
fa41f196b5 Auto merge of #17312 - regexident:function-fn-ptr-type, r=Veykril
Add `Function::fn_ptr_type(…)` for obtaining name-erased function type

The use case of this function if being able to group functions by their function ptr type.

cc `@flodiebold`
2024-06-03 12:16:29 +00:00
bors
fcde6c9b35 Auto merge of #17333 - DropDemBits:extract-format-args-snippet-cap, r=Veykril
fix: Only generate snippets for `extract_expressions_from_format_string` if snippets are supported

Part of #17332

Fixes `extract_expressions_from_format_string` so that it doesn't generate snippets if the client doesn't support it.
2024-06-03 12:03:18 +00:00
bors
1bed783846 Auto merge of #17337 - Veykril:assert-info, r=Veykril
Add path info to `AbsPathBuf::assert`'s assert

cc https://github.com/rust-lang/rust-analyzer/issues/17335
2024-06-02 19:30:55 +00:00
Lukas Wirth
a10d710813 Add path info to AbsPathBuf::assert's assert 2024-06-02 21:28:25 +02:00
DropDemBits
0c7d5c6340
fix typos & formatting 2024-06-02 14:09:36 -04:00
DropDemBits
9e317051b3
Make extract_expressions_from_format_string only use snippets when available 2024-06-02 11:47:05 -04:00
DropDemBits
b9c19c1a46
Add ast::Expr::parse 2024-06-02 11:17:52 -04:00
DropDemBits
becd71f826
minor: tidy up Parse a little bit
- Add doc comments to some `Parse` methods
- Uses `Parse::new` more
2024-06-02 11:10:39 -04:00
DropDemBits
5fc5f63d09
Add tt_from_syntax
Used for inserting syntax nodes into existing token trees
2024-06-02 11:10:07 -04:00