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

Create new command to interpolate text into code, to run in the console #5797

Open
juliasilge opened this issue Dec 18, 2024 · 1 comment
Open
Labels
area: console Issues related to Console category. area: core Issues related to Core category. enhancement New feature or request support

Comments

@juliasilge
Copy link
Contributor

In #5747 we've got a feature request for a command similar to workbench.action.executeCode.console that would allow someone to interpolate a selection into a bit of code, to run in the console. Something like this:

{
    "key": "Cmd+Shift+S",
    "command": "workbench.action.executeSelection.console",
    "when": "editorTextFocus",
    "args": {
        "langId": "r",
        "code": "str(${selectedText})",
        "focus": true
    }
}

You can already run selected code, but this is about selecting code and then constructing/interpolating a new bit of code to run.

@juliasilge juliasilge added area: console Issues related to Console category. area: core Issues related to Core category. enhancement New feature or request support labels Dec 18, 2024
@jennybc
Copy link
Member

jennybc commented Dec 18, 2024

This type of variable substitution is the idea (these are the "usual suspects" for what users might want to use in a custom command/key binding they might create around workbench.action.executeSelection.console):

https://code.visualstudio.com/docs/editor/variables-reference

I imagine this runs into similar concerns as "runnable code" in terms of security. Individual users crafting custom commands is one thing ("you break it you buy it"), but having other folks do this in an extension is another.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: console Issues related to Console category. area: core Issues related to Core category. enhancement New feature or request support
Projects
None yet
Development

No branches or pull requests

2 participants