Skip to content
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

Fix: Handle Dictionary Responses in jsonfly.lua for Neovim 0.10.1 #20

Merged
merged 2 commits into from
Sep 30, 2024

Conversation

kletobias
Copy link
Contributor

Title:

Fix: Handle Dictionary Responses in jsonfly.lua for Neovim 0.10.1

Description:

Fixes error on line 209, where either response[1] or response[1].result is nil:

-- line 209
local result = response[1].result

Cause of the Error

In Neovim 0.10.1, the vim.lsp.buf_request_all function returns a dictionary where the keys are client IDs, and the values are the responses from each client. This is different from earlier versions where the responses were in an array-like table.

The current code assumes response[1] is valid, but in Neovim 0.10.1, response is a dictionary, so accessing response[1] leads to nil.

Solution

The callback function has been updated to handle the response correctly by iterating over the dictionary returned by vim.lsp.buf_request_all, ensuring compatibility with Neovim 0.10.1.

kletobias and others added 2 commits September 29, 2024 15:55
syntax and version changes not accounted for.
Refactored LSP request handling in jsonfly.lua to combine results from multiple LSP responses and handle empty results more gracefully. Improved code readability and maintainability by restructuring the nested if-else blocks.
@Myzel394
Copy link
Owner

Thank you, unfortunately, I'm not able to reproduce it. I've added some other fixes as well. Once the CI:CD is green we can merge it. Can you then test it again and see if it works?

@Myzel394 Myzel394 merged commit d713d9e into Myzel394:main Sep 30, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants