VSCodeVim / VSCodeVim/Vim

`:e` command opens new file instead of open dialog

Open
#8,039 0 comments 0 reactions 0 assignees View on GitHub

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
I want to open an existing file and use vscode's open dialog. Looking at the code, it should be possible with :e without arguments, but currently :e opens a new untitled file.

To Reproduce
Execute :e command in normal mode.

Expected behavior
VSCode's open dialog is shown (same as File -> Open File...)

Environment (please complete the following information):

  • Extension (VsCodeVim) version: v1.24.1
  • VSCode version: 1.72.2
  • OS: Win10

Additional context
This behavior seems to be already implemented:
https://github.com/VSCodeVim/Vim/blob/5f312cb5ef86eb4c8ffd6840b3442f471eeba3a9/src/cmd_line/commands/file.ts#L172
but the code is currently unreachable because omitting the file argument to the command results in args.file being undefined. This also means that args is identical for :e and :enew commands, and currently the :enew behavior is executed first.

I would propose to set the default for the fileNameParser to '' to fix this here:
https://github.com/VSCodeVim/Vim/blob/5f312cb5ef86eb4c8ffd6840b3442f471eeba3a9/src/cmd_line/commands/file.ts#L87

If you agree, I could create a PR for this.

Trying :e . to open the current folder results in an error that I am opening a directory, where a sensible behavior would be to show the file open dialog at the specified folder, but maybe that is a different feature request.

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 in src/cmd_line/commands/file.ts, especially the fileNameParser and command handling around the cited lines. Reproduce :e and :enew in VSCode, then verify the argument parsing and dispatch behavior. Done means :e opens the VSCode file dialog while :enew still opens a new untitled file.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.