coc-pyright: Wrong warning "Code is unreachable"
https://github.com/microsoft/pyright/issues/1532
For some reason Pyright
thinks this code is unreachable - this is clearly a mistake.
from contextlib import suppress
seconds = 0
with suppress(ValueError):
seconds = int('a')
if not seconds:
seconds = 42
Then it thinks all the other code, out of scope is broken too. Which is another (maybe consecutive) misconception.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (10 by maintainers)
@kaldown Unfortunately, problems that cannot be reproduced cannot be solved. 😦
First, try updating to the latest version of coc-pyright. Currently, the latest version is
v1.1.117
.I looked at your dotfile. https://github.com/kaldown/dotfiles/blob/master/.config/nvim/plug_config/base.vim#L64
Is your coc-pyright installed correctly? (Did you build the new version correctly?)
If you are installing with “vim-plug”, it is useful to set
"Plug 'fannheyward/coc-pyright', {'do': 'yarn install --frozen-lockfile'}
.It is more useful if you use
:CocInstall coc-pyright
.I found a similar issue on pyright itself. https://github.com/microsoft/pyright/issues/1376
I forced the pyright version of coc-pyright to
v1.1.101
, and the “bug” was reproduced.