Commit Graph

27301 Commits

Author SHA1 Message Date
bors
42cb1a2bd7 Auto merge of #16465 - Veykril:eprintln, r=Veykril
minor: Remove `stdx::eprintln` overwrite
2024-01-31 21:07:50 +00:00
Lukas Wirth
23f4b7f45f Remove stdx::eprintln overwrite 2024-01-31 22:06:05 +01:00
bors
1ab1a25bba Auto merge of #16463 - clubby789:remove-abi_amdgpu_kernel, r=lnicola
internal: Remove `abi_amdgpu_kernel` references

This feature was removed in https://github.com/rust-lang/rust/pull/120495
2024-01-31 19:43:36 +00:00
clubby789
a1fdb876c3 Remove abi_amdgpu_kernel references 2024-01-31 19:06:10 +00:00
bors
039681112f Auto merge of #16456 - davidbarsky:david/tracing-followups, r=Veykril
internal: `tracing` improvements and followups

Hi folks! Building on https://github.com/rust-lang/rust-analyzer/pull/16394, I've got a few small tweaks:
- Removed the accidental `mod.rs` usage that I introduced.
- Removed a panic in `pat_analysis.rs`.
- Recorded the event kind in `handle_event` to better distinguish what _kind_ of event is being handled.
- Did a small refactor of `hprof` to have somewhat more linear control flow, and more importantly, write the recorded fields to the output.

The end result is the following:
<img width="1530" alt="A screenshot of Visual Studio Code on a Mac. `hprof.rs` is open, with " src="https://github.com/rust-lang/rust-analyzer/assets/2067774/bd11dde5-b2da-4774-bc38-bcb4772d1192">
2024-01-31 18:29:51 +00:00
David Barsky
44494e235a internal: teach hprof to record tracing fields 2024-01-31 13:15:47 -05:00
David Barsky
579e98c4c5 internal: record Event kind in handle_event 2024-01-31 13:00:40 -05:00
David Barsky
251b14f2c5 internal: don't panic in debug_pat 2024-01-31 13:00:30 -05:00
bors
355c9444e1 Auto merge of #16448 - Young-Flash:typos, r=lnicola
minor: correct typos

