Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add proc macro semantic token type #16808

Merged
merged 1 commit into from Mar 11, 2024

Conversation

ShoyuVanilla
Copy link
Contributor

Closes #11529

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 11, 2024
Comment on lines 1240 to 1245
let sa = match self.analyze(macro_call.syntax()) {
Some(it) => it,
None => return false,
};
let macro_call = self.find_file(macro_call.syntax()).with_value(macro_call);
sa.is_proc_macro_call(self.db, macro_call)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let sa = match self.analyze(macro_call.syntax()) {
Some(it) => it,
None => return false,
};
let macro_call = self.find_file(macro_call.syntax()).with_value(macro_call);
sa.is_proc_macro_call(self.db, macro_call)
self.resolve_macro_call(macro_call).map_or(false, |m| matches!(m.id, MacroId::ProcMacroId(..))

No need for SourceAnalyzer::is_proc_macro_call then

crates/ide/src/syntax_highlighting.rs Show resolved Hide resolved
Comment on lines 525 to 527
if inside_proc_macro_call {
highlight |= HlMod::ProcMacro
} else {
highlight |= HlMod::Macro
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if inside_proc_macro_call {
highlight |= HlMod::ProcMacro
} else {
highlight |= HlMod::Macro
}
if inside_proc_macro_call {
highlight |= HlMod::ProcMacro
}
highlight |= HlMod::Macro

I think this makes more sense, that way one doesn't have to handle the proc macro modifier specifically if they are only interested in macros in general

@Veykril
Copy link
Member

Veykril commented Mar 11, 2024

Thanks!
@bors r+

@bors
Copy link
Collaborator

bors commented Mar 11, 2024

📌 Commit fc11216 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Mar 11, 2024

⌛ Testing commit fc11216 with merge 2f87215...

@bors
Copy link
Collaborator

bors commented Mar 11, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 2f87215 to master...

@bors bors merged commit 2f87215 into rust-lang:master Mar 11, 2024
11 checks passed
@ShoyuVanilla ShoyuVanilla deleted the proc-macro-sem-token branch March 11, 2024 13:34
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.

Add proc-macro semantic token type
4 participants