Vscode: showInputBox without highlighting default value

Created on 16 Aug 2016  路  5Comments  路  Source: microsoft/vscode

  • VSCode Version: 1.5.0-insider
  • OS Version: Windows 10

Steps to Reproduce:

  1. Run await vscode.window.showInputBox({prompt: "cmd line", value: "set"})
  2. the value set is highlighted/selected

Currently we can't put the cursor at the end of the default value when running showInputBox. In this case, users have to move the cursor manually if we want to keep the default value as prefix always.

api feature-request quick-pick

Most helpful comment

It would also help if a selection range could be defined.
In my case I would like set the whole file path as value but only select the file base name.

e.g.

/path/to/file/file-name.cpp

Users most likely will only change the file name.cpp but should also have the possibility to change the path.

All 5 comments

That's actually indented use case since the user is likely to accept Enter or over write the pre-set value. @rebornix What is your use-case for this?

This features originally comes from implementing Vim's Ex commands, which support line range as a prefix like 1,3 represents from line #1 to #3 and '<,'> represents lines under user's selection. When users trigger Ex command by :, Vim will help fulfill the line range prefix automatically and then users can type commands directly, eg '>,'<s/a/b/g for replacement. If users don't like the line range Vim puts there automatically, they need to use backspace to delete the range characters.

Vim doesn't select those characters it auto-completes but Code does, so I'm asking if it's possible to add this support to showInputBox.

It would also help if a selection range could be defined.
In my case I would like set the whole file path as value but only select the file base name.

e.g.

/path/to/file/file-name.cpp

Users most likely will only change the file name.cpp but should also have the possibility to change the path.

Concurring to what @sleistner said. I have an open question on Stack overflow: http://stackoverflow.com/questions/38599756/unselecting-input-value-in-a-showinputbox-for-visual-studio-code

+1 to this, it is very counterintuitive to do visual block find/replaces with VSCodeVim as noted in the above mentioned issues with this default behavior. If it were configurable like #23827 makes it, that would be useful for better emulating vim-style editing for VSCodeVim users like myself!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VitorLuizC picture VitorLuizC  路  3Comments

trstringer picture trstringer  路  3Comments

villiv picture villiv  路  3Comments

lukehoban picture lukehoban  路  3Comments

sijad picture sijad  路  3Comments