`:read` does not always use correct file
Describe the bug :read should use correct current path when importing file , currently the behaviour is different on both windows and remote-ssh
To Reproduce
on windows:
- open a folder
- check with ctrl-g what the current directory is
- open a file in that folder
- "import" another file from that folder at the cursor with :r filename (relative)
- error is: "CommandLine: Error executing cmd=r filename. err=Error: ENOENT: no such file or directory, open 'C:\Program Files\Microsoft VS Code\filename'."
- so, doesn't seem to use current directory, however:
- use an absolute path, everything works.
on windows with remote-ssh to linux
- open a folder
- check with ctrl-g what the current directory is
- open a file in that folder
- "import" another file from that folder at the cursor with :r filename (relative path, and completion completes on linux as expected), however
- error is: "CommandLine: Error executing cmd=r filename. err=Error: ENOENT: no such file or directory, open 'C:\Program Files\Microsoft VS Code\filename'." (searches with local relative path)
- "import" another file from that folder at the cursor with :r filename (absolute path, and completion completes on linux as expected)
- error is: "CommandLine: Error executing cmd=r filename. err=Error: ENOENT: no such file or directory, open 'C:\home\username\filename
- use of an absolute does not work since "C:" is inserted.
| :r working | relative | absolute |
|---|---|---|
| windows | no | yes |
| remote-ssh | no | no |
Expected behavior :read should use correct current path when importing file
Screenshots If applicable, add screenshots to help explain your problem. If remapping-related, please attach log output: https://github.com/VSCodeVim/Vim#debugging-remappings.
Environment (please complete the following information):
- Extension (VsCodeVim) version: 1.20.3
- VSCode version: 1.51.1
- OS: Windows
Additional context Add any other context about the problem here.
I have the same issue with both MacOS and Windows when connecting to Remote-SSH (or Remote-<Anything> for that matter). It seems VSCodeVim isn't aware of the local/remote context. Is there a plan to add support for executing :read file or :read !cmdline in a remote context?
I can try to look into this issue in my spare time over the next few days. I'm not sure about the remote part of it, but I am looking into the current working directory part. I'll iron out some edge cases, test on different platforms, and hopefully put up a PR soon.
I have the same issue. The problem appears to be that under Remote-SSH, :read reads from the local file system not the remote one.
Commenting to say this issue still exists... would really appreciate a fix!