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

Syntax highlighting in combination with Shopify's Ruby LSP semanticHighlighting #373

Open
jessevdp opened this issue Oct 19, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@jessevdp
Copy link

Description

I'm using the GitHub Dark theme in VSCode. The theme seems to not be fully compatible with Shopify's Ruby LSP semantic highlighting feature.

To understand the issue, consider the following 2 screenshots.

Normal With Ruby LSP semanticHighlighting

As you can see, when semanticHighlighting is enabled, both constant declarations & usages of constants are purple, while the latter is usually blue.

Steps to reproduce

  1. Open VSCode
  2. Install ruby-lsp VSCode extension
  3. Install GitHub Theme for VSCode
  4. Enable the GitHub Dark theme
  5. Enable semantic syntax highlighting
  6. Use code like below:
# some_model.rb

class SomeModel < ApplicationRecord
  MyCustomError = Class.new(StandardError)

  def some_operation(some_data)
    raise MyCustomError unless some_precondition?

    self.something = some_data.something_else
    do_some_other_thing if we_need_to?
  end

  private

    def do_some_other_thing
      # ...
    end

end

Version

v6.3.4

Theme

GitHub Dark

@jessevdp jessevdp added the bug Something isn't working label Oct 19, 2023
@jessevdp
Copy link
Author

jessevdp commented Oct 19, 2023

Ruby LSP has some documentation about their semantic highlighting where they specify a token list.

For this particular "issue" the token we're interested in is the namespace one, since its the one where the color changing from blue to purple causes the most confusion.

(I actually like that method invocations are also purple now, since that differentiates from local variables.)

I was able to specify an override in VSCode by adding the following to my settings. The color I used here is from Primer: primer/color/dark -> blue -> 2. This seems to match the original.

{
  "editor.semanticTokenColorCustomizations": {
    "[GitHub Dark]": {
      "rules": {
        "namespace": "#79c0ff"
      }
    }
  },
}

@zs-dima
Copy link

zs-dima commented Dec 1, 2023

Maybe this issues are related:
#335

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants