Skip to content

Rename in file from another path does not work #521

@dsirov

Description

@dsirov

Problem

When opening a file from another sub-root path and trying to rename a method/variable, the following error is received
[coc.nvim] Invalid position for rename

Seems exactly like in #474, but I do not have coc-python installed.

Minimal Environment

Fully-cleaning coc

rm -rvf ~/.config/coc

~/.config/nvim/init.vim

set nocompatible
call plug#begin('~/.config/nvim/plugged')
Plug 'neoclide/coc.nvim'
call plug#end()
 
let mapleader=","
nmap <leader>rn <Plug>(coc-rename)

installing coc-pyright

:PlugUpdate
:CocInstall coc-pyright

/tmp/test/test.py

import sys
   
def test( s: str ):
    print( s )
   
def main():
    test('1')

Opening the file

cd ~
nvim /tmp/test/test.py

Attempting to Rename

Attempt to rename the name of the function test when standing on any of its letters (,rn)

[coc.nvim] Invalid position for rename

Versioning

:CocCommand pyright.version

[coc.nvim] coc-pyright 1.1.146 with Pyright 1.1.148

:CocInfo

## versions

vim version: NVIM v0.4.4                                                                                    
node version: v14.16.1               
coc.nvim version: 0.0.80-b427b2ccfa  
coc.nvim directory: /home/david/.config/nvim/plugged/coc.nvim                                               
term: xterm-256color
platform: linux

## Log of coc.nvim

2021-06-10T11:50:29.340 INFO (pid:1247104) [services] - registered service "pyright"
2021-06-10T11:50:29.343 INFO (pid:1247104) [services] - Pyright Server state change: stopped => starting 
2021-06-10T11:50:29.349 INFO (pid:1247104) [plugin] - coc.nvim 0.0.80-b427b2ccfa initialized with node: v14.16.1 after 182ms
2021-06-10T11:50:29.356 INFO (pid:1247104) [language-client-index] - pyright started with 1247117
2021-06-10T11:50:29.646 INFO (pid:1247104) [services] - Pyright Server state change: starting => running 
2021-06-10T11:50:29.654 INFO (pid:1247104) [services] - service pyright started
2021-06-10T11:50:30.519 INFO (pid:1247104) [attach] - receive notification: rename []
2021-06-10T11:50:31.244 WARN (pid:1247104) [completion] - Document not attached, suggest disabled.
2021-06-10T11:50:34.792 INFO (pid:1247104) [attach] - receive notification: showInfo []

:version

:version                                                                                                                                                                                                   
NVIM v0.4.4
Build type: RelWithDebInfo
LuaJIT 2.0.5
Compilation: /usr/local/clang-7.0.0/bin/clang -O2 -g -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrou
gh -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/home/travis/build/neovim/bot-ci/build
/neovim/build/config -I/home/travis/build/neovim/bot-ci/build/neovim/src -I/home/travis/build/neovim/bot-ci/build/neovim/.deps/usr/include -I/usr/include -I/home/travis/build/neovim/bot-ci/build/neovim/build/src
/nvim/auto -I/home/travis/build/neovim/bot-ci/build/neovim/build/include
Compiled by travis@travis-job-d8a0d531-236d-4d4c-9703-9d6e27bee65f

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

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

Debugging

:checkhealth

health#coc#check
========================================================================
  - OK: Environment check passed

  - OK: Javascript bundle build/index.js found
  - OK: Service started

health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: RelWithDebInfo

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $VTE_VERSION='6203'
  - INFO: $COLORTERM='truecolor'

health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: xclip

## Python 2 provider (optional)
  - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
  - ERROR: Python provider error:
    - ADVICE:
      - provider/pythonx: Could not load Python 2:
          /usr/bin/python2 does not have the "neovim" module. :help |provider-python|
          /usr/bin/python2.7 does not have the "neovim" module. :help |provider-python|
          python2.6 not found in search path or not executable.
          /usr/bin/python is Python 3.9 and cannot provide Python 2.
  - INFO: Executable: Not found

## Python 3 provider (optional)
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Executable: /usr/bin/python3
  - INFO: Python version: 3.9.5
  - INFO: pynvim version: 0.4.3
  - OK: Latest pynvim is installed.

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [x86_64-linux]
  - WARNING: `neovim-ruby-host` not found.
    - ADVICE:
      - Run `gem install neovim` to ensure the neovim RubyGem is installed.
      - Run `gem environment` to ensure the gem bin directory is in $PATH.
      - If you are using rvm/rbenv/chruby, try "rehashing".
      - See :help |g:ruby_host_prog| for non-standard gem installations.

## Node.js provider (optional)
  - INFO: Node.js: v14.16.1
  - WARNING: Missing "neovim" npm (or yarn) package.
    - ADVICE:
      - Run in shell: npm install -g neovim
      - Run in shell (if you use yarn): yarn global add neovim

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions