Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix logic checking for untitled or raw scripts#1839

Merged
andyleejordan merged 1 commit into
masterPowerShell/PowerShellEditorServices:masterfrom
andschwa/untitled-checkPowerShell/PowerShellEditorServices:andschwa/untitled-checkCopy head branch name to clipboard
Jun 22, 2022
Merged

Fix logic checking for untitled or raw scripts#1839
andyleejordan merged 1 commit into
masterPowerShell/PowerShellEditorServices:masterfrom
andschwa/untitled-checkPowerShell/PowerShellEditorServices:andschwa/untitled-checkCopy head branch name to clipboard

Conversation

@andyleejordan

Copy link
Copy Markdown
Member

This was much more easily accomplished by checking if what we were given
exists as a file path, in which case we use it as-is (a file path, that
must exist, since we launch it directly). Otherwise we can assume that
it's a raw script block, or a URI from the client that probably
represents an untitled file.

This was much more easily accomplished by checking if what we were given
exists as a file path, in which case we use it as-is (a file path, that
must exist, since we launch it directly). Otherwise we can assume that
it's a raw script block, or a URI from the client that probably
represents an untitled file.
@andyleejordan andyleejordan requested a review from a team June 22, 2022 19:14
@andyleejordan andyleejordan enabled auto-merge (squash) June 22, 2022 19:14
@andyleejordan

Copy link
Copy Markdown
Member Author

Fixes a bug introduced in #1830

@SeeminglyScience SeeminglyScience left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

// Script could an actual script, or a URI to a script file (or untitled document).
if (!System.Uri.IsWellFormedUriString(scriptToLaunch, System.UriKind.RelativeOrAbsolute)
|| ScriptFile.IsUntitledPath(scriptToLaunch))
if (System.IO.File.Exists(scriptToLaunch))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is going to break for remote files (e.g. you do an interactive Enter-PSSession and then psedit ./something.ps1) but that's also probably super broken atm anyway. Something we should revisit in the future, but definitely not a blocker to getting this fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.