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

Split punctuation semantic highlighting up into more tags #6238

Merged
merged 1 commit into from
Jan 10, 2021

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Oct 15, 2020

Open question would be the name of the delimiter modifiers. I chose them this was as I see them this way but from what I remember people tend to mix the names however they like. So maybe using delimSquare, delimCurly, delimRound would be better. That would also go well with angle becoming delimAngle?

Closes #6152

@@ -599,7 +599,10 @@ fn highlight_element(
_ if element.parent().and_then(ast::Attr::cast).is_some() => {
HighlightTag::Attribute.into()
}
_ => HighlightTag::Punctuation.into(),
k => match punctuation_modifiers(k) {
Some(modifier) => Highlight::new(HighlightTag::Punctuation) | modifier,
Copy link
Member

Choose a reason for hiding this comment

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

Hm, I think we should have Tag::Punctuation(Bracket | Brace ...), abusing modifiers for this at this level feels wrong.

But probably the best way to lower that to lsp in lsp_conv is indeed via modifiers: IIRC, they planned, but didn't ship inheritance for highlight tags. so we can't have punctuation.brace, where both things are tags. But better to double-check this.

@matklad
Copy link
Member

matklad commented Oct 20, 2020

Stats: blocked on moving kinds of punctuations to tags: #6238 (comment)

@matklad
Copy link
Member

matklad commented Jan 10, 2021

ping @Veykril )

@Veykril
Copy link
Member Author

Veykril commented Jan 10, 2021

Kind of forgot about this PR 😅 This should be what you had in mind I believe right?

@Veykril Veykril changed the title Add semantic highlighting modifiers for punctuations Split punctuation semantic highlighting up into more tags Jan 10, 2021
Copy link
Member

@matklad matklad left a comment

Choose a reason for hiding this comment

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

bors r+

@bors
Copy link
Contributor

bors bot commented Jan 10, 2021

@bors bors bot merged commit 77362c7 into rust-lang:master Jan 10, 2021
HlTag::Punctuation(punct) => match punct {
HlPunct::Bracket => "bracket",
HlPunct::Brace => "brace",
HlPunct::Parenthesis => "parentheses",
Copy link
Member

Choose a reason for hiding this comment

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

Hmm.

This is the plural, I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

I always mix those up

Copy link
Member

Choose a reason for hiding this comment

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

Oof, how do I run the HTML highlighting tests? Even with RUN_SLOW_TEST=1 cargo test nothing fails after changing that line.

Copy link
Member

Choose a reason for hiding this comment

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

Never mind, saving the changed files is a good idea 😄.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add semantic token modifiers for punctuation
3 participants