Open mortymacs opened 1 year ago
I also saw it when I defined a type:
I can reproduce the problem. Looking at the content of the document symbols (which are returned by the LSP itself), the start character for the range, which lsp-lens uses to figure out where to place the extmark lines, is actually 5. Notice in the image below that the range start value for the Hello
function is 0.
So, this appears to be a problem with Gopls, or lsp-lens has to figure out its own way to determine the indent for each extmark line it places.
Hey @mcauley-penney, thanks for looking into this issue and providing the details. I'm on board with supporting this feature in the lsp-lens itself since it might be useful for other languages too.
Hey @mcauley-penney, thanks for looking into this issue and providing the details. I'm on board with supporting this feature in the lsp-lens itself since it might be useful for other languages too.
Sorry for replay late. I think it can be solved with vim.fn.indent(lnum)
, always placed lsp-info at the start point of the given line, but I am not sure if this will broke with some languages.
Hey @mcauley-penney, thanks for looking into this issue and providing the details. I'm on board with supporting this feature in the lsp-lens itself since it might be useful for other languages too.
Sorry for replay late. I think it can be solved with
vim.fn.indent(lnum)
, always placed lsp-info at the start point of the given line, but I am not sure if this will broke with some languages.
Is it testable by something like this? :lua vim.fn.indent(5)
Hey @mcauley-penney, thanks for looking into this issue and providing the details. I'm on board with supporting this feature in the lsp-lens itself since it might be useful for other languages too.
Sorry for replay late. I think it can be solved with
vim.fn.indent(lnum)
, always placed lsp-info at the start point of the given line, but I am not sure if this will broke with some languages.Is it testable by something like this?
:lua vim.fn.indent(5)
Yes, this func returns how many indents the given line have. Namely the starting point of the given line.
Official docs: :h indent()
I tried it, but still, I'm not sure what should I do in my LSP config. Would you please elaborate a little?
I tried it, but still, I'm not sure what should I do in my LSP config. Would you please elaborate a little?
Sorry for the ambiguity, this func is to get the indent of the given line which is the starting point of the line, I mean maybe we can use this func to get the indent and always display lens info at that point rather than the point provided by LSP, this will eliminate all leading spaces but I am not sure if this will broke with some language. π€
Something like this:
I tried it, but still, I'm not sure what should I do in my LSP config. Would you please elaborate a little?
Sorry for the ambiguity, this func is to get the indent of the given line which is the starting point of the line, I mean maybe we can use this func to get the indent and always display lens info at that point rather than the point provided by LSP, this will eliminate all leading spaces but I am not sure if this will broke with some language. π€
Something like this:
No problem at all! ;)
That's a good idea! It's also good to make it configurable (e.g. by_lsp
or static
) something like:
....
require'lsp-lens'.setup({
...
advanced = {
indent = "by_lsp",
},
})
Also, one unrelated question, how did you enable the third section (icon Vidocq + 1
) in your info? That's very interesting :)
I tried it, but still, I'm not sure what should I do in my LSP config. Would you please elaborate a little?
Sorry for the ambiguity, this func is to get the indent of the given line which is the starting point of the line, I mean maybe we can use this func to get the indent and always display lens info at that point rather than the point provided by LSP, this will eliminate all leading spaces but I am not sure if this will broke with some language. π€ Something like this:
No problem at all! ;) That's a good idea! It's also good to make it configurable (e.g.
by_lsp
orstatic
) something like:.... require'lsp-lens'.setup({ ... advanced = { indent = "by_lsp", }, })
Also, one unrelated question, how did you enable the third section (
icon Vidocq + 1
) in your info? That's very interesting :)
Okay, let it configurable is good LOL.
that section is git_author
, I finished it two days ago and testing it for myself to see if there's a bug. Plan to publish it in next few days. π
I just found another situation when the indentation needs to be adjusted
Hi,
In Go, it shows space before interfaces definitions:![image](https://github.com/VidocqH/lsp-lens.nvim/assets/1261448/984b2bc9-c6ed-4626-9a47-b6b29f758dff)
As the screenshot shows, functions and methods display correctly, but only the interface has spaces.
Cheers, Mort