VSCodeVim / VSCodeVim/Vim

`:read` does not always use correct file

Open
#6,678 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/commandline kind/bug
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:

  1. open a folder
  2. check with ctrl-g what the current directory is
  3. open a file in that folder
  4. "import" another file from that folder at the cursor with :r filename (relative)
  5. error is: "CommandLine: Error executing cmd=r filename. err=Error: ENOENT: no such file or directory, open 'C:\Program Files\Microsoft VS Code\filename'."
  6. so, doesn't seem to use current directory, however:
  7. use an absolute path, everything works.

on windows with remote-ssh to linux

  1. open a folder
  2. check with ctrl-g what the current directory is
  3. open a file in that folder
  4. "import" another file from that folder at the cursor with :r filename (relative path, and completion completes on linux as expected), however
  5. 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)
  6. "import" another file from that folder at the cursor with :r filename (absolute path, and completion completes on linux as expected)
  7. error is: "CommandLine: Error executing cmd=r filename. err=Error: ENOENT: no such file or directory, open 'C:\home\username\filename
  8. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.