I use [crate-ci/typos](https://github.com/crate-ci/typos) to check typos in codebase, if it's ok with you, I'd like to add a typo check CI using [typos](https://github.com/crate-ci/typos) (with Apache-2.0, MIT licenses).

BTW, we can add a [_typos.toml](https://github.com/crate-ci/typos/blob/master/docs/reference.md) as white list for some intentional typos
2024-01-31 13:29:55 +00:00
Young-Flash
62ff8f33d4 minor: correct close to closure 2024-01-31 21:26:30 +08:00
bors
9d837a622d Auto merge of #16445 - lnicola:bump-scip, r=lnicola
internal: Bump scip

Fixes #16440
2024-01-31 09:27:01 +00:00
bors
2661c272c9 Auto merge of #16461 - Veykril:expansion-info, r=Veykril
internal: Remove unnecessary usages of ExpansionInfo

And some follow up simplifications to https://github.com/rust-lang/rust-analyzer/pull/16439
2024-01-31 08:58:55 +00:00
Lukas Wirth
d252247ab7 internal: Remove unnecessary usages of ExpansionInfo 2024-01-31 09:57:17 +01:00
bors
e48bc04eaf Auto merge of #16459 - Veykril:diagnostics, r=Veykril
internal: Use improved adjusted_display_range for all diagnostics
2024-01-31 08:17:53 +00:00
Lukas Wirth
604479c373 internal: Use improved adjusted_display_range for all diagnostics 2024-01-31 09:16:30 +01:00
bors
e4146af294 Auto merge of #16441 - Young-Flash:exclude_tests_refs, r=Veykril
feat: enable excluding refs search results in test

## Change

Here I introduce a new `ReferenceCategory::Test` type to indicate whether the function where this reference is located is marked as `#[test]`, and expose an config item (`rust-analyzer.references.excludeTests`) to client.

I also changed the signature of `ReferenceCategory::new`, adding a `sema: &Semantics<'_, RootDatabase>` param to do some hir analysis. Hope the current implementation is good to go.

## Demo

`"rust-analyzer.references.excludeTests": false`

![include](https://github.com/rust-lang/rust-analyzer/assets/71162630/9f1176d4-7b41-4f49-ac79-55d25a42d5d1)

`"rust-analyzer.references.excludeTests": true`

![exclude](https://github.com/rust-lang/rust-analyzer/assets/71162630/2938b44b-9e5b-48de-a049-453f5bbc09d0)

close https://github.com/rust-lang/rust-analyzer/issues/14530
2024-01-31 07:53:28 +00:00
bors
9a832c47e8 Auto merge of #16453 - Veykril:brackets, r=Veykril
internal: Undo special bracket classification for attributes in vscode config

I changed this thinking the `#` could be considered part of the bracket but on second though I don't think that's quite right in general.

Fixes https://github.com/rust-lang/rust-analyzer/issues/16449
2024-01-30 19:06:41 +00:00
Lukas Wirth
8f1a253a4c internal: Undo special bracket classification for attributes in vscode config 2024-01-30 20:04:37 +01:00
David Barsky
17d2e8d910 internal: remove tracing/mod.rs 2024-01-30 13:37:27 -05:00
bors
d923d620f2 Auto merge of #16394 - davidbarsky:david/add-more-tracing-spans, r=Veykril
internal: add some `tracing` to {Request, Notification}Dispatch

Some of the tracing config would need to be changed in order to benefit more from this (especially `.with_span_events(FmtSpan::CLOSE)`), which provides span events like the following:

```
2024-01-18T02:41:06.675779Z  INFO request{method="textDocument/codeLens" request_id=RequestId(I32(17))}: rust_analyzer::dispatch: close time.busy=61.8µs time.idle=5.29µs
```

I dunno if y'all need `LoggerFormatter` in here, but if you don't, I'd be happy to yeet it out of rust-analyzer. In any case, this provided a pretty decent amount of information in the logs, and I can expand this as needed or we can land this PR and expand later.
2024-01-30 17:42:47 +00:00
David Barsky
e1ea7c8844 internal: switch to tracing from log
This commit also adds `tracing` to NotificationDispatcher/RequestDispatcher,
bumps `rust-analyzer-salsa` to 0.17.0-pre.6, `always-assert` to 0.2, and
removes the homegrown `hprof` implementation in favor of a vendored
tracing-span-tree.
2024-01-30 12:27:31 -05:00
bors
63123ab408 Auto merge of #16417 - davidsemakula:normalize-use-trees, r=Veykril
feat: "Normalize import" assist and utilities for normalizing use trees

- Add import/use tree normalization utilities
- Add "normalize import" assist
- Update "merge imports" assist to always apply to the covering use item except for nested use tree selections
- Update "merge imports" assist to avoid adding unnecessary braces when merging nested use tree selections

See [this discussion](https://github.com/rust-lang/rust-analyzer/pull/16372#discussion_r1457244321) for the motivation for the new "normalize import" assist and changes to the "merge imports" assist.
2024-01-30 14:55:08 +00:00
bors
da4d5f8f29 Auto merge of #16413 - Urhengulas:clippy-ci, r=Veykril
internal: Add `clippy` to CI

Follow-up to #16401
2024-01-30 14:41:43 +00:00
Johann Hemmann
43b1ae0446 cargo clippy --fix 2024-01-30 14:50:21 +01:00
Johann Hemmann
628f70156e CI: Don't deny clippy warnings
We configure that in the lint table in `Cargo.toml`.
2024-01-30 14:44:44 +01:00
Johann Hemmann
73c7c729c5 CI: add clippy 2024-01-30 14:44:44 +01:00
Johann Hemmann
75a42f1a09 collapsible_if 2024-01-30 14:44:44 +01:00
Young-Flash
db9fd370ee minor: correct typos 2024-01-30 21:43:43 +08:00
davidsemakula
dba3fc4425 style: remove unnecessary macro 2024-01-30 16:15:15 +03:00
bors
11b401d0b4 Auto merge of #16447 - Veykril:mir-errors, r=Veykril
intenral: Cleanup error variants in MIR code a bit
2024-01-30 11:38:41 +00:00
bors
22b6f9679d Auto merge of #16439 - wasd96040501:feat/gotodef3, r=Veykril
feat: Support for GOTO def from *inside* files included with include! macro

close #14937
Try to implement goto def from *inside* files included with include! macro.
This implementation has two limitations:
1. Only **one** file which calls include! will be tracked. (I think multiple file be included is a rare case and we may let it go for now)
2. Mapping token from included file to macro call file (semantics.rs:646~658) works fine but I am not sure is this the correct way to implement.
2024-01-30 11:27:18 +00:00
Lukas Wirth
5860763f18 Cleanup error variants in MIR code slightly 2024-01-30 09:53:39 +01:00
Laurențiu Nicola
20c01672a8 Bump scip 2024-01-30 08:43:17 +02:00
bors
d13951f25c Auto merge of #15730 - Alainx277:let-else-postfix, r=Veykril
Add postfix completion for let else

Adds a postfix completion for let else syntax, similar to the if let postfix.
2024-01-29 14:57:38 +00:00
Young-Flash
2b71acac4f test: add full path ref exclude test case 2024-01-29 18:47:58 +08:00
Young-Flash
6181102567 fix: use Semantics to judge whether a func is marked as #[test] 2024-01-29 18:42:41 +08:00
Young-Flash
1bd21e98c0 test: add test for excluding refs 2024-01-28 18:39:42 +08:00
Young-Flash
6f303f49fe feat: enable excluding refs search results in test 2024-01-28 18:28:13 +08:00
davidsemakula
84e13145ff add more tests for normalize import assist 2024-01-28 11:55:01 +03:00
davidsemakula
fc00602723 merge imports assist avoids adding unnecessary braces when merging nested use tree selections 2024-01-28 11:55:01 +03:00
davidsemakula
b241593f36 merge imports assist always applies to covering use item except for nested use tree selections 2024-01-28 11:55:01 +03:00
davidsemakula
a8a18f3ccf add normalize import assist 2024-01-28 11:55:01 +03:00
davidsemakula
81d713ea9f remove ordered insert logic from recursive merge function 2024-01-28 11:55:01 +03:00
davidsemakula
8fab92feb2 normalize use trees when merging imports 2024-01-28 11:55:01 +03:00
YangzeLuo
b22e772cab feat: Support for GOTO def from *inside* files included with include! macro 2024-01-27 23:36:01 +08:00
Alain Siegrist
7ec32d091a Remove letelse control flow snippets 2024-01-27 14:35:22 +01:00
Alain Siegrist
51d57b9bb6 Make return a snippet 2024-01-27 14:35:22 +01:00
Alain Siegrist
57934ac47a Add postfix completion for let else 2024-01-27 14:35:22 +01:00
davidsemakula
da798bccf7 make ast::UseTree::wrap_in_tree_list more robust 2024-01-27 14:22:16 +03:00
bors
7219414e81 Auto merge of #16427 - Young-Flash:fix_no_such_field_diagnostics, r=Veykril
fix: filter out cfg disabled filed when lowering `RecordPat`

we should filter out field with disabled cfg when lowering ast `RecordPat` to hir.

close https://github.com/rust-lang/rust-analyzer/issues/16169
2024-01-27 10:52:36 +00:00