Skip to content

Commit

Permalink
stack_view: toggle to disable tree hl
Browse files Browse the repository at this point in the history
tree hl is slow so adding option to disable it
  • Loading branch information
dhananjaylatkar committed Nov 1, 2024
1 parent 033b51c commit 60ccd04
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ _cscope_maps_ comes with following defaults:
-- change cwd to where db_file is located
change_cwd = false, -- "true" or "false"
},
},

-- stack view defaults
stack_view = {
tree_hl = true, -- toggle tree highlighting
}
}
```
Expand Down
11 changes: 9 additions & 2 deletions lua/cscope/stack_view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ local hl = require("cscope.stack_view.hl")
local utils = require("cscope_maps.utils")
local M = {}

M.opts = {
tree_hl = true, -- toggle tree highlighting
}

-- m()
-- -> a()
-- -> b()
Expand Down Expand Up @@ -159,7 +163,9 @@ M.buf_update = function()
group = augroup,
buffer = M.cache.sv.buf,
callback = function()
hl.refresh(M.cache.sv.buf, root, #buf_lines)
if M.opts.tree_hl then
hl.refresh(M.cache.sv.buf, root, #buf_lines)
end
M.preview_update()
end,
})
Expand Down Expand Up @@ -373,7 +379,8 @@ M.set_user_cmd = function()
})
end

M.setup = function()
M.setup = function(opts)
M.opts = vim.tbl_deep_extend("force", M.opts, opts)
M.set_user_cmd()
end

Expand Down
3 changes: 2 additions & 1 deletion lua/cscope_maps/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ M.opts = {
skip_input_prompt = false, -- "true" doesn't ask for input
prefix = "<leader>c", -- prefix to trigger maps
cscope = {}, -- defaults are in cscope.lua
stack_view = {}, -- defaults are in stack_view
}

-- function to print xcscpoe.el like prompts
Expand Down Expand Up @@ -64,7 +65,7 @@ M.setup = function(opts)
end

cs.setup(M.opts.cscope)
require("cscope.stack_view").setup()
require("cscope.stack_view").setup(M.opts.stack_view)
end

return M

0 comments on commit 60ccd04

Please sign in to comment.