coc-pyright
coc-pyright copied to clipboard
Linting completely breaks when asked to confim a substitution with inccommand turned on.
Starting a substitution with :%s:::c
while inccommand
is set to either split or nosplit completely messes up linting and highlighting. Replacements don't have to actually be confirmed, simply initiating a substitute command causes problems.
Replacing items without the c
flag in the substitution, or with set inccommand=
behaves as expected.
Video which demonstrates the issue: https://imgur.com/a/WOa4N6W
Screenshot:
What's the output of :CocCommand pyright.version
coc-pyright 1.1.265 with Pyright 1.1.265
What's the output of :CocCommand workspace.showOutput Pyright
Workspace: /home/satsu/Documents/cursewordle
Using python from /usr/bin/python
[Info - 8:32:23 PM] Pyright language server 1.1.265 starting
[Info - 8:32:23 PM] Server root directory: /home/satsu/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/
[Info - 8:32:23 PM] Starting service instance "cursewordle"
[Info - 8:32:23 PM] No configuration file found.
[Info - 8:32:23 PM] No pyproject.toml file found.
[Info - 8:32:23 PM] Setting pythonPath for service "cursewordle": "/usr/bin/python"
[Warn - 8:32:23 PM] stubPath /home/satsu/Documents/cursewordle/typings is not a valid directory.
[Info - 8:32:23 PM] Assuming Python version 3.10
[Info - 8:32:23 PM] Assuming Python platform Linux
[Info - 8:32:23 PM] Searching for source files
[Info - 8:32:23 PM] Found 6 source files
I suspect this could be an issue with inccommand's implementation more broadly, but I'm not entirely sure how to test that.
Let me know if you need more logs
inccommand
is nosplit
by default, check :h inccommand
. I can't reproduce your issue.
inccommand
isnosplit
by default, check:h inccommand
. I can't reproduce your issue.
You're right, I just assumed it was off by default.
Updated title, seems to be specifically triggered by the confirm flag in a substitution command.
I tried with a minimal init.vim
with just the following, largely identical to the standard coc-config:
https://gist.github.com/avalonv/a01f6a0feec2dd287350d3ebd72a70c7
Typing :%s:::c
in a python file will mess up linting regardless of whether enter or <esc> is subsequently typed. No substitutions have to take place for this to occur.
@fannheyward have you been able to replicate this? I tested it in another machine but I'm still wondering if it might have something to do with my configuration.
Can't reproduce this.
Test code:
def foo(bar: int = None):
print(bar)
-
:set inccommand=nosplit
- search
bar
-
:%s::c

<cr>
to accept, or <esc>
to roll back.
Hi, the example doesn't really apply.
I'm not trying to replace bar with c
, c
in this case is the confirm flag for the substitute command, not the replacement string.
The command should be :%s:::c
(three :
in the middle)
Made another video which should be clearer to read: https://imgur.com/a/aBsa82E
In this video, I slightly edited your code, but otherwise everything is the same.
In the first example, running set inccomand=
then :%s:::c
, shows the expected behaviour, it asks me to confirm each instance of bar
, I press n
for each prompt and no words are actually replaced.
In the second example, with set inccommand=nosplit
, linting errors appear, pyright thinks bar
in the first and third line are missing, even though they haven't actually changed.
Sorry for the :::
issue, I made it wrong with two sign.
Here's my test.
mini.vim
set nocompatible
set runtimepath^=/Users/fannheyward/.local/share/nvim/plugged/coc.nvim
filetype plugin indent on
syntax on
set runtimepath^=~/src/coc-pyright
test code foo.py:
def foo(bar: int = None):
bar = 1
steps:
- nvim -u mini.vim foo.py
- search
bar
-
:%s:::c
, without<cr>
to confirm

two bar
are removed. <cr>
to confirm:

press n
twice, no errors.
:set inccommand=nosplit
, and :%s:::c
again, press <cr>
to confirm and n
twice, no errors.