Commit graph

66 commits

Author SHA1 Message Date
Chayim Refael Friedman
f8e2fa0e80 Make AsmExpr have AstId
We need it because `global_asm!()` is an item. It's unfortunate that such thing can slip in and I see no way to automatically catch that, but thankfully analysis-stats on self has caught that.
2025-07-09 21:43:20 +03:00
Chayim Refael Friedman
edb804a100 Don't hash the SyntaxKind in the ast id
There is no need to, it's already stored in the `kind`.
2025-07-09 17:21:45 +03:00
Lukas Wirth
8029c731ed Bump salsa 2025-07-03 10:05:16 +02:00
Chayim Refael Friedman
3e834add61 Support spans with proc macro servers from before the ast id changes
The only thing changed is the value of the fixup ast id, so we just swap it.
2025-06-12 16:08:48 +03:00
Chayim Refael Friedman
4bcf03e28b Use stable AST IDs
Instead of simple numbering, we hash important bits, like the name of the item.

This will allow for much better incrementality, e.g. when you add an item. Currently, this invalidates the IDs of all following items, which invalidates pretty much everything.
2025-06-12 08:47:22 +03:00
Lukas Wirth
f0e39c77cc Add some more hir_expand::files conversions 2025-05-30 14:48:56 +02:00
Lukas Wirth
9fa647c129 Update salsa 2025-04-29 19:26:19 +02:00
Lukas Wirth
4cc6ee3f01 refactor: Remove unnecessary extension trait 2025-04-29 13:53:57 +02:00
Chayim Refael Friedman
f44e01e3d0 Switch AstIdMap to hashbrown::HashTable from the raw API
It's the intended use.
2025-04-25 12:57:13 +03:00
Chayim Refael Friedman
6e4abf126e Account for IngredientCache::get_or_create() taking &Zalsa and not &dyn Database 2025-04-22 15:20:07 +03:00
Chayim Refael Friedman
db72e2ff41 Adjust for salsa::Id::from_u32() being unsafe
This impacts our manual `salsa::Id` wrappers. I refactored them a bit to improve safety.
2025-04-22 15:19:35 +03:00
Chayim Refael Friedman
c58ddafe90 Make HirFileId, EditionedFileId and macro files Salsa struct
And make more queries non-interned.

Also flip the default for queries, now the default is to not intern and to intern a query you need to say `invoke_interned`.
2025-04-19 22:10:52 +03:00
Lukas Wirth
7b9e0911b5 chore: Remove salsa dependency from proc-macro server again 2025-03-27 07:27:57 +01:00
Lukas Wirth
a06aadb9f0 internal: Render root syntax contexts more clearly 2025-03-16 16:26:07 +01:00
BenjaminBrienen
7535bb4661 cargo fmt 2025-03-15 21:32:01 +01:00
Lukas Wirth
02a793bd59 chore: Remove legacy SyntaxContextId re-export 2025-03-15 17:09:17 +01:00
David Barsky
74620e64ec internal: port rust-analyzer to new Salsa 2025-03-10 13:30:51 -04:00
Chayim Refael Friedman
97afb7bfba Make edition per-token, not per-file
More correctly, *also* per-token. Because as it turns out, while the top-level edition affects parsing (I think), the per-token edition affects escaping of identifiers/keywords.
2025-01-09 05:43:08 +02:00
Lukas Wirth
714b81bec1 Decouple proc-macro server protocol from the server implementation 2024-12-30 10:33:57 +01:00
Lukas Wirth
5211972743 internal: Split serde derive feature into serde_derive usage
Ideally we'd not have any dependency pull in the derive feature for faster build times, once that is the case this change would have an actual effect.
See https://github.com/matklad/macro-dep-test/blob/master/README.md for context.
2024-12-20 11:55:02 +01:00
Lukas Wirth
3d63140758 Remove salsa from proc-macro server dep tree 2024-12-18 10:24:26 +01:00
David Barsky
e5c656d804 internal: log original syntax on panic 2024-10-23 12:56:00 -07:00
David Barsky
ccee36e8dd chore: rename salsa to ra_salsa 2024-10-14 10:09:22 -04:00
Lukas Wirth
24d65bb7cf internal: Filter out opaque tokens in some of IDE feature macro descensions 2024-10-04 11:53:12 +02:00
Chayim Refael Friedman
b275f37db6 Fix a bug in span map merge, and add explanations of how span maps are stored
Because it took me hours to figure out that contrary to common sense, the offset stored is the *end* of the node, and we search by the *start*. Which is why we need a convoluted `partition_point()` instead of a simple `binary_search()`. And this was not documented at all. Which made me make mistakes with my implementation of `SpanMap::merge()`.

