Skip to content

Commit 91a1acf

Browse files
committed
fix: Don't set up highlights if filetype not supported
1 parent b023736 commit 91a1acf

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lua/debugprint/highlight.lua

+6-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ local setup_highlight_buffer = function(print_tag, bufnr)
2121
end
2222
end
2323

24+
---@param filetypes DebugprintFileTypeConfig[]
2425
---@param print_tag string
25-
M.setup_highlight = function(print_tag)
26+
M.setup_highlight = function(filetypes, print_tag)
2627
vim.api.nvim_set_hl(0, "DebugPrintLine", { link = "Debug", default = true })
2728

2829
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
@@ -32,7 +33,10 @@ M.setup_highlight = function(print_tag)
3233
-- Automatically ignore 'bigfiles' as detected by snacks' bigfile
3334
-- support:
3435
-- https://github.com/folke/snacks.nvim/blob/main/docs/bigfile.md
35-
if buffer_filetype ~= "bigfile" then
36+
if
37+
buffer_filetype ~= "bigfile"
38+
and filetypes[buffer_filetype] ~= nil
39+
then
3640
setup_highlight_buffer(print_tag, opts.buf)
3741
end
3842
end,

lua/debugprint/init.lua

+1
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ M.setup = function(opts)
421421
if global_opts.highlight_lines then
422422
if global_opts.print_tag then
423423
require("debugprint.highlight").setup_highlight(
424+
global_opts.filetypes,
424425
global_opts.print_tag
425426
)
426427
else

0 commit comments

Comments
 (0)