nvim-treesitter / playground

Treesitter playground integrated into Neovim
Apache License 2.0
897 stars 47 forks source link

feat(hl-info): add LSP semantic highlights #125

Closed Akmadan23 closed 1 year ago

Akmadan23 commented 1 year ago

I think this is a simple yet really useful feature that was missing here.

clason commented 1 year ago

Why can't you use vim.inspect_pos() for this?

Akmadan23 commented 1 year ago

Why can't you use vim.inspect_pos() for this?

You mean instead of vim.lsp.semantic_tokens.get_at_pos()? If so I didn't use it because, since the show_hl_captures() function is used mainly for some on the fly checks, I think vim.inspect_pos() gives too much information. All the various @lsp.typemod.* and @lsp.mod.* are rarely used and for really specific fine tuning, whereas @lsp.type.* is the most important group, being by default linked to other highlight groups. If I needed all the extra information that vim.inspect_pos() gives I would simply call it via cmd or map it to some key to have a full picture of the token.

clason commented 1 year ago

No, I mean instead of the proposed function -- why do we need another function that prima facie does (nearly) exactly the same thing?

Akmadan23 commented 1 year ago

Oh, so you mean instead of get_lsp_hl(). Well, for consistency with get_treesitter_hl() and get_syntax_hl() and to use it in show_hl_captures() just like the other two.

clason commented 1 year ago

I mean instead of any of these functions. Is there something specific that you're missing from :Inspect or vim.inspect_pos in Neovim? In this case we should add it there; playground is being deprecated as we upstream its features, so it doesn't really make sense to add new functions here.

Akmadan23 commented 1 year ago

I see, I didn't know that playground is being deprecated and I wasn't aware of :Inspect and vim.show_pos(), I was just using require("nvim-treesitter-playground.hl-info").show_hl_captures() mapped to a key and I found useful to add this little feature. Sorry for the inconvenience and I wish the whole team a good job.