primer / github-vscode-theme

GitHub's VS Code themes
https://marketplace.visualstudio.com/items?itemName=GitHub.github-vscode-theme
MIT License
1.89k stars 189 forks source link

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

Open jessevdp opened 10 months ago

jessevdp commented 10 months ago

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 commented 10 months ago

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 commented 9 months ago

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