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

[coc.nvim]: UnhandledRejection: TypeError: Cannot destructure property 'start' of 'range' as it is undefined. #57

Open
samhed opened this issue Mar 23, 2023 · 3 comments

Comments

@samhed
Copy link

samhed commented Mar 23, 2023

I get the following message for every single line I type in a HTML file when coc-html is installed:

[coc.nvim]: UnhandledRejection: TypeError: Cannot destructure property 'start' of 'range' as it is undefined.

Doing CocDisable doesn't help, but if I uninstall coc-html the error goes away.

  • package manager: Lazy
  • coc.nvim branch: release
  • coc.nvim commit: bbaa1d5
  • coc-html version: 1.8.0
  • coc-html commit: 70299db

init.vim:
Same configuration for CoC as suggested here:
https://github.com/neoclide/coc.nvim#example-lua-configuration

coc-settings:

{
  "diagnostic.errorSign": "✗",
  "diagnostic.warningSign": "⚠",
  "diagnostic.hintSign": "‼",
  "python.linting.pylintEnabled": true,
  "python.linting.pycodestyleEnabled": true,
  "colors.filetypes": [
    "*"
  ],
  "clangd.path": "~/.local/share/nvim/coc-clangd-data/install/15.0.1/clangd_15.0.1/bin/clangd"
}

neovim version:

$ nvim --version
NVIM v0.8.3
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/builddir/build/BUILD/neovim-0.8.3/redhat-linux-build/cmake.config -I/builddir/build/BUILD/neovim-0.8.3/src -I/usr/include -I/usr/include/luajit-2.1 -I/builddir/build/BUILD/neovim-0.8.3/redhat-linux-build/src/nvim/auto -I/builddir/build/BUILD/neovim-0.8.3/redhat-linux-build/include
Compiled by mockbuild@koji

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info
@d-mitrofanov-v
Copy link

@samhed I had the same problem, but the culprit turned out to be not the coc-html, but coc-nav. The solution was some autocmds to turn it off, when entering html buffer and turn it on when leaving. You can add this to your coc.lua:

vim.api.nvim_create_augroup("CocNavToggle", { clear = true })

vim.api.nvim_create_autocmd("BufEnter", {
    group = "CocNavToggle",
    pattern = "*.html",
    command = "call CocActionAsync('deactivateExtension', 'coc-nav')",
    desc = "Turn off coc-nav for html"
})

vim.api.nvim_create_autocmd("BufLeave", {
    group = "CocNavToggle",
    pattern = "*.html",
    command = "call CocActionAsync('toggleExtension', 'coc-nav')",
    desc = "Turn on coc-nav for other files"
})

@samhed
Copy link
Author

samhed commented Jan 8, 2024

I can no longer reproduce this issue. I have both coc-html and coc-nav installed, and I did not add the autocmd's you suggested. @d-mitrofanov-v can you reproduce the issue if you remove those autocmd's?

@samhed
Copy link
Author

samhed commented Jan 8, 2024

Scratch that. I still see the bug if I open an HTML file in a split window. Can confirm that your autocmd's works.

samhed added a commit to samhed/dotfiles that referenced this issue Jan 8, 2024
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

No branches or pull requests

2 participants