`:read` does not always use correct file
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the :read command entry point and how it resolves relative and absolute paths in local Windows and Remote-SSH sessions. Reproduce the reported cases, then verify that imports use the correct current workspace path and remote filesystem without adding an incorrect local drive prefix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100