Git Product home page Git Product logo

Comments (4)

antoineco avatar antoineco commented on June 11, 2024

Possibly Tree-sitter, but most likely LSP semantic highlights.

Could you please share the output(s) of :Inspect while hovering both symbols?

from sonokai.

CharlieCheckpt avatar CharlieCheckpt commented on June 11, 2024

Thank you for reply.

my_var: @variable.python links to Fg python
Myvar: @variable.python links to Fg python, @type.python links to BlueItalic python

Actually, after disabling the highlight of treesitter, the two variables have the same color. But then in general the theme looks less nice

from sonokai.

antoineco avatar antoineco commented on June 11, 2024

In Python uppercase names are often used for classes, so I assume that Tree-sitter treats all uppercase variables as types.

Using a LSP server with semantic highlights should fix that. It works in combination with Tree-sitter but provides more accurate context.

Otherwise, you can override the highlight for Python types in your init.lua file, with the side effect that actual Python types will be highlighted like variables:

-- Apply custom highlights on colorscheme change.
-- Must be declared before executing ':colorscheme'.
local grpid = vim.api.nvim_create_augroup('custom_highlights_sonokai', {})
vim.api.nvim_create_autocmd('ColorScheme', {
  group = grpid,
  pattern = 'sonokai',
  callback = function()
    local config = vim.fn['sonokai#get_configuration']()
    local palette = vim.fn['sonokai#get_palette'](config.style, config.colors_override)
    local set_hl = vim.fn['sonokai#highlight']

    set_hl('@type.python', palette.fg, palette.none)
  end
})

from sonokai.

CharlieCheckpt avatar CharlieCheckpt commented on June 11, 2024

Very clear, thank you !

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.