Skip to content

fix(trouble-nvim): fix crash when lspkind is unaccessible#1751

Merged
Uzaaft merged 1 commit into
AstroNvim:mainfrom
jmxyyy:main
Apr 14, 2026
Merged

fix(trouble-nvim): fix crash when lspkind is unaccessible#1751
Uzaaft merged 1 commit into
AstroNvim:mainfrom
jmxyyy:main

Conversation

@jmxyyy

@jmxyyy jmxyyy commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

📑 Description

Trouble's LSP-related commands crash when lspkind.nvim is unavailable, because kinds is passed a boolean while a table is expected.

📖 Additional Information

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

Review Checklist

Does this PR follow the [Contribution Guidelines](development guidelines)? Following is a partial checklist:

Proper conventional commit scoping:

  • If you are adding a new plugin, the scope would be the name of the category it is being added into. ex. feat(utility): added noice.nvim plugin

  • If you are modifying a pre-existing plugin or pack, the scope would be the name of the plugin folder. ex. fix(noice-nvim): fix LSP handler error

  • Pull request title has the appropriate conventional commit type and scope where the scope is the name of the pre-existing directory in the project as described above

  • README is properly formatted and uses fenced in links with <url> unless they are inside a [title](url)

  • Entry returns a single plugin spec with the new plugin as the only top level spec (not applicable for recipes or packs).

  • Proper usage of opts table rather than setting things up with the config function.

  • Proper usage of specs table for all specs that are not dependencies of a given plugin (not applicable for recipes or packs).

@jmxyyy jmxyyy changed the title fix trouble-nvim crash fix(trouble-nvim): crash Apr 7, 2026
@jmxyyy jmxyyy changed the title fix(trouble-nvim): crash fix(trouble-nvim): fix lspkind error Apr 7, 2026
@jmxyyy jmxyyy changed the title fix(trouble-nvim): fix lspkind error fix(trouble-nvim): fix crash when lspkind is unaccessible Apr 8, 2026
@Uzaaft

Uzaaft commented Apr 13, 2026

Copy link
Copy Markdown
Member

Wait Im not following whats happening here.
if lspkind_avail is unaccessible and isnt enabled, how are we passing a boolean?

@jmxyyy

jmxyyy commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

@Uzaaft apologize if my previous description was unclear, as English is not my native language.

:lua local lspkind_avail, lspkind = pcall(require, "lspkind"); local kinds = lspkind_avail and lspkind.symbol_map; vim.print(kinds)

When the lspkind plugin is not installed, the expression kinds = lspkind_avail and lspkind.symbol_map evaluates to the boolean value false. This false value is then passed into trouble/format.lua at line 147:

local icon = ctx.opts.icons.kinds[ctx.item.kind]

Here, a table is expected, so passing a boolean causes a crash.

This issue can be easily reproduced with a minimal configuration:

 { import = "astrocommunity.diagnostics.trouble-nvim" },

Execute the command: :Trouble lsp_document_symbols

@Uzaaft Uzaaft merged commit 6129af8 into AstroNvim:main Apr 14, 2026
28 of 29 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