Lukas Wirth
bf669dab84
Re-implement rust string highlighting via tool attribute
2025-01-10 13:49:35 +01:00
Chayim Refael Friedman
ce323627c5
Support the new CoercePointee derive
2025-01-04 18:35:53 +02:00
Lukas Wirth
5ce14b0439
Enforce a current directory being set for spawned commands
2024-12-29 12:51:13 +01:00
Lukas Wirth
28fbecff42
Show expansion errors in expand_macro feature
2024-12-13 09:36:03 +01: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
Lukas Wirth
64064907ce
Fully remove old macro descension API
2024-08-22 16:18:01 +02:00
Chayim Refael Friedman
9d3368f2c2
Properly account for editions in names
...
This PR touches a lot of parts. But the main changes are changing
`hir_expand::Name` to be raw edition-dependently and only when necessary
(unrelated to how the user originally wrote the identifier),
and changing `is_keyword()` and `is_raw_identifier()` to be edition-aware
(this was done in #17896 , but the FIXMEs were fixed here).
It is possible that I missed some cases, but most IDE parts should properly
escape (or not escape) identifiers now.
The rules of thumb are:
- If we show the identifier to the user, its rawness should be determined
by the edition of the edited crate. This is nice for IDE features,
but really important for changes we insert to the source code.
- For tests, I chose `Edition::CURRENT` (so we only have to (maybe) update
tests when an edition becomes stable, to avoid churn).
- For debugging tools (helper methods and logs), I used `Edition::LATEST`.
2024-08-16 16:46:24 +03:00
Lukas Wirth
5264f86242
Encode edition within FileId in the hir layer
2024-07-18 08:49:10 +02:00
Lukas Wirth
bf9a7264d1
Invert matching on builtin macros in expand_allowed_builtins
2024-06-20 10:31:20 +02:00
Ishan Jain
5465979b7a
updated tests
2024-06-19 16:11:50 +05:30
Ishan Jain
020537cd06
Created expand_allowed_builtins, updated expand_macro to call this function
2024-06-15 15:20:46 +05:30
Ishan Jain
7c37e57426
added tests
2024-06-14 09:17:56 +05:30
Lukas Wirth
580b8dab1a
Expand macro recursively expands both fp-like and attribute macros intertwined
2024-05-14 10:58:18 +02:00
Lukas Wirth
60d3a7320e
Differentiate between full configs and toml only config groupings
2024-04-15 14:16:43 +02:00
Lukas Wirth
c310aee8d6
For toolchain binaries ue the full path found in $PATH
2024-03-05 10:17:09 +01:00
roife
ec5236f3a8
test: use 4 spaces for indetation in macro expansion
2024-02-27 20:53:07 +08:00
Lukas Wirth
7dd9f20ce3
Builtin derives are hygienic
2024-01-08 12:50:11 +01:00
Lukas Wirth
634d588fd7
Simplify
2023-12-06 14:36:39 +01:00
Lukas Wirth
d2cd30007c
Implicit format args support
2023-12-05 17:07:00 +01:00
Lukas Wirth
5b8e386bae
Improve macro descension API
2023-12-05 17:06:57 +01:00
Lukas Wirth
02a3a9438a
Some more minor cleanups
2023-12-02 17:04:13 +01:00
Lukas Wirth
30093a6d81
spans always come from real file
2023-11-28 10:55:39 +01:00
Lukas Wirth
890eb17b4e
Replace ID based TokenMap with proper relative text-ranges / spans
2023-11-28 10:55:39 +01:00
Laurențiu Nicola
cace36cade
Make Expand macro command title more explicit
2023-11-12 11:43:46 +02:00
Lukas Wirth
53b292478d
internal: Add offset param to token descending API
2023-08-16 10:07:18 +02:00
Lukas Wirth
c7ef6c25b7
internal: Replace Display impl for Name
2023-05-24 20:55:12 +02:00
hkalbasi
d9f4cbbe8f
Emit function bodies in expanding builtin derives
2023-05-03 14:14:47 +03:30
hkalbasi
c54cb88950
Add bounds for associated types in derive macro
2023-04-07 19:33:14 +03:30
Lukas Wirth
435d585d0c
Revert "Add bounds for fields in derive macro"
2023-04-07 11:01:17 +02:00
hkalbasi
0241b52dad
Add bounds for fields in derive macro
2023-04-07 02:21:46 +03:30
Ryo Yoshida
613e008593
Don't append "!" to non-bang macro name
2023-04-02 20:13:34 +09:00
Daniel Eades
ed128872eb
remove needless borrows
2023-01-02 14:52:32 +00:00
Jonas Schievink
bd7dfac5eb
Fix r-a spelling in some places
2022-08-01 13:47:09 +02:00
Amos Wenger
7e285e1ef5
Run cargo fmt
2022-07-20 15:06:15 +02:00
Amos Wenger
816f7fe12a
Run cargo fix --edition-idioms
2022-07-20 15:02:08 +02:00
Ryo Yoshida
36d2b43dfd
fix: improve whitespace insertion in pretty printer
2022-06-28 20:44:55 +09:00
Lukas Wirth
76ae5434fa
internal: Bump Dependencies
2022-06-10 17:30:02 +02:00
Lukas Wirth
86d1d9067e
fix: Insert whitespace into trait-impl completions when coming from macros
2022-05-24 22:56:33 +02:00
andylizi
e34ae760f0
add test for macro expand formatting
2022-05-24 12:45:58 +08:00
andylizi
ebf8b1a96e
ide: insert whitespaces surrounding _ in macro expansion
2022-05-24 07:54:43 +08:00
Lukas Wirth
3de9a42810
Disable rustfmt for expand_macro on wasm platforms
2022-04-17 14:00:19 +02:00
Lukas Wirth
895a16265c
Fix macro patterns not getting formatted properly
2022-04-17 13:46:00 +02:00
Lukas Wirth
e2f1a9a558
feat: Attempt to format expand_macro output with rustfmt if possible
2022-04-17 13:33:39 +02:00
Lukas Wirth
c37fe779c6
Add data queries for macros
2022-03-09 00:41:54 +01:00
Lukas Wirth
ab21cf2f4f
internal: Re-arrange ide_db modules
2022-03-06 19:04:04 +01:00
Lukas Wirth
2e124d15fb
fix: Fix expand_macro always expanding the first listed derive
2022-02-22 12:32:27 +01:00
Lukas Wirth
f13c98034b
Make replace_derive_with_manual_impl work again
2022-02-22 10:20:44 +01:00
Lukas Wirth
be3168dabe
Fix expand_macro not working for derive attributes
2022-02-22 10:20:44 +01:00
Laurențiu Nicola
e14d9208f5
Move pretty-printing test out of assist
2022-01-06 16:38:25 +02:00