Home > front end >  VSCode F8 function issue
VSCode F8 function issue

Time:06-30

I recently updated the latest version of PowerShell (7.2.5) as well as my version of VSCode to:

Version: 1.68.1 (user setup)
Commit: 30d9c6cd9483b2cc586687151bcbcd635f373630
Date: 2022-06-14T12:48:58.283Z
Electron: 17.4.7
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Windows_NT x64 10.0.18363

After these updates, when I have my PowerShell 7.2.5 integrated terminal open and I highlight and run code from the editor using f8, the code runs as expected. However, as soon as the code finishes running, all the code is then pasted into the terminal as if I were to run it again. This issue does not happen if I do not use vscodes integrated terminal for PowerShell 7.2.5.

The example below illustrates the issue.

  1. I highlighted the code.
  2. I pressed f8.
  3. The code runs as expected.
  4. But then is copied out to the terminal

enter image description here

The only thing I can think of is the issue may be with a change to some keybindings between VSCode versions. I have attached my default keybindings as I have no overriding keybindings.

Below are the only keybindings I have that relate to f8

{ "key": "alt f8",                "command": "editor.action.marker.next",
                                     "when": "editorFocus" },
{ "key": "f8",                    "command": "editor.action.marker.nextInFiles",
                                     "when": "editorFocus" },
{ "key": "shift alt f8",          "command": "editor.action.marker.prev",
                                     "when": "editorFocus" },
{ "key": "shift f8",              "command": "editor.action.marker.prevInFiles",
                                     "when": "editorFocus" },
{ "key": "alt f8",                "command": "testing.goToNextMessage",
                                     "when": "editorFocus && testing.isPeekVisible" },
{ "key": "shift alt f8",          "command": "testing.goToPreviousMessage",
                                     "when": "editorFocus && testing.isPeekVisible" },
{ "key": "f8",                    "command": "PowerShell.RunSelection",
                                     "when": "editorTextFocus && editorLangId == 'powershell'" },

CodePudding user response:

This is a bug in Powershell plugin version 2022.6.1 - you can roll back in the extension editor by installing the may version.

  1. Open the extension tab,
  2. Search for Powershell
  3. Click the down arrow on the Unisntall and select Install another version
  4. Select 2022.5.1
  5. Reload when prompted.

This is discussed in the GitHub channel for the powershell plugin. https://github.com/PowerShell/vscode-powershell/issues/4041

  • Related