Skip to content

Conversation

@willothy
Copy link

Problem: When resolve_macro_call fails to resolve a macro, the fallback resolve_path_with_subst prefers type/value namespaces over the macro namespace. This causes macro invocations to be incorrectly highlighted as namespace when a module with the same name exists in scope.

Solution: Use resolve_path_per_ns to check the macro namespace first when in a MacroCall context, falling back to normal path resolution if no macro is found.

Not sure if this is actually the right way to do this since this is my first time working on RA, let me know if this is wrong :)

Before:
Screenshot 2025-12-16 at 3 56 13 PM

After:
Screenshot 2025-12-16 at 3 55 16 PM

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 16, 2025
Problem: When `resolve_macro_call` fails to resolve a macro, the fallback `resolve_path_with_subst`
prefers type/value namespaces over the macro namespace. This causes
macro invocations to be incorrectly highlighted as `namespace` when a
module with the same name exists in scope.
Solution: Use `resolve_path_per_ns` to check the macro namespace first when in a
MacroCall context, falling back to normal path resolution if no
macro is found.
@willothy willothy force-pushed the willothy/fix-colliding-macro-invocation-hl branch from cdc31e9 to 5acf10c Compare December 17, 2025 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants