Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Variable Substitution for Keyboard Binding Command Arguments #140136

Open
ericdrobinson opened this issue Jan 5, 2022 · 4 comments
Open
Labels
feature-request Request for new features or functionality keybindings VS Code keybinding issues
Milestone

Comments

@ericdrobinson
Copy link

Issue Type: Feature Request

I am working on a debugger extension for VSCode that provides a command to run a configurable script in a configurable host. Users would very much benefit from the ability to specify the same variables that they can in launch.json in the Command Arguments for a given keyboard binding that triggers the "Run Target Script" command.

An example might look like:

{
    "key": "cmd+alt+j",
    "command": "extension.extendscript-debug.evalInHost",
    "args": {
        "hostAppSpecifier": "premierepro-22",
        "engineName": "NewWorld",
        "filePath": "${file}",    // <-- Variable Substitution!
        "debugLevel": 0,
    },
}

System Information

VS Code version: Code 1.63.2 (Universal) (899d46d, 2021-12-15T09:37:28.172Z)
OS version: Darwin arm64 21.2.0
Restricted Mode: No
Remote OS version: Linux arm64 5.10.76-linuxkit
Remote OS version: Linux arm64 5.10.76-linuxkit

@weinand weinand assigned alexdima and unassigned weinand Jan 5, 2022
@alexdima alexdima added feature-request Request for new features or functionality keybindings VS Code keybinding issues labels Jan 11, 2022
@alexdima alexdima removed their assignment Jan 11, 2022
@blueray453
Copy link

I tried

{
    "key": "ctrl+q c",
    "command": "type",
    "when": "editorTextFocus",
    "args": {
        "text": "${fileDirname}/${selectedText}"
    }
}

and it does not substitute the variables.

@RalfReddings
Copy link

I really need this feature. Any plans to add it?

@dimateos
Copy link

Currently seems like the substitution is done by the command reciever like in workbench.action.findInFiles, so other commands like editor.action.startFindReplaceAction dont. See #151311.

It would be much simpler if the substitution happened before sending the arguments like suggested in this issue.

@pksunkara
Copy link
Contributor

@alexdima I would be willing to contribute a PR if you can point out the relevant code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality keybindings VS Code keybinding issues
Projects
None yet
Development

No branches or pull requests

8 participants
@pksunkara @blueray453 @weinand @alexdima @ericdrobinson @dimateos @RalfReddings and others