The other bug fixed about span map merging is correctly keeping track of the current offset in presence of multiple sibling macro invocations. Unrelated, but because of the previous issue it took me hours to debug, so I figured out I'll put them together for posterity.
2024-09-23 01:54:40 +03:00
Chayim Refael Friedman
cfb701ac78 Get rid of $crate in expansions shown to the user
Be it "Expand Macro Recursively", "Inline macro" or few other things.

We replace it with the crate name, as should've always been.
2024-09-18 18:30:59 +03:00
cuishuang
680de15ec3 chore: fix some comments
Signed-off-by: cuishuang <imcusg@gmail.com>
2024-09-02 18:33:23 +08:00
Vincent Esche
7dec7e92ea Replace [package.repository] = "…" of published crates with [package.repository.workspace] = true 2024-08-06 00:26:42 +02:00
Vincent Esche
6f329e6d5b Add repository URL for published crates' missing [package.repository] fields 2024-08-06 00:25:02 +02:00
Vincent Esche
b5b0f4bc5a Replace "TBD" with more helpful desciptions in published crates' [package.description] fields 2024-08-06 00:25:02 +02:00
bors
fbed308ebe Auto merge of #17799 - Veykril:syntax-bridge, r=Veykril
Split out syntax-bridge into a separate crate

This functionality is not really tied to mbe macros, so imo it has no place in that crate.
2024-08-05 12:31:45 +00:00
Lukas Wirth
188c577855 Newtype ErasedFileAstId 2024-08-05 13:46:47 +02:00
Lukas Wirth
d2dd4f6d5f Split out syntax-bridge into a separate crate 2024-08-05 13:45:00 +02:00
Lukas Wirth
d46060b168 Fix error spans for include! and compile_error! 2024-07-29 15:57:01 +02:00
Lukas Wirth
9cbafa2d49 Remove Params and Fields from AstIdMap 2024-07-25 10:22:05 +02:00
Lukas Wirth
5264f86242 Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
Wilfred Hughes
d68e549205 internal: Fix rustdoc warnings
`cargo doc` generates a bunch of warnings on rust-analyzer. Fix all the
bare URL and empty code block warnings.
2024-06-13 17:29:10 -07:00
Lukas Wirth
8ebabce475 internal: Remove FileId::BOGUS 2024-06-12 08:16:07 +02:00
Hamir Mahal
7c34eb3880
style: simplify string interpolation 2024-05-30 16:18:49 -07:00
Lukas Wirth
4135696ea7 Cleanup 2024-04-18 11:00:22 +02:00
Lukas Wirth
6bfdd38c69 Render matched macro arm on hover of macro calls 2024-04-18 10:51:58 +02:00
Lukas Wirth
9c75e9fa7d Deduplicate Edition enum 2024-04-14 15:29:01 +02:00
Lukas Wirth
255a8aef92 Move Edition into span crate 2024-03-21 10:21:44 +01:00
Lukas Wirth
0dd89d7ee7 Remove usages of SpanData where Span suffices 2024-03-15 13:02:40 +01:00
Lukas Wirth
d2f8eae2ec feat: Support macro calls in eager macros for IDE features 2024-03-14 15:40:35 +01:00
Lukas Wirth
9ba4493918 internal: Improve rooted upmapping 2024-03-12 13:46:58 +01:00
Lukas Wirth
c04c0dd5ba fix: Don't force draw a dependency edge to the real_span_map query 2024-03-07 14:14:59 +01:00
Lukas Wirth
efd76ecff1 Move AstIdMap infra to the span crate 2024-03-01 15:39:44 +01:00
Lukas Wirth
549aae7c07 Add a few more doc lines to the span crate 2024-03-01 15:20:30 +01:00
Lukas Wirth
8a5bb9d5ac Only the ROOT syntax context has None outer_expn 2024-03-01 15:14:17 +01:00