New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(lsp): extract resolve_bufnr
to vim.lsp.util
#28494
base: master
Are you sure you want to change the base?
Conversation
Not sure if it should be private. |
I'm unsure about this change. Although I admit that we repeat this logic in multiple places, some LSP functions interpret the meaning of |
@MariaSolOs Thanks for pointing this out, I hadn't noticed that I think the problem you mentioned is essentially due to the design of this API. The current codelens API is designed to be easily triggered manually. In this case, we may need a method to indicate that it is effective for all buffers. However, for other LSP-related APIs, such as semantic token or inlay hint, By the way, the stuff I am trying to work on is rewriting codelens to provide something like |
Nothing of If useful enough, it should be in a general purpose module - but given how trivial it is and the aspects @MariaSolOs mentioned I'm not convinced it's worth having as public API (but open to more inputs, together with suggestions where it would fit) |
I should probably also point out that its current implementation contradicts the dev guidelines: neovim/runtime/doc/develop.txt Line 315 in a1550db
|
we should fix that though. having common functions helps with that. the preferred convention for bufnr/winnr/etc is:
|
Which means we really shouldn't need these "resolve" helper functions at all, since most (all?) API functions take |
If it needs to be implemented in this way, it will be convenient for users. But it's a bit hard to implement. There are a few problems we may encounter.
Then like @gpanders said, we do not need these "resolve" helper functions at all. So the best way I can think of at the moment is, to delete all resolve_bufnr functions. If a function can handle the "all buffer" situation, then However, this approach maintains API consistency. |
sounds like a reasonable cleanup task. could be risky so should wait until 0.10 is released in a couple weeks. |
When trying to do some stuff for codelens, I found that the local function
resolve_bufnr
is slightly different from the others which have the same name but in other files.It might be better if we put it into
vim.lsp.utils
so that we can use the name as expected.