Open fhill2 opened 2 years ago
Sorry, somehow I missed this issue. I just checked and I can reproduce it.
Can also confirm. Also tabstop settings are ignored in cat mode, but work fine in pager mode.
Today I found out that synID() which was used in cat mode does not see all highlights added to a position. I will have to refactor cat mode to use vim.inspect_pos()
Would this be fixed any time soon?
You are welcome to work on it. I currently do not have the time to fix it / I can not give an ETA.
As noted above it would be necessary to refactor the code to use vim.inspect_pos()
instead of synID()
. I previously had a short look at the output of that function and it seems it yields all different extmarks and treesitter tokens like this:
{
buffer = 14,
col = 3,
extmarks = { {
col = 2,
end_col = 10,
end_row = 112,
id = 25,
ns = "illuminate.highlight",
ns_id = 20,
opts = {
end_col = 10,
end_right_gravity = false,
end_row = 112,
hl_eol = false,
hl_group = "IlluminatedWordText",
hl_group_link = "IlluminatedWordText",
ns_id = 20,
priority = 199,
right_gravity = true
},
row = 112
} },
row = 112,
semantic_tokens = {},
syntax = {},
treesitter = { {
capture = "string",
hl_group = "@string.yaml",
hl_group_link = "Constant",
lang = "yaml",
metadata = {}
}, {
capture = "property",
hl_group = "@property.yaml",
hl_group_link = "Identifier",
lang = "yaml",
metadata = {}
} }
}
The main question I had (and did not have the time to figure out) was in which order these different highlight groups should be stacked/merged to produce the final display attributes.
Thanks for reply, I would have a look and learn lua first.
Night
On Wed, 20 Mar 2024 at 14:18, Lucas Hoffmann @.***> wrote:
You are welcome to work on it. I currently do not have the time to fix it / I can not give an ETA.
As noted above it would be necessary to refactor the code to use vim.inspect_pos() instead of synID(). I previously had a short look at the output of that function and it seems it yields all different extmarks and treesitter tokens like this:
{ buffer = 14, col = 3, extmarks = { { col = 2, end_col = 10, end_row = 112, id = 25, ns = "illuminate.highlight", ns_id = 20, opts = { end_col = 10, end_right_gravity = false, end_row = 112, hl_eol = false, hl_group = "IlluminatedWordText", hl_group_link = "IlluminatedWordText", ns_id = 20, priority = 199, right_gravity = true }, row = 112 } }, row = 112, semantic_tokens = {}, syntax = {}, treesitter = { { capture = "string", hl_group = @.", hl_group_link = "Constant", lang = "yaml", metadata = {} }, { capture = "property", hl_group = @.", hl_group_link = "Identifier", lang = "yaml", metadata = {} } } }
The main question I had (and did not have the time to figure out) was in which order these different highlight groups should be stacked/merged to produce the final display attributes.
— Reply to this email directly, view it on GitHub https://github.com/lucc/nvimpager/issues/63#issuecomment-2009684985, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASPPZ4JQVJ2XVSGXHGWRAZTYZGLEVAVCNFSM5Q25PRWKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBQHE3DQNBZHA2Q . You are receiving this because you commented.Message ID: @.***>
Hey folks — just to let to whoever is interested to know — I have managed to add treesitter syntax highlighting support. The only piece that's missing is a way to determine if the treesitter resolver function that I wrote should be used instead of built-in synID, so that compatibility with regular syntax highlighting is preserved. As soon as this is done followed by some testing — I will submit a pull request.
Can nvimpager show treesitter syntax highlighting?
From my tests below,
nvimpager.lua
isn't parsing treesitter syntax highlighting.Here is what I am using to test:
~/.config/nvimpager/init.vim
using nvimpager on a lua file to see if treesitter works: