Rename in file from another path does not work
See original GitHub issueProblem
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
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Solution to cannot rename file because the folder or a file in it ...
Solution to cannot rename file because the folder or a file in it is open in another program · Step 1: Go to...
Read more >Unable to Rename a File in Windows 10? 8 Ways to Fix It
1. First, Rule Out a File Specific Issue · 2. Ensure You Have Access to the File You're Renaming · 3. Ensure the...
Read more >Cannot rename files - File or folder does not exist
Cannot rename files - File or folder does not exist · Open the Task manager. Here's a tip: Press CTRL+Shift+ESC. · Click File...
Read more >How to Change or Rename a File, Folder, or Directory
Renaming a folder containing files may cause problems if that folder contains files that are required by a program. For example, if the ......
Read more >How to rename a file using Python - Stack Overflow
Should be noted that if the files are not in the working directory you will need the full path. – EndermanAPM. Mar 29,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dsirov If
pyright
cannot detect the “project root” correctly, it may not work as you expect.Try this. https://github.com/neoclide/coc.nvim/wiki/Using-workspaceFolders#resolve-workspace-folder
e.g:
Related issue:
There was an error in
rootPatterns
that won’t work, fixed in https://github.com/fannheyward/coc-pyright/commit/03b67034d65dbac9adebbaa79439ebfcd656034f#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R71