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

No highlights #21

Open
quantum-booty opened this issue Nov 24, 2021 · 13 comments · Fixed by #22
Open

No highlights #21

quantum-booty opened this issue Nov 24, 2021 · 13 comments · Fixed by #22

Comments

@quantum-booty
Copy link

image
I tried it with and without treesitter highlights (commented out).

require('calltree').setup({        -- where the calltree ui will spawn
    layout = "left",
    layout_size = 40,
    jump_mode = "invoking",
    icons = "nerd",
    -- icon_hls = {
    --     Folder = "TSNamespace",
    --     Reference = "TSParameterReference",
    --     Color = "TSType",
    --     Snippet = "TSType",
    --     Keyword = "TSType",
    --     Value = "TSType",
    --     Unit = "TSType",
    --     Text = "TSString",
    --     File = "TSURI",
    --     Module = "TSNamespace",
    --     Namespace = "TSNamespace",
    --     Package = "TSNamespace",
    --     Class = "TSType",
    --     Method = "TSMethod",
    --     Property = "TSMethod",
    --     Field = "TSField",
    --     Constructor = "TSConstructor",
    --     Enum = "TSType",
    --     Interface = "TSType",
    --     Function = "TSFunction",
    --     Variable = "TSConstant",
    --     Constant = "TSConstant",
    --     String = "TSString",
    --     Number = "TSNumber",
    --     Boolean = "TSBoolean",
    --     Array = "TSConstant",
    --     Object = "TSType",
    --     Key = "TSType",
    --     Struct = "TSType",
    --     Null = "TSType",
    --     EnumMember = "TSField",
    --     Struct = "TSType",
    --     Event = "TSType",
    --     Operator = "TSOperator",
    --     TypeParameter = "TSParameter",
    -- }
})

@ldelossa
Copy link
Owner

By default there are no highlights and by default most TS* highlight are not defined.

Try defining these highlights (change the colors to whatever you like):

"calltree
hi CTSymbol                 guifg=#87afd7 gui=underline
hi CTSymbolDetail           ctermfg=024 cterm=italic guifg=#988ACF gui=italic
hi CTSymbolJump             ctermfg=015 ctermbg=110 cterm=italic,bold,underline   guifg=#464646 guibg=#87afd7 gui=italic,bold
hi CTSymbolJumpRefs         ctermfg=015 ctermbg=110 cterm=italic,bold,underline   guifg=#464646 guibg=#9b885c gui=italic,bold
hi CTParameterReference     guifg=#4DC5C6 guibg=None
hi CTURI                    guifg=#988ACF guibg=None
hi CTNamespace              guifg=#87af87 guibg=None
hi CTMethod                 guifg=#0087af guibg=None
hi CTField                  guifg=#0087af guibg=None
hi CTConstructor            guifg=#4DC5C6 guibg=None
hi CTType                   guifg=#9b885c guibg=None
hi CTFunction               guifg=#988ACF guibg=None
hi CTConstant               guifg=#0087af guibg=None
hi CTString                 guifg=#af5f5f guibg=None
hi CTNumber                 guifg=#9b885c guibg=None
hi CTBoolean                guifg=#0087af guibg=None
hi CTConstant               guifg=#0087af guibg=None
hi CTOperator               guifg=#988ACF guibg=None
hi CTParameter              guifg=#988ACF guibg=None

Or you can use my colorscheme which I just pushed these values for:
https://github.com/ldelossa/vimdark

@quantum-booty
Copy link
Author

Ah I see! It would be nice to have a default set of highlight as fallback if they are not specified by the user or by the colorscheme.

@ldelossa
Copy link
Owner

@quantum-booty makes sense, I'll add a function which just uses my theme's highlights as the default set 👍

ldelossa added a commit that referenced this issue Nov 24, 2021
closes #21

this commit adds default highlights to calltree.

all default highlights can be overwriten.

a config option "no_hls" is added to disable highlights all together.

Signed-off-by: ldelossa <louis.delos@gmail.com>
ldelossa added a commit that referenced this issue Nov 24, 2021
closes #21

this commit adds default highlights to calltree.

all default highlights can be overwriten.

a config option "no_hls" is added to disable highlights all together.

Signed-off-by: ldelossa <louis.delos@gmail.com>
@ldelossa
Copy link
Owner

add default highlights, give it a try.

@quantum-booty
Copy link
Author

quantum-booty commented Nov 24, 2021

@ldelossa Looks like the default highlights doesn't work for me.
image

I think I figured out why, so in this function:

function _setup_default_highlights() 
    local dark = {
        CTBoolean              = 'hi CTBoolean                guifg=#0087af guibg=None',
        CTConstant             = 'hi CTConstant               guifg=#0087af guibg=None',
        CTConstructor          = 'hi CTConstructor            guifg=#4DC5C6 guibg=None',
        CTField                = 'hi CTField                  guifg=#0087af guibg=None',
        CTFunction             = 'hi CTFunction               guifg=#988ACF guibg=None',
        CTMethod               = 'hi CTMethod                 guifg=#0087af guibg=None',
        CTNamespace            = 'hi CTNamespace              guifg=#87af87 guibg=None',
        CTNumber               = 'hi CTNumber                 guifg=#9b885c guibg=None',
        CTOperator             = 'hi CTOperator               guifg=#988ACF guibg=None',
        CTParameter            = 'hi CTParameter              guifg=#988ACF guibg=None',
        CTParameterReference   = 'hi CTParameterReference     guifg=#4DC5C6 guibg=None',
        CTString               = 'hi CTString                 guifg=#af5f5f guibg=None',
        CTSymbol               = 'hi CTSymbol                 guifg=#87afd7 gui=underline',
        CTSymbolDetail         = 'hi CTSymbolDetail           ctermfg=024 cterm=italic guifg=#988ACF gui=italic',
        CTSymbolJump           = 'hi CTSymbolJump             ctermfg=015 ctermbg=110 cterm=italic,bold,underline   guifg=#464646 guibg=#87afd7 gui=italic,bold',
        CTSymbolJumpRefs       = 'hi CTSymbolJumpRefs         ctermfg=015 ctermbg=110 cterm=italic,bold,underline   guifg=#464646 guibg=#9b885c gui=italic,bold',
        CTType                 = 'hi CTType                   guifg=#9b885c guibg=None',
        CTURI                  = 'hi CTURI                    guifg=#988ACF guibg=None',
    }
    local light = {
        CTBoolean               = 'hi CTBoolean                guifg=#005f87 guibg=None',
        CTConstant              = 'hi CTConstant               guifg=#005f87 guibg=None',
        CTConstructor           = 'hi CTConstructor            guifg=#9b885c guibg=None',
        CTField                 = 'hi CTField                  guifg=#005f87 guibg=None',
        CTFunction              = 'hi CTFunction               guifg=#806CCF guibg=None',
        CTMethod                = 'hi CTMethod                 guifg=#005f87 guibg=None',
        CTNamespace             = 'hi CTNamespace              guifg=#87af87 guibg=None',
        CTNumber                = 'hi CTNumber                 guifg=#9b885c guibg=None',
        CTOperator              = 'hi CTOperator               guifg=#806CCF guibg=None',
        CTParameter             = 'hi CTParameter              guifg=#806CCF guibg=None',
        CTParameterReference    = 'hi CTParameterReference     guifg=#268889 guibg=None',
        CTString                = 'hi CTString                 guifg=#af5f5f guibg=None',
        CTSymbol                = 'hi CTSymbol                 guifg=#806CCF gui=underline',
        CTSymbolDetail          = 'hi CTSymbolDetail           ctermfg=024 cterm=italic guifg=#005f87 gui=italic',
        CTSymbolJump            = 'hi CTSymbolJump             ctermfg=015 ctermbg=110 cterm=italic,bold,underline   guifg=#464646 guibg=#87afd7 gui=italic,bold',
        CTSymbolJumpRefs        = 'hi CTSymbolJumpRefs         ctermfg=015 ctermbg=110 cterm=italic,bold,underline   guifg=#464646 guibg=#9b885c gui=italic,bold',
        CTType                  = 'hi CTType                   guifg=#268889 guibg=None',
        CTURI                   = 'hi CTURI                    guifg=#806CCF guibg=None',
    }
    local bg = vim.api.nvim_get_option("background")
    if bg == "dark" then
        print("here - dark")
        for hl_name, hl in pairs(dark) do
            if not vim.fn.hlexists(hl_name) == 0 then
                vim.cmd(hl)
            end
        end
    end
    if bg == "light" then
        for hl_name, hl in pairs(light) do
            if vim.fn.hlexists(hl_name) == 0 then
                vim.cmd(hl)
            end
        end
    end
end

_setup_default_highlights()

looks like this:

  if not vim.fn.hlexists(hl_name) == 0 then
      vim.cmd(hl)
  end

should be this instead:

  if vim.fn.hlexists(hl_name) == 0 then
      vim.cmd(hl)
  end

And it would be nice to get rid of the debug print

print("here - dark")

@ldelossa
Copy link
Owner

yup!

@ldelossa
Copy link
Owner

Pushed some changes, give it a go.

@quantum-booty
Copy link
Author

Pushed some changes, give it a go.

Thanks, working now!

@fitrh
Copy link

fitrh commented May 29, 2022

I have the same issue, using codicons gave me partial highlight, but no highlight with nerd

checking the value of LTFunction, LTType and LTFiled return correct values, but it does not apply to litee window

20220529_173946_full

20220529_174020_full

@ttytm
Copy link
Contributor

ttytm commented May 29, 2022

@fitrh

I'm having the same issue, I thought of commenting here yesterday now you beat me to it 😊

Getting the correct highlight color codes returned, but no actual highlighting is happening. I tried to add fixed values for the highlights in the plugins corresponding files instead of using variables, but it looks like there is an issue with the colors getting applied in the panel. I also tried disabling tree sitter highlights to check for conflicts.

E.g., one of the goals was to change the indent lines color to something less bright.

@ldelossa
Copy link
Owner

ldelossa commented Jun 1, 2022

We maybe only doing syntax matches for codicon icons and not nerd icons 😬. Im a bit wrapped up but i should be able to look into this soon. If you want to beat me too it, the issue most likely revolves around this function:

function M.set_tree_highlights()

@ldelossa ldelossa reopened this Jun 1, 2022
@ttytm
Copy link
Contributor

ttytm commented Jun 30, 2022

Unfortunately I can't spot the reason for this problem, so I did some exploratory testing and modifications around the highlight related functions for the last two hours, unfortunately without satisfying results.

What I can say is that the highlight groups get set up properly, but they won't get applied to the filetree elements. That is using any of the litee.lib icon sets default | nerd | codicons. The only thing in the filetree panel that has highlights are the devicons which come with the filetree itself.

Following are two mappings that print highlights of the element under cursor and might be of use when debugging highlights. I mapped them to some FKeys or this purpose:

local map = vim.keymap.set
-- ...
map( "n",  "<F6>", [[:echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" . " FG:" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"fg#")<CR>]])
map("n", "<F7>", "<cmd>TSHighlightCapturesUnderCursor<CR>")

@fitrh
Copy link

fitrh commented Oct 14, 2022

Configuring tree.icon_set for litee.lib fixed this issue

diff --git a/lua/config/plugin/litee/setup.lua b/lua/config/plugin/litee/setup.lua
index 2b1a243..98c70ec 100644
--- a/lua/config/plugin/litee/setup.lua
+++ b/lua/config/plugin/litee/setup.lua
@@ -1,4 +1,12 @@
 require("litee.lib").setup({
+  tree = {
+    icon_set_custom = {
+      Collapsed = "",
+      Expanded = "",
+      IndentGuide = " ",
+    },
+    icon_set = "nerd",
+  },
   panel = {
     orientation = "right",
     panel_size = math.ceil(vim.api.nvim_get_option("columns") / 4),

But it seems I still need to set the icon_set for the plugins, so my complete
config now looks like this

require("litee.lib").setup({
  tree = {
    icon_set_custom = {
      Collapsed = "",
      Expanded = "",
      IndentGuide = " ",
    },
    icon_set = "nerd",
  },
  panel = {
    orientation = "right",
    panel_size = math.ceil(vim.api.nvim_get_option("columns") / 4),
  },
})

require("litee.symboltree").setup({
  icon_set = "nerd",
  hide_cursor = false,
  on_open = "panel",
  keymaps = { hide = "q" },
})

require("litee.calltree").setup({
  icon_set = "nerd",
  hide_cursor = false,
  on_open = "panel",
  keymaps = { hide = "q" },
})

I don't know if this is the expected behavior because in the first place I
thought the plugins would inherit the litee.lib configuration

fitrh added a commit to fitrh/init.nvim that referenced this issue Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants