Commit Graph

2496 Commits

Author SHA1 Message Date
bors
a1fda6476c Auto merge of #16742 - alibektas:13529/source_root_tree, r=Veykril
internal: Implement parent-child relation for `SourceRoot`s

This commit adds the said relation by keeping a map of type `FxHashMap<SourceRootId,Option<SourceRootId>>` inside the `GlobalState`. Its primary use case is reading `rust-analyzer.toml`(#13529)  files that can be placed in every local source root. As a config will be found by traversing this "tree" we need the parent information for every local source root. This commit omits defining this relation for library source roots entirely.
2024-03-07 10:30:08 +00:00
bors
00f6a7aced Auto merge of #16772 - Veykril:salsa-tracing, r=Veykril
internal: Add tracing spans to macro generated database
2024-03-07 10:16:53 +00:00
Lukas Wirth
9c2fa76c84 Dedup hprof stuff 2024-03-07 10:21:50 +01:00
Lukas Wirth
09d33f3e1e Add diagnostics integrated benchmark 2024-03-07 09:33:48 +01:00
Ali Bektas
9c50d129da Opt for FxHashMap<Id,Id> instead of <Id,Option<Id>> and apply requested changes 2024-03-06 19:55:04 +01:00
Ali Bektas
a15cc86c64 Implement parent-child relation for SourceRoots
This commit adds the said relation by keeping a map of type `FxHashMap<SourceRootId,Option<SourceRootId>>`
inside the `GlobalState`. Its primary use case is reading the rust-analyzer.toml files that can be
placed under every local source root. As a config will be found by traversing this "tree" we need the parent information
for every local source root. This commit omits defining this relation for library source roots entirely.
2024-03-06 19:55:04 +01:00
bors
ce15e73a8e Auto merge of #16773 - Veykril:text-explorer, r=Veykril
fix: Add config and capability for test explorer
2024-03-06 18:26:40 +00:00
Lukas Wirth
1c6d1b4f2a fix: Add config and capability for test explorer 2024-03-06 19:20:58 +01:00
bors
b85d38f7d6 Auto merge of #16755 - Veykril:rustup-bins, r=Veykril
For toolchain binaries use the full path found in $PATH

Fixes https://github.com/rust-lang/rust-analyzer/issues/16754
2024-03-06 14:47:32 +00:00
hkalbasi
44be2432f5 Add test explorer 2024-03-06 00:05:29 +03:30
bors
676455f911 Auto merge of #16757 - Veykril:style-lints, r=Veykril
fix: Put style lints behind disabled-by-default config

Fixes https://github.com/rust-lang/rust-analyzer/issues/16542
Fixes https://github.com/rust-lang/rust-analyzer/issues/16725
cc https://github.com/rust-lang/rust-analyzer/issues/16628

Our diagnostic infra is not yet setup for those kinds of diagnostics
2024-03-05 10:45:05 +00:00
Lukas Wirth
8844640c6f fix: Put style lints behind disabled-by-default config 2024-03-05 11:43:23 +01:00
Lukas Wirth
b20e467373 internal: Adjust a few things for trait assoc item hovers 2024-03-05 11:06:36 +01:00
Lukas Wirth
c310aee8d6 For toolchain binaries ue the full path found in $PATH 2024-03-05 10:17:09 +01:00
bors
ce3216e0ae Auto merge of #15938 - Young-Flash:display_trait_item_when_hover, r=Veykril
feat: add hover display for trait assoc items

This PR enable preview assoc items when hover on `trait`

![image](https://github.com/rust-lang/rust-analyzer/assets/71162630/d9c3949c-33cf-4a32-aa97-3af46b28033a)

inspired by https://github.com/rust-lang/rust-analyzer/pull/15847
2024-03-05 08:26:53 +00:00
Lukas Wirth
0964374274 Move diagnostics docs generation into xtask/codegen 2024-03-04 17:14:14 +01:00
bors
a7e9f12bf7 Auto merge of #16748 - Veykril:on-demand-validation-err, r=Veykril
internal: Compute syntax validation errors on demand

The LRU cache causes us to re-parse trees quite often, yet we don't use the validation errors at all. With this we push calculating them off to the caller who is interested in them.
2024-03-04 11:19:16 +00:00
Lukas Wirth
c3c9f5ffe1 internal: Compute syntax validation errors on demand 2024-03-04 12:06:15 +01:00
bors
99a1b8f7a8 Auto merge of #16747 - Veykril:cleanup, r=Veykril
internal: Clean some stuff up

Just a bunch of small refactorings, mainly from browsing through `hir-def`
2024-03-04 10:30:17 +00:00
Lukas Wirth
4303e741de Cleanup 2024-03-04 11:10:06 +01:00
bors
2074cc28de Auto merge of #16722 - mo8it:allocations, r=Veykril
Avoid some allocations

I went on a small `.clone()` hunting tour :D
2024-03-04 09:17:23 +00:00
Young-Flash
dba67b46a1 update for review 2024-03-02 10:01:04 +08:00
Lukas Wirth
ed7e9aa5d8 Simplify 2024-03-01 13:25:24 +01:00
Lukas Wirth
c8fdcea85c Fix targetDir config name 2024-03-01 13:19:55 +01:00
Lukas Wirth
83a1ad5bfe Give all threads names 2024-03-01 13:19:55 +01:00
mo8it
4aab2d5cb4 Remove unneeded to_owned 2024-02-29 16:29:15 +01:00
mo8it
748f57c16d Only clone when required 2024-02-29 16:28:59 +01:00
Lukas Wirth
4ee0dbdc04 internal: Remove load-cargo dependency on ide 2024-02-28 16:59:04 +01:00
Tavo Annus
a2bf15eede Filter out false positive errors 2024-02-26 20:17:09 +02:00
Graeme Read
30429f8ece
feat: Add short flag -V for consistency with other rust tooling 2024-02-24 06:45:00 +00:00
Lukas Wirth
c6a6e63a45 internal: Pin commit of rust-lang/rust for rustc-test metrics 2024-02-23 17:24:29 +01:00
Lukas Wirth
9b7284dca7 fix: Fix deadlock in recreate_crate_graph <-> file_line_index 2024-02-23 10:10:48 +01:00
Young-Flash
2e87f31fe9 add HoverDisplayConfig 2024-02-22 17:37:40 +08:00
Young-Flash
35ec5955eb add config item for hover display 2024-02-21 11:08:45 +08:00
DropDemBits
07421c13d4
fix: Don't add \ before {
The LSP snippet grammar only specifies that `$`, `}`, and `\` can be escaped with
backslashes, but not `{`.
2024-02-20 14:35:59 -05:00
Lukas Wirth
16b15a203e internal: Attempt to add a timeout to rustc-tests 2024-02-20 18:04:53 +01:00
Lukas Wirth
9dee352da0 fix: server hanging up on build script task 2024-02-20 15:55:17 +01:00
Lukas Wirth
d93096ecc0 internal: Fetch toolchain and datalayout for DetachedFiles 2024-02-20 10:40:39 +01:00
Lukas Wirth
91a8f34aee Deduplicate lsp locations 2024-02-19 12:23:59 +01:00
Johannes Altmanninger
30b992e95a Deduplicate references to macro argument
Commit 6a06f6f72 (Deduplicate reference search results, 2022-11-07) deduplicates references
within each definition.

There is an edge case when requesting references of a macro argument.  Apparently, our
descend_into_macros() stanza in references.rs produces a cartesian product of
- references inside the macro times
- times references outside the macro.

Since the above deduplication only applies to the references within a single definition, we
return them all, leading to many redundant references.

Work around this by deduplicating definitions as well.  Perhaps there is a better fix to not
produce this cartesian product in the first place; but I think at least for definitions the
problem would remain; a macro can contain multiple definitions of the same name, but since the
navigation target will be the unresolved location, it's the same for all of them.

We can't use unique() because we don't want to drop references that don't have a declaration
(though I dont' have an example for this case).

I discovered this working with the "bitflags" macro from the crate of the same name.

Fixes #16357
2024-02-19 12:23:59 +01:00
Young-Flash
f3d84e86c8 minor: fix typo 2024-02-19 18:12:08 +08:00
bors
ac998a74b3 Auto merge of #16579 - DropDemBits:structured-snippet-fix-with-escaped-bits-and-cr, r=Veykril
fix: Fix snippets being placed leftwards of where they should be

Snippet bits were being escaped before placing snippets, shifting snippets leftwards. Snippets were also being shifted leftwards on files with CRLF line endings since they were placed done after the Unix -> DOS line ending conversion.

Hoping this fixes all of the little bugs related to snippet rendering 😅
2024-02-16 18:45:43 +00:00
Lukas Wirth
ead369117a CrateOrigin::Local means local to the project workspace, not cargo workspace 2024-02-16 16:28:17 +01:00
Lukas Wirth
0ccb3b8731 Move dedup-dev-deps tests into rust-analyzer crate 2024-02-16 15:47:40 +01:00
Lukas Wirth
b1404d387a fix: Split toolchain and datalayout out of CrateData 2024-02-16 14:48:25 +01:00
DropDemBits
e8457bb78b
Escape { and } as well
These are used in placeholder snippets, which may occur elsewhere in the insert text.
2024-02-16 00:28:02 -05:00
DropDemBits
1d8ed3408e
Escape snippet bits in-between placing snippets
Done so that we don't shift the range that we insert the snippet at.
2024-02-16 00:28:02 -05:00
DropDemBits
1aeec93412
Only use snippet_text_edit to make snippet SnippetTextEdits
The eventual LSP representation looks like it will diverge from RA's representation of `SnippetTextEdit`s, so this'll make it easier to transition to the LSP representation later.
2024-02-16 00:28:02 -05:00
DropDemBits
e4a3cc34d5
Add better snippet bits test 2024-02-16 00:28:01 -05:00
DropDemBits
e9efb568f6
Add dos line ending test 2024-02-16 00:28:01 -05:00