Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ninmonkey/030e870a239bf3372e92abf5aab05821 to your computer and use it in GitHub Desktop.
Save ninmonkey/030e870a239bf3372e92abf5aab05821 to your computer and use it in GitHub Desktop.
Vs Code Splat expression Hotkey

Get the Extension

First grab the extension: VSCode PowerShell

Install the module

Pwsh> Install-Module -Scope CurrentUser -AllowPrerelease EditorServicesCommandSuite

Add to your $Profile

Import-CommandSuite

Add to your keybindings

    {
        "key": "ctrl+.",
        "command": "PowerShell.InvokeRegisteredEditorCommand",
        "args": { "commandName": "Invoke-DocumentRefactor" },
        "when": "editorLangId == 'powershell'"
    },
    {
        "key": "ctrl+shift+s",
        "command": "PowerShell.InvokeRegisteredEditorCommand",
        "args": { "commandName": "ConvertTo-SplatExpression" },
        "when": "editorLangId == 'powershell'"
    },

Extras

    {
        "key": "alt+shift+m",
        "command": "PowerShell.InvokeRegisteredEditorCommand",
        "args": {
            "commandName": "ExpandMemberExpression"
        },
        "when": "editorLangId == 'powershell'"
    },
    {
        "key": "alt+shift+n",
        "command": "PowerShell.InvokeRegisteredEditorCommand",
        "args": {
            "commandName": "AddResolvedNamespace"
        },
        "when": "editorLangId == 'powershell'"
    }, {
        "key": "ctrl+shift+down",
        "command": "PowerShell.Debug.Start"
    },

Others, Not specific to the extension

      {
        "key": "ctrl+w",
        "command": "-workbench.action.terminal.killEditor", //Terminal: Kill the Active Terminal in Editor Area
    },
    {
        "key": "ctrl+k ctrl+r",
        "command": "-workbench.action.keybindingsReference"
    },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment