Skip to content

PowerShell preview extension does not allow running selection from undefined files #2137

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

Closed
Glober777 opened this issue Aug 14, 2019 · 2 comments · Fixed by #2141
Closed

Comments

@Glober777
Copy link

Issue Description

I've noticed that every time I create a new file (without saving it), set it as PowerShell, add in some code, select a fraction (or all of it), followed by pressing F8 I get a notification saying: Cannot read property 'name' of undefined:
image

image

Running selection with F8 starts to work only after I run the whole thing with first (F5).

This is not how it works in ISE.

Attached Logs

Couldn't find anything related in the logs. Please let me know if those are needed.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.17763
VSCode 1.37.0
PowerShell Extension Version 2019.5.0

PowerShell Information

Name Value
PSVersion 5.1.17763.503
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.17763.503
BuildVersion 10.0.17763.503
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
azure-account ms-vscode 0.8.4
azure-pipelines ms-azure-devops 1.155.0
beautify HookyQR 1.5.0
code-settings-sync Shan 3.4.1
code-spell-checker streetsidesoftware 1.7.17
csharp ms-vscode 1.21.0
docs-article-templates docsmsft 0.2.7
docs-authoring-pack docsmsft 0.1.2
docs-markdown docsmsft 0.2.13
docs-preview docsmsft 0.3.25
docs-yaml docsmsft 0.2.3
ecdc mitchdenny 1.3.0
EditorConfig EditorConfig 0.13.0
gc-excelviewer GrapeCity 2.1.32
gitlens eamodio 9.9.3
live-html-previewer hdg 0.3.0
mssql ms-mssql 1.6.0
partial-diff ryu1kn 1.4.0
pomodoro-code odonno 0.2.1
powershell-preview ms-vscode 2019.5.0
team ms-vsts 1.149.2
theme-hackershaze Nuuf 2.0.1
todo-tree Gruntfuggly 0.0.141
vscode-hexdump slevesque 1.7.2
vscode-logicapps ms-azuretools 0.2.9
vscode-markdownlint DavidAnson 0.30.1
vscode-yaml redhat 0.4.1
xml DotJoshJohnson 2.5.0
@ghost ghost added the Needs: Triage Maintainer attention needed! label Aug 14, 2019
@ghost ghost added the Status: In PR label Aug 16, 2019
@SydneyhSmith
Copy link
Collaborator

@Glober777 thanks for opening this issue, we were able to re-produce this and it looks like it is occurring because it looks as if vscode.window.activeTerminal is undefined until you have clicked into the terminal.

FYI @Tyriar not sure if you guys are aware/expecting this behavior, it doesnt seem ideal considering the terminal is in view/appears active

See the above PR for the workaround.

@Tyriar
Copy link
Contributor

Tyriar commented Aug 16, 2019

This is by design, a terminal only becomes active once it is first focused.

@SydneyhSmith SydneyhSmith added Area-Extension Terminal Issue-Bug A bug to squash. and removed Needs: Triage Maintainer attention needed! labels Aug 20, 2019
@ghost ghost added Status: Fixed and removed Status: In PR labels Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants