Skip to content

[semantic-tokens] Add support for semantic tokens faces overrides #2826

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 2 commits into from
May 3, 2021

Conversation

ericdallo
Copy link
Member

Related to #2448 (comment)

  • Add support for new option on client definition: semantic-tokens-faces-overrides with support for :types and :modifiers.
    This should allow specific clients to replace the default lsp faces with custom ones.

Rationale: It's common for major modes to use different faces for their symbols, with that we could share the same faces that major modes like clojure-mode uses, reducing the impact to users and following the same standard.

@ericdallo ericdallo self-assigned this May 2, 2021
@github-actions github-actions bot added the client One or more of lsp-mode language clients label May 2, 2021
@@ -378,6 +378,23 @@ IS-RANGE-PROVIDER is non-nil when server supports range requests."
(lsp-warn "No face has been associated to the %s '%s': consider adding a corresponding definition to %s"
category id varname)) maybe-face)) identifiers)))

(defun lsp-semantic-tokens--replace-alist-values (a b)
"Replace alist A values with B ones if exists."
Copy link
Contributor

Choose a reason for hiding this comment

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

if exists sounds strange; not sure how to formulate this correctly without blowing up the docstring's length though. Maybe "if present" or "where available" would be slightly better?
Apart from that, the changes look good to me and seem to work as intended (tested with clojure-lsp)

@ericdallo ericdallo enabled auto-merge (squash) May 3, 2021 13:43
@ericdallo ericdallo merged commit b2606d9 into master May 3, 2021
@ericdallo ericdallo deleted the add-semantic-tokens-faces-overrides branch May 3, 2021 13:50
foldu pushed a commit to foldu/lsp-mode that referenced this pull request May 4, 2021
…acs-lsp#2826)

* Add support for semantic tokens faces overrides

* Improve doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client One or more of lsp-mode language clients semantic-tokens
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants