Lukas Wirth
fa48bc216c
Revert "feat: Implement module_path
macro"
2024-08-27 08:19:09 +02:00
bors
33c1f57a1a
Auto merge of #17936 - Veykril:module_path, r=Veykril
...
feat: Implement `module_path` macro
Turns out this is a pain to implement because of our hir-def hir-expand split :)
2024-08-23 09:32:27 +00:00
Chayim Refael Friedman
2fa0d4e2a8
When descending into macros in search, first check if there is a need to - i.e. if we are inside a macro call
...
This avoids the need to analyze the file when we are not inside a macro call.
This is especially important for the optimization in the next commit(s), as there the common case will be to descent into macros but then not analyze.
2024-08-22 20:52:51 +03:00
Lukas Wirth
c2a07e21f5
Thread file id through descension API for semantic highlighting
2024-08-22 16:45:37 +02:00
Lukas Wirth
354ab7a9e8
Rename macro descension functions
2024-08-22 16:24:01 +02:00
Lukas Wirth
64064907ce
Fully remove old macro descension API
2024-08-22 16:18:01 +02:00
Lukas Wirth
495118015e
Remove DescendPreference::SameKind
2024-08-22 16:00:57 +02:00
Lukas Wirth
ce8f32022b
Drop MacroInputKind
2024-08-22 12:39:53 +02:00
Lukas Wirth
f979667fb5
Remove DescendPreference::SameText
2024-08-22 12:34:20 +02:00
Lukas Wirth
d44a3ab30c
internal: Implement module_path
macro
2024-08-21 13:50:05 +02:00
dfireBird
8a4261aca8
implement basic inferring of lifetimes
2024-08-16 16:40:32 +05:30
Lukas Wirth
bd4785a6f0
Remove unreachable logic for include token mapping
2024-08-13 09:44:13 +02:00
Lukas Wirth
2362975137
Resolve included files to their calling modules in IDE layer
2024-08-12 13:45:33 +02:00
Lukas Wirth
7beac14cba
Internal: Cleanup proc-macro error handling
2024-07-26 14:38:19 +02:00
Lukas Wirth
5264f86242
Encode edition within FileId in the hir layer
2024-07-18 08:49:10 +02:00
bors
e08f7953f4
Auto merge of #17462 - Veykril:sema-attr-macro-res, r=Veykril
...
fix: Fix IDE features breaking in some attr macros
Fixes https://github.com/rust-lang/rust-analyzer/issues/17453 , Fixes https://github.com/rust-lang/rust-analyzer/issues/17458
2024-06-20 09:11:44 +00:00
Lukas Wirth
ee8a3458ee
fix: Fix IDE features breaking in some attr macros
2024-06-20 11:00:19 +02:00
bors
6738f81b12
Auto merge of #17419 - ishanjain28:filter_builtin_macro_expansion, r=Veykril
...
Filter builtin macro expansion
This PR adds a filter on the types of built in macros that are allowed to be expanded.
Currently, This list of allowed macros contains, `stringify, cfg, core_panic, std_panic, concat, concat_bytes, include, include_str, include_bytes, env` and `option_env`.
Fixes #14177
2024-06-20 08:39:17 +00:00
Lukas Wirth
bf9a7264d1
Invert matching on builtin macros in expand_allowed_builtins
2024-06-20 10:31:20 +02:00
Ishan Jain
19d9bb808d
removed format_args from allowed expansions
2024-06-19 16:58:48 +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
2df806a3a5
allow format_args! expansion
2024-06-14 10:13:41 +05:30
Ishan Jain
0adb0e114f
fixed tests
2024-06-14 09:52:46 +05:30
Ishan Jain
5d5f68af3f
hir/semantics: Only allow expansion of specific built in macros
2024-06-13 10:45:11 +05:30
bors
22648b2655
Auto merge of #17405 - Veykril:modpath-clone, r=Veykril
...
internal: Don't unnecessarily clone ModPaths in early name res
2024-06-12 09:27:49 +00:00
Lukas Wirth
855282fa53
internal: Don't unnecessarily clone ModPaths in early name res
2024-06-12 11:25:19 +02:00
Lukas Wirth
30c04d5aa9
Remove extra parse cache from Semantics again
2024-06-10 12:04:35 +02:00
Wilfred Hughes
27182bb96b
chore: Prefer tracing span shorthand macros
2024-06-06 16:52:25 -07:00
Lukas Wirth
9349045e09
Use dyn cache for Semantics macro resolution
2024-06-04 16:25:38 +02:00
Lukas Wirth
7d40763c88
Cache parse trees in Semantics
2024-06-04 15:29:24 +02:00
Lukas Wirth
c12f093716
Cache file_to_def
in SourceToDefCtx
2024-06-04 15:23:02 +02:00
Lukas Wirth
97b58f2846
Try caching macro calls more aggressively
2024-06-04 15:23:00 +02:00
Lukas Wirth
6f0207d594
Cleanup some inert attribute stuff
2024-06-04 12:38:20 +02:00
Lukas Wirth
3116f76fba
feat: Enable completions within derive helper attributes
2024-06-02 09:45:57 +02:00
Lukas Wirth
c0171bdd32
fix: Fix container search failing for tokens originating within derive attributes
2024-06-01 20:57:29 +02:00
Wilfred Hughes
c981ff0944
fix: Tracing span names should match function names
...
When viewing traces, it's slightly confusing when the span name doesn't
match the function name. Ensure the names are consistent.
(It might be worth moving most of these to use #[tracing::instrument]
so the name can never go stale. @davidbarsky suggested that is marginally
slower, so I've just done the simple change here.)
2024-04-30 11:22:47 -07:00
Lukas Wirth
18ca22a98e
Show workspace info in the status bar
2024-04-26 11:28:33 +02:00
Lukas Wirth
6bfdd38c69
Render matched macro arm on hover of macro calls
2024-04-18 10:51:58 +02:00
David Barsky
5ba37f3f8e
chore: fix a few spans without .entered()
2024-04-17 12:44:49 -04: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
Shoyu Vanilla
fc11216ad5
feat: Add proc macro semantic token type
2024-03-11 22:14:59 +09: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
bors
d8feb908be
Auto merge of #16703 - regexident:sema-ast-to-hir, r=Veykril
...
Add more methods for resolving definitions from AST to their corresponding HIR types
In order to be able to add these methods with consistent naming I had to also rename two existing methods that would otherwise be conflicting/confusing:
`Semantics::to_module_def(&self, file: FileId) -> Option<Module>` (before)
`Semantics::file_to_module_def(&self, file: FileId) -> Option<Module>` (after)
`Semantics::to_module_defs(&self, file: FileId) -> impl Iterator<Item = Module>` (before)
`Semantics::file_to_module_defs(&self, file: FileId) -> impl Iterator<Item = Module>` (after)
(the PR is motivated by an outside use of the `ra_ap_hir` crate that would benefit from being able to walk a `hir::Function`'s AST, resolving its exprs/stmts/items to their HIR equivalents)
2024-03-04 09:02:32 +00:00
Vincent Esche
ed3497883c
Add public function for resolving ast::Expr
to hir::Callable
2024-02-28 16:44:07 +01:00
Vincent Esche
fac8a14de8
Add a more methods for resolving definitions from AST to their corresponding HIR types
2024-02-28 10:27:28 +01:00
Vincent Esche
6112ddfabb
Add prefix file_
to Semantics
's to_module_defs()
/to_module_def()
methods
2024-02-28 10:27:28 +01:00
Lukas Wirth
cc7fe32ba3
fix: Fix completions panicking with certain macro setups
2024-02-27 09:35:57 +01:00
Lukas Wirth
d252247ab7
internal: Remove unnecessary usages of ExpansionInfo
2024-01-31 09:57:17 +01:00