neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.15k stars 953 forks source link

Incorrect cwd when call vim with '-c cd xxx' #5037

Open aispeaking opened 3 weeks ago

aispeaking commented 3 weeks ago

Result from CocInfo

versions

vim version: VIM - Vi IMproved 9.0 9001563 node version: v20.12.0 coc.nvim version: 0.0.82-c3ae5c3 2024-05-23 20:39:40 +0800 coc.nvim directory: /home/liyt/code/extern/vim-runtime/plugged/coc.nvim term: dumb platform: linux

Log of coc.nvim

2024-06-11T16:20:08.984 INFO (pid:852781) [extension:coc-git] - Looking for git in: git 2024-06-11T16:20:09.017 WARN (pid:852781) [workspace] - Extension "undefined" registered synchronized autocmd "VimLeavePre", which could be slow. 2024-06-11T16:20:10.176 INFO (pid:852781) [plugin] - coc.nvim initialized with node: v20.12.0 after 1423 2024-06-11T16:20:10.297 INFO (pid:852781) [extension:@yaegassy/coc-marksman] - marksman binary is already downloaded 2024-06-11T16:20:10.302 INFO (pid:852781) [language-client-index] - Language server "marksman" started with 852834 2024-06-11T16:20:10.343 INFO (pid:852781) [attach] - receive notification: doAutocmd [ 7 ] 2024-06-11T16:20:11.911 INFO (pid:852781) [extension:@yaegassy/coc-marksman] - Client onReady 2024-06-11T16:20:11.943 INFO (pid:852781) [extension:@yaegassy/coc-marksman] - Got marksman/status notification 2024-06-11T16:20:15.053 INFO (pid:852781) [attach] - receive notification: openList [ 'mru' ] 2024-06-11T16:20:15.054 INFO (pid:852781) [extension:coc-lists] - cwd: /home/liyt/.config/coc/extensions/node_modules/coc-lists/lib 2024-06-11T16:20:15.088 INFO (pid:852781) [extension:coc-lists] - files: /share/note/notebook.md 2024-06-11T16:20:15.095 INFO (pid:852781) [attach] - receive notification: doAutocmd [ 2, 2 ] 2024-06-11T16:20:15.114 INFO (pid:852781) [attach] - receive notification: doAutocmd [ 7 ] 2024-06-11T16:20:16.677 INFO (pid:852781) [attach] - receive notification: doAutocmd [ 7 ] 2024-06-11T16:20:16.727 INFO (pid:852781) [attach] - receive notification: doAutocmd [ 7 ] 2024-06-11T16:20:22.525 INFO (pid:852781) [attach] - receive notification: openList [ 'mru' ] 2024-06-11T16:20:22.526 INFO (pid:852781) [extension:coc-lists] - cwd: /share/note 2024-06-11T16:20:22.556 INFO (pid:852781) [extension:coc-lists] - files: /share/note/notebook.md 2024-06-11T16:20:22.567 INFO (pid:852781) [attach] - receive notification: doAutocmd [ 2, 3 ] 2024-06-11T16:20:22.584 INFO (pid:852781) [attach] - receive notification: doAutocmd [ 7 ] 2024-06-11T16:20:23.560 INFO (pid:852781) [attach] - receive notification: doAutocmd [ 7 ] 2024-06-11T16:20:26.440 INFO (pid:852781) [attach] - receive notification: showInfo []

Describe the bug

When using vim /share/note/notebook.md -c 'cd /share/note and then open mru list, no recent files in /share/note exist.

I add some log to print the cwd in mru list and found it is not the expected one as :pwd.

Reproduce the bug

  1. Open terminial and cd to any directory A.
  2. Open file in another directory B and cd to B in vim arguments: vim /B/test.txt -c 'cd /B'. Make sure B is not a sub dir of A.
  3. Call CocList mru in vim. /B/test.txt is not there.
  4. Call cd /B in vim.
  5. Call CocList mrc again. /B/test.txt is in the list.

Screenshots (optional)

If applicable, add screenshots to help explain your problem.