-
Notifications
You must be signed in to change notification settings - Fork 65
Allow semantic highlighting to unset bold and italic #1153
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
Conversation
697b1e9
to
f813d81
Compare
@mickaelistria , do you know what is the problem with the License Check? It looks like it is completely broken. |
ClearlyDefined is fragile, it's probably a connection issue. |
license check is OK now. |
f813d81
to
8b41c78
Compare
The test org.eclipse.lsp4e.test.hover.HoverTest.testIntroUrlLink() is failing due to I believe Eclipse 2024-12. There is an error message "!MESSAGE Failed to execute IntroURL: http://org.eclipse.ui.intro/execute?command=org.eclipse.ui.file.close Do you know what is the URL now of that page? I could not find it. |
Sorry I have no idea nor I can look into it now. |
Semantic highlighting needs to be able to override the styles set by TM4E. Simply not setting the styles in TM4E would introduce flickering in the delay waiting for semantic highlighting. If unsetting of bold and/or italic is not desired, disable using semanticHighlightReconciler.ignoreBoldNormal and semanticHighlightReconciler.ignoreItalicNormal ---- When applying semantic highlighting, use TextPresentation#mergeStyleRanges to create new style ranges and merge as "usual". Then traverse resulting style ranges and unset bold/italic where it is not set in semantic highlighting. The double traversal algorithm is simplified because after calling TextPresentation#mergeStyleRanges we are guaranteed that each style range from semantic highlighting has exact overlap with 1 or more style ranges in the textPresentation. ---- Because textmate uses css, style {font-weight:"normal"} should be expected to modify the font-weight, whereas {font-weight:"inherit"} should not. However, TM4E parses the style into a an SWT StyleRange which prevents the differentiation between "normal"=unset bold if it is set and "inherit"=don't unset bold if it is set. A more long term solution would use the css to determine whether an unset bold bit is overriding or not. For the medium term we simply say "semantic highlighting has ownership of bold/italic and the style sheet must set them explicitly"
8b41c78
to
670b950
Compare
Thanks for the reply, I have marked the test as ignore for the moment. |
There is one test that is failing on Mac OS unrelated to this PR, so I am merging it. |
The |
Semantic highlighting needs to be able to override the styles set by TM4E. Simply not setting the styles in TM4E would introduce flickering in the delay waiting for semantic highlighting.
If unsetting of bold and/or italic is not desired, disable using semanticHighlightReconciler.ignoreBoldNormal and
semanticHighlightReconciler.ignoreItalicNormal
When applying semantic highlighting, use
TextPresentation#mergeStyleRanges to create new style ranges and merge as "usual". Then traverse resulting style ranges and unset bold/italic where it is not set in semantic highlighting.
The double traversal algorithm is simplified because after calling TextPresentation#mergeStyleRanges we are guaranteed that each style range from semantic highlighting has exact overlap with 1 or more style ranges in the textPresentation.
Because textmate uses css, style {font-weight:"normal"} should be expected to modify the font-weight, whereas {font-weight:"inherit"} should not. However, TM4E parses the style into a an SWT StyleRange which prevents the differentiation between "normal"=unset bold if it is set and "inherit"=don't unset bold if it is set.
A more long term solution would use the css to determine whether an unset bold bit is overriding or not.
For the medium term we simply say "semantic highlighting has ownership of bold/italic and the style sheet must set them explicitly"
This addresses the issue discussed in eclipse-platform/eclipse.platform.ui#2543