8000 Allow semantic highlighting to unset bold and italic by gregdyke · Pull Request #1153 · eclipse-lsp4e/lsp4e · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

gregdyke
Copy link
Contributor
@gregdyke gregdyke commented Dec 4, 2024

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

@rubenporras
Copy link
Contributor

@mickaelistria , do you know what is the problem with the License Check? It looks like it is completely broken.

@mickaelistria
Copy link
Contributor

ClearlyDefined is fragile, it's probably a connection issue.

@mickaelistria
Copy link
Contributor

license check is OK now.

@rubenporras
Copy link
Contributor

@akurtakov , @mickaelistria :

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.

@akurtakov
Copy link
Contributor

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"
@rubenporras
Copy link
Contributor

Thanks for the reply, I have marked the test as ignore for the moment.

@rubenporras
Copy link
Contributor

There is one test that is failing on Mac OS unrelated to this PR, so I am merging it.

@rubenporras rubenporras merged commit 803ae83 into eclipse-lsp4e:main Dec 5, 2024
4 of 6 checks passed
@mickaelistria
Copy link
Contributor

Do you know what is the URL now of that page?

The http://org.eclipse.ui.intro is a special interpretation by the eclipse intro framework to process the following parts of the URL and convert them into an action invocation. This was one way to allow triggering IDE actions from the LSP, I think before commands were properly specified in LSP.
I don't mind if we ignore it at the moment, I don't expect any existing serious LS to actually leverage this Eclipse-specific feature.

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.

4 participants
0