Skip to content

Variables relativeFile and relativeFileDirname use backslashes in WSL when used in keyboard shortcuts #172099

Open
@jaminthorns

Description

@jaminthorns

Does this issue occur when all extensions are disabled?: Not really, I can't access WSL without the ms-vscode-remote.remote-wsl extension.

  • VS Code Version: 1.74.3
  • OS Version: Windows_NT x64 10.0.19045

Steps to Reproduce:

I have this keyboard shortcut, which comes in handy whenever I want to run a command in the terminal against the current file:

{
  "key": "ctrl+shift+p",
  "command": "workbench.action.terminal.sendSequence",
  "args": { "text": "${relativeFile}" },
  "when": "terminalFocus"
}

When triggering this shortcut in a WSL workspace, it sends the file path with backslashes instead of forward slashes, which negates its usefulness. This happens for both relativeFile and relativeFileDirname, but not for file or fileDirname.

Here's output for each variable when used with the workbench.action.terminal.sendSequence in a keyboard shortcut:

  • file: /home/jamin/projects/environment/config/code/settings/settings.json
  • fileDirname: /home/jamin/projects/environment/config/code/settings
  • relativeFile: config\code\settings\settings.json
  • relativeFileDirname: config\code\settings

When using relativeFile or relativeFileDirname within a task like this:

{
  "label": "print relativeFile",
  "type": "shell",
  "command": "echo ${relativeFile}"
}

The path is printed with forward slashes as expected:

image

Metadata

Metadata

Labels

WSLIssue when using WSLbugIssue identified by VS Code Team member as probable bugconfirmedIssue has been confirmed by VS Code Team memberterminalGeneral terminal issues that don't fall under another labelvariable-resolving

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions