Saghen / blink.cmp

Performant, batteries-included completion plugin for Neovim
MIT License
1.25k stars 73 forks source link

show documentation errors for yaml when custom yamlls tags exist #283

Closed AnthonyPoschen closed 1 week ago

AnthonyPoschen commented 1 week ago

Make sure you have done the following

Bug Description

when opening documentation in yaml the following error occurs when custom yamlls tags are configured

Error  17:02:14 msg_show.lua_error Error executing vim.schedule lua callback: ...eovim/0.10.2_1/share/nvim/runtime/lua/vim/lsp/client.lua:588: RPC[Error] code_name = InternalError, message = "Request initialize failed with message: [UriError]: Scheme is missing: {scheme: \"\", authority: \"\", path: \"null\", query: \"\", fragment: \"\"}"
stack traceback:
    [C]: in function 'assert'
    ...eovim/0.10.2_1/share/nvim/runtime/lua/vim/lsp/client.lua:588: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>

 Error  17:02:24 msg_show.lua_error Error executing vim.schedule lua callback: ...e/nvim/lazy/blink.cmp/lua/blink/cmp/windows/lib/docs.lua:161: attempt to index local 'line' (a nil value)
stack traceback:
    ...e/nvim/lazy/blink.cmp/lua/blink/cmp/windows/lib/docs.lua:161: in function 'get_code_block_range'
    ...e/nvim/lazy/blink.cmp/lua/blink/cmp/windows/lib/docs.lua:217: in function 'extract_detail_from_doc'
    ...e/nvim/lazy/blink.cmp/lua/blink/cmp/windows/lib/docs.lua:20: in function 'render_detail_and_documentation'
    ...m/lazy/blink.cmp/lua/blink/cmp/windows/documentation.lua:61: in function 'fn'
    .../nvim/lazy/blink.cmp/lua/blink/cmp/sources/lib/async.lua:86: in function 'cb'
    .../nvim/lazy/blink.cmp/lua/blink/cmp/sources/lib/async.lua:44: in function 'cb'
    .../nvim/lazy/blink.cmp/lua/blink/cmp/sources/lib/async.lua:44: in function 'resolve'
    ...zy/blink.cmp/lua/blink/cmp/sources/lib/provider/init.lua:130: in function <...zy/blink.cmp/lua/blink/cmp/sources/lib/provider/init.lua:130>

minimum reproduction yml file ( realistically it can be anything even an empty file )

foo:
  - "bar"

when documentation is opened for anything in yaml via autoshow or keypress if the list will present the custom yaml tags image the above error log will appear.

those yaml tags that cause the issue is defined inside my mason-lspconfig with the following yamlls config

            yamlls = {
                settings = {
                    yaml = {
                        customTags = {
                            -- AWS CloudFormation
                            "!Ref",
                            "!If sequence",
                            "!GetAtt",
                            "!GetAZs",
                            "!ImportValue",
                            "!ImportValue mapping",
                            "!Join sequence",
                            "!Sub",
                            "!Sub sequence",
                            "!FindInMap sequence",
                            "!Select sequence",
                            "!Split sequence",
                            "!Not sequence",
                            "!Equals sequence",
                            "!And sequence",
                            "!Or sequence",
                            "!Condition",
                            "!Base64",
                            "!Cidr",
                            "!Ref sequence",
                            "!If mapping",
                            "!Join mapping",
                            "!Select mapping",
                            "!Split mapping",
                            "!Not mapping",
                            "!Equals mapping",
                            "!And mapping",
                            "!Or mapping",
                            -- GitLab
                            "!reference sequence",
                        },
                        schemas = require("schemastore").yaml.schemas(),
                        validate = { enable = true },
                    },
                },
            },

the config above is for removing errors when writing cloudformation for aws.

Relevant configuration

windows = {
            documentation = {
                auto_show = true,
            },
        },

neovim version

NVIM v0.10.2 Build type: Release LuaJIT 2.1.1727870382 Run "nvim -V1 -v" for more info

blink.cmp version: branch, tag, or commit

tag v0.5.1

AnthonyPoschen commented 1 week ago

i have experimented with my config to ensure i don't need custom tags, and now with a proper schemastore setup for cloudformation the results when trying to view docs is still presenting errors when selecting autocompletes for doco on schemastore output from yamlls

stack traceback:
    ...e/nvim/lazy/blink.cmp/lua/blink/cmp/windows/lib/docs.lua:161: in function 'get_code_block_range'
    ...e/nvim/lazy/blink.cmp/lua/blink/cmp/windows/lib/docs.lua:217: in function 'extract_detail_from_doc'
    ...e/nvim/lazy/blink.cmp/lua/blink/cmp/windows/lib/docs.lua:20: in function 'render_detail_and_documentation'
    ...m/lazy/blink.cmp/lua/blink/cmp/windows/documentation.lua:61: in function 'fn'
    .../nvim/lazy/blink.cmp/lua/blink/cmp/sources/lib/async.lua:86: in function 'cb'
    .../nvim/lazy/blink.cmp/lua/blink/cmp/sources/lib/async.lua:44: in function 'cb'
    .../nvim/lazy/blink.cmp/lua/blink/cmp/sources/lib/async.lua:44: in function 'resolve'
    ...zy/blink.cmp/lua/blink/cmp/sources/lib/provider/init.lua:130: in function <...zy/blink.cmp/lua/blink/cmp/sources/lib/provider/init.lua:130>
   Error  17:31:21 msg_show.lua_error Error executing vim.schedule lua callback: ...e/nvim/lazy/blink.cmp/lua/blink/cmp/windows/lib/docs.lua:161: attempt to index local 'line' (a nil value)
stack traceback:
    ...e/nvim/lazy/blink.cmp/lua/blink/cmp/windows/lib/docs.lua:161: in function 'get_code_block_range'
    ...e/nvim/lazy/blink.cmp/lua/blink/cmp/windows/lib/docs.lua:217: in function 'extract_detail_from_doc'
    ...e/nvim/lazy/blink.cmp/lua/blink/cmp/windows/lib/docs.lua:20: in function 'render_detail_and_documentation'
    ...m/lazy/blink.cmp/lua/blink/cmp/windows/documentation.lua:61: in function 'fn'
    .../nvim/lazy/blink.cmp/lua/blink/cmp/sources/lib/async.lua:86: in function 'cb'
    .../nvim/lazy/blink.cmp/lua/blink/cmp/sources/lib/async.lua:44: in function 'cb'
    .../nvim/lazy/blink.cmp/lua/blink/cmp/sources/lib/async.lua:44: in function 'resolve'
    ...zy/blink.cmp/lua/blink/cmp/sources/lib/provider/init.lua:130: in function <...zy/blink.cmp/lua/blink/cmp/sources/lib/provider/init.lua:130>
   Error  17:31:23 msg_show.lua_error Error executing vim.schedule lua callback: ...e/nvim/lazy/blink.cmp/lua/blink/cmp/windows/lib/docs.lua:161: attempt to index local 'line' (a nil value)
stack traceback:
    ...e/nvim/lazy/blink.cmp/lua/blink/cmp/windows/lib/docs.lua:161: in function 'get_code_block_range'
    ...e/nvim/lazy/blink.cmp/lua/blink/cmp/windows/lib/docs.lua:217: in function 'extract_detail_from_doc'
    ...e/nvim/lazy/blink.cmp/lua/blink/cmp/windows/lib/docs.lua:20: in function 'render_detail_and_documentation'
    ...m/lazy/blink.cmp/lua/blink/cmp/windows/documentation.lua:61: in function 'fn'
    .../nvim/lazy/blink.cmp/lua/blink/cmp/sources/lib/async.lua:86: in function 'cb'
    .../nvim/lazy/blink.cmp/lua/blink/cmp/sources/lib/async.lua:44: in function 'cb'
    .../nvim/lazy/blink.cmp/lua/blink/cmp/sources/lib/async.lua:44: in function 'resolve'
    ...zy/blink.cmp/lua/blink/cmp/sources/lib/provider/init.lua:130: in function <...zy/blink.cmp/lua/blink/cmp/sources/lib/provider/init.lua:130>

edit: more context below

https://github.com/user-attachments/assets/7f028483-21bd-47f9-8b69-b4ad4f72b230

Saghen commented 1 week ago

Thanks for the detailed report! This seems like a duplicate of #270, main should be working