github-vscode-theme icon indicating copy to clipboard operation
github-vscode-theme copied to clipboard

Syntax highlighting in combination with Shopify's Ruby LSP semanticHighlighting

Open jessevdp opened this issue 2 years ago • 2 comments
trafficstars

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 avatar Oct 19 '23 15:10 jessevdp

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"
      }
    }
  },
}

jessevdp avatar Oct 19 '23 15:10 jessevdp

Maybe this issues are related: https://github.com/primer/github-vscode-theme/issues/335

zs-dima avatar Dec 01 '23 19:12 zs-dima