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

Problem highlighting and running functions using F8 #721

Closed
AndySchneiderDev-zz opened this issue May 9, 2017 · 5 comments
Closed

Problem highlighting and running functions using F8 #721

AndySchneiderDev-zz opened this issue May 9, 2017 · 5 comments

Comments

@AndySchneiderDev-zz
Copy link
Contributor

System Details

  • Operating system name and version: Windows 10, 1703
  • VS Code version: 1.11.2
  • PowerShell extension version: 0.12.1.0
  • Output from $PSVersionTable:
PS C:\> code --list-extensions --show-versions
eamodio.gitlens@3.4.9
Ionide.Ionide-fsharp@2.25.12
Ionide.Ionide-Paket@1.6.3
ms-vscode.csharp@1.9.0
ms-vscode.PowerShell@0.12.2
qinjia.view-in-browser@0.0.5
Shan.code-settings-sync@2.7.0
PS C:\> $psversiontable

Name                           Value
----                           -----
PSVersion                      5.1.15063.138
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.138
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I am experiencing a problem with running code by selecting code in the editor and pushing F8. The problem is when i have a function and then call it right after.

Function Get-Foo {
    "Foo"
}

Get-Foo

If I highlight the code above in the editor, right click and choose "Run selection" it works as expected. If I highlight the code and press F8 to run the selection, i get an error that says Missing closing '}' in statement block or type definition. At line:0 char:0

Attached Logs

Follow the instructions in the README
about capturing and sending logs.

@eishockey
Copy link

Same problem with code likie this:

$MyVariable = @(
"Value 1"
"Value 2"
)

VSCode Version: 0.12.1
VSCode Powershell Version: 0.12.2

@daviwil
Copy link
Contributor

daviwil commented May 10, 2017

Hey guys! Can you check and see what your F8 key is bound to? Mine looks like this:

image

It could be that you have your F8 key bound to the command workbench.action.terminal.runSelectedText. If you do, these multi-line evaluations won't work because of issue #569. Remove that command binding and F8 should start working for you again.

@AndySchneiderDev-zz
Copy link
Contributor Author

That worked. Thanks!

@mcascone
Copy link

mcascone commented Feb 8, 2023

I actually had to do the opposite: remove F8 from the powershell Run Selection binding, and add F8 to the workbench.actions.terminal.runSelectedText command.

Version: 1.75.0 (Universal)
Commit: e2816fe719a4026ffa1ee0189dc89bdfdbafb164
Date: 2023-02-01T15:24:42.903Z
Electron: 19.1.9
Chromium: 102.0.5005.194
Node.js: 16.14.2
V8: 10.2.154.23-electron.0
OS: Darwin arm64 22.2.0
Sandboxed: No

@ghost
Copy link

ghost commented Feb 8, 2023

Thank you for your comment, but please note that this issue has been closed for over a week. For better visibility, consider opening a new issue with a link to this instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants