t-troebst / perfanno.nvim

NeoVim lua plugin that annotates source code with profiling information from perf or other profilers
MIT License
206 stars 4 forks source link

Plugin not working #3

Closed Kalibr8 closed 2 years ago

Kalibr8 commented 2 years ago

I appreciate what this plugin aims to accomplish. However, after installing ( using the default config via require("perfanno").setup() ), I get the following error:

E5108: Error executing lua vim/shared.lua:0: after the second argument: expected table, got nil stack traceback: [C]: in function 'error' vim/shared.lua: in function 'validate' vim/shared.lua: in function 'tbl_deep_extend' ...share/nvim/plugged/perfanno.nvim/lua/perfanno/config.lua:55: in function 'load' ...l/share/nvim/plugged/perfanno.nvim/lua/perfanno/init.lua:10: in function 'setup' [string ":lua"]:3: in main chunk

Using Neovim 0.7.0 on Ubuntu 20.04. Please assist.

t-troebst commented 2 years ago

Should be fixed now - empty setup call didn't work. Though I would recommend setting some highlights (first few lines of the example config) to get the highlighted lines / virtual text.

Kalibr8 commented 2 years ago

Tried your recommendation. I get the following error:

E5108: Error executing lua ...l/share/nvim/plugged/perfanno.nvim/lua/perfanno/util.lua:135: Invalid format! stack traceback: [C]: in function 'assert' ...l/share/nvim/plugged/perfanno.nvim/lua/perfanno/util.lua:135: in function 'hex_to_rgb' ...l/share/nvim/plugged/perfanno.nvim/lua/perfanno/util.lua:123: in function 'make_bg_highlights' [string ":lua"]:9: in main chunk

t-troebst commented 2 years ago

That's because the default config assumes that you have a colorscheme that has set the gui background color. If your color scheme only sets term colors or doesn't set a background at all, then we can't really know how to do the color gradient. You can just set a background color manually instead of trying to read it from the color scheme.

local perfanno = require("perfanno")
local util = require("perfanno.util")

perfanno.setup {
    -- Creates 10-step color gradient between pure black (#000000) and #CC3300
    line_highlights = util.make_bg_highlights("#000000", "#CC3300", 10),
    vt_highlight = util.make_fg_highlight("#CC3300"),
}
Kalibr8 commented 2 years ago

It worked! Thanks

Kalibr8 commented 2 years ago

P.S. I did try setting Normal guibg color (to black) and it still didn't work. It threw the same error. Setting the initial color in the gradient manually appears to be the only way on my end. Maybe there's a bug there that needs resolving.