coc-nav
                                
                                 coc-nav copied to clipboard
                                
                                    coc-nav copied to clipboard
                            
                            
                            
                        UnhandledRejection: TypeError: Cannot destructure property 'start' of 'range' as it is undefined
I'm getting the following error when editing bash files:
[coc.nvim]: UnhandledRejection: TypeError: Cannot destructure property 'start' of 'range' as it is undefined.
I use coc-sh and the bash-language-server
## versions
vim version: NVIM v0.8.3
node version: v19.7.0
coc.nvim version: 0.0.82-79e9e04 2023-02-15 20:36:03 -0800
coc.nvim directory: /Users/dluis/.vim/bundle/coc.nvim
term: tmux
platform: darwin
## Log of coc.nvim
2023-02-25T16:53:41.407 WARN (pid:18443) [workspace] - workspace.createStatusBarItem is deprecated, please use window.createStatusBarItem instead. 
    at new t.Actions (/Users/dluis/.config/coc/extensions/node_modules/coc-actions/out/index.js:1:8301)
    at t.activate (/Users/dluis/.config/coc/extensions/node_modules/coc-actions/out/index.js:1:15288)
2023-02-25T16:53:41.551 INFO (pid:18443) [extension:coc-git] - Looking for git in: git
2023-02-25T16:53:41.608 WARN (pid:18443) [workspace] - Extension "coc-lists" registered synchronized autocmd "VimLeavePre", which could be slow.
2023-02-25T16:53:41.715 INFO (pid:18443) [extension:coc-tabnine] - Using tabnine from /Users/dluis/.config/coc/extensions/coc-tabnine-data/binaries/4.4.249/aarch64-apple-darwin/TabNine
2023-02-25T16:53:41.758 INFO (pid:18443) [plugin] - coc.nvim initialized with node: v19.7.0 after 589
2023-02-25T16:53:41.759 INFO (pid:18443) [services] - LanguageClient bash-language-server state change: stopped => starting
2023-02-25T16:53:41.760 INFO (pid:18443) [attach] - receive notification: highlight []
2023-02-25T16:53:41.768 INFO (pid:18443) [language-client-index] - Language server "sh" started with 18492
2023-02-25T16:53:41.982 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 8 ]
2023-02-25T16:53:42.100 INFO (pid:18443) [services] - LanguageClient bash-language-server state change: starting => running
2023-02-25T16:53:42.102 INFO (pid:18443) [services] - service sh started
2023-02-25T16:53:43.151 INFO (pid:18443) [attach] - receive notification: highlight []
2023-02-25T16:53:43.152 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 2 ]
2023-02-25T16:53:43.164 ERROR (pid:18443) [server] - unhandledRejection  Promise {
  <rejected> TypeError: Cannot destructure property 'start' of 'range' as it is undefined.
      at positionInRange (/Users/dluis/.config/coc/extensions/node_modules/coc-nav/lib/index.js:81:11)
      at nav (/Users/dluis/.config/coc/extensions/node_modules/coc-nav/lib/index.js:115:9)
} TypeError: Cannot destructure property 'start' of 'range' as it is undefined.
    at positionInRange (/Users/dluis/.config/coc/extensions/node_modules/coc-nav/lib/index.js:81:11)
    at nav (/Users/dluis/.config/coc/extensions/node_modules/coc-nav/lib/index.js:115:9)
2023-02-25T16:53:43.457 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.457 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.458 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.459 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.460 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.461 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.462 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.463 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.463 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.464 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.465 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.466 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.467 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.468 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.468 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.469 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.470 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.471 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:43.472 INFO (pid:18443) [attach] - receive notification: doAutocmd [ 7 ]
2023-02-25T16:53:52.687 INFO (pid:18443) [attach] - receive notification: showInfo []
Encountered same issue when editing HTML files with coc-html installed
I have the same error when editing Zsh files, .vimrc, and html files. vim version: VIM - Vi IMproved 9.0 9002009 node version: v18.18.2 coc.nvim version: 0.0.82-d1568d56 2023-09-29 19:43:34 +0800 coc.nvim directory: /Users/[my-user-name]/.vim/pack/[my-user-alias]/start/coc.nvim term: tmux platform: darwin
I also am getting this while editing Bash files using coc-sh.
nvim = 0.9.1 node = 20.9.0 darwin / tmux
It seems like it happens after any kind of warning or syntax error is detected anywhere in the file, then the cursor is moved.
Possible fix:
https://github.com/Carcuis/coc-nav/commit/53ddeb8781f7672b6f977cc9893b6f5e2bf42f53