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

Suppor for textDocument/documentColor #1431

Merged
merged 1 commit into from
Jan 5, 2023

Conversation

angelozerr
Copy link
Contributor

Suppor for textDocument/documentColor

Fixes #639

Signed-off-by: azerr azerr@redhat.com

@angelozerr
Copy link
Contributor Author

To play with this PR with vscode-xml, please use the PR redhat-developer/vscode-xml#849

@angelozerr
Copy link
Contributor Author

angelozerr commented Jan 2, 2023

To test this PR, write this XML color file (android)

<?xml version="1.0" encoding="utf-8"?>
<resources>
	<color name="opaque_red">#f00</color>
	<color name="translucent_red">#80ff0000</color>
</resources>

Write this settings:

"xml.colors": [
      {
         "pattern": "**/res/values/colors.xml",
         "expressions": [
            {
               "xpath": "resources/color/text()"
            }
         ]
      }
   ]

You should see color:

image

@JessicaJHee
Copy link
Contributor

This is a very cool and useful feature! I just noticed that it had some issues when I tried to convert to other color options, but I'm not sure if this is something that can be fixed on our end.

Peek 2023-01-03 10-12

@angelozerr
Copy link
Contributor Author

angelozerr commented Jan 3, 2023

See redhat-developer/vscode-xml#853 for declaring xml.colors settings in vscode-xml side.

@angelozerr angelozerr force-pushed the color branch 3 times, most recently from 4dd68bf to 903edec Compare January 5, 2023 14:23
@angelozerr angelozerr marked this pull request as ready for review January 5, 2023 14:27
@angelozerr angelozerr requested a review from JessicaJHee January 5, 2023 14:27
@fbricon
Copy link
Contributor

fbricon commented Jan 5, 2023

please fix the commit message typo

@angelozerr
Copy link
Contributor Author

please fix the commit message typo

fixed

Copy link
Contributor

@JessicaJHee JessicaJHee left a comment

Choose a reason for hiding this comment

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

Other than the comment I left which hopefully will improve conversion between hex/hexa and rgb/rgba color, it works well and the code looks good!

@angelozerr angelozerr force-pushed the color branch 2 times, most recently from fe95db4 to 4646146 Compare January 5, 2023 16:49
@angelozerr angelozerr force-pushed the color branch 3 times, most recently from fedfff5 to d5608e1 Compare January 5, 2023 17:42
Fixes eclipse-lemminx#639

Signed-off-by: azerr <azerr@redhat.com>
@JessicaJHee JessicaJHee merged commit 771ce44 into eclipse-lemminx:main Jan 5, 2023
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.

Support for textDocument/documentColor
3 participants