-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: unable get expected altbuf #501
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain how you produce the issue?
This looks pretty complex
This happens when two jdtls LSPs are opened simultaneously, and the following steps may be able to reproduce this situation:
As I do not fully understand the internal implementation mechanism of vim.lsp, I have thought of a compromise solution where I can manage the LSP file of the most recent plan myself to avoid this case. |
I need to further elaborate on the impact of this issue. If the LSP of Project A does not have the corresponding file, the jump will fail. In my case, both Projects A and B rely on the same version, but the LSP loaded the wrong version. As a result, I discovered the issue of incorrectly binding the buffer to the LSP. |
Another reason for the commit "fix: modify the method of obtaining ft to respond to bad cases" is that I noticed that sometimes vim.bo[bufnr].filetype == "java" doesn't work as expected, but vim.api.nvim_buf_get_option(bufnr, "filetype") always returns the desired result. |
In commit 365811e, we inferred the altbuf. However, there are two issues:
bufnr([{buf} [, {create}]])
- The second parameter 'create' inbufnr([{buf} [, {create}]])
cannot be set to a value, as it will create a new buffer when no previous buffer exists.lsp_util.locations_to_items
in thejdt://
buffer, otherjdt://
locations will be parsed. However, at this point, I cannot retrieve the previous buffer usingbufnr('#')
. The return value will be-1
.Therefore, I want to manage the latest accessed buffer associated with jdtls. I will record the latest buffer at
on_attach
andBufEnter
.