Git Product home page Git Product logo

Comments (6)

huyhoang8398 avatar huyhoang8398 commented on June 11, 2024 1
Screen.Recording.2023-07-17.at.20.08.31.mov

Here is the video, you could see wget is highlighted as green and then becoming white

from sonokai.

antoineco avatar antoineco commented on June 11, 2024 1

Oh, you have the LSP server for Dockerfile active apparently, and that LSP server has semantic tokens enabled. LSP semantic token are providing extra highlighting in addition to Tree-sitter.

Support for LSP semantic tokens was added in Sonokai in #86.

In sainnhe/everforest#119, I tried to determine whether we could customize those color schemes ever further to improve the experience with LSP semantic tokens, but my conclusion was that LSP semantic tokens highlights sometimes conflict with Tree-sitter pretty badly. From my experience, this feature degrades the highlights more than it improves them. For instance, I wasn't able to enhance highlights for the Go language due to the priority that the LSP semantic token highlights were given over Tree-sitter's.

Thanks a lot for the video 👍 I will check whether we can improve the Dockerfile file type specifically for LSP semantic tokens. In case that's not possible, it's probably best to disable that feature.

from sonokai.

huyhoang8398 avatar huyhoang8398 commented on June 11, 2024 1
Screenshot 2023-07-17 at 23 42 32

I was able to disable this feature in dockerls with the following lspconfig:

After disable tthat feature, it's working well now, thanks

from sonokai.

antoineco avatar antoineco commented on June 11, 2024

Yes, you simply need to enable Tree-sitter for the "Dockerfile" filetype with :TSInstall dockerfile.

Here is how it looks for me:

image

from sonokai.

huyhoang8398 avatar huyhoang8398 commented on June 11, 2024
Screenshot 2023-07-17 at 20 01 34 It's strange, after i open nvim, i did see the highlight, but after 1 sec, it looks like this then

from sonokai.

antoineco avatar antoineco commented on June 11, 2024

I just investigated the issue, and unfortunately LSP semantic highlights override Tree-sitter entirely in this case.

Tree-sitter has smart queries which allows detecting and highlighting sh/bash inside Dockerfiles. You can see it in the screenshot below as:

Treesitter
  - @variable.bash links to @variable bash    <!-- bash detected -->
  - @constant.bash links to @constant bash

Unfortunately, as soon as LSP semantic tokens are enabled, everything becomes a "parameter" instead, and the embedded highlights are overridden:

Semantic Tokens
  - @lsp.type.parameter.dockerfile links to @parameter priority: 125  <!-- higher priority than Tree-sitter -->

Screenshot:

image

That's why all the colors disappear in your video. I see the exact same behavior in my Neovim with the dockerls LSP server enabled.


I was able to disable this feature in dockerls with the following lspconfig:

local lspconfig = require "lspconfig"

lspconfig.dockerls.setup {
  on_attach = function(client, bufnr)
    client.server_capabilities.semanticTokensProvider = nil
  end,
}

image

from sonokai.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.