-
Notifications
You must be signed in to change notification settings - Fork 513
Use powerShellDefaultVersion
everywhere and stop using powerShellExePath
#2304
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
Use powerShellDefaultVersion
everywhere and stop using powerShellExePath
#2304
Conversation
@TylerLeonhardt does this cover user settings, workspace settings, and folder settings and the precedence order therein (folder > workspace > user)? |
This should only change the user setting of Has this not been the case? |
…and remove references to developer.powerShellExePath
Last I checked powershell.PowershellDefaultversion didn't work at the folder settings level (e.g. .vscode/settings.json), just seeing if this respects it as well. Sorry, I'm really bad at reviewing Typescript :/ EDIT: But this has usually been because of PowershellExePath, maybe it'll work now. Adding a test maybe? EDIT2: I forgot "workspace settings" encompasses both folder settings and workspace file settings. It should work fine. I'll download the .vsix from the azure pipelines build and try it out. |
Looks like most everything works. Workspace setting overrides user settings, and if you change user settings with workspace settings already set, it doesn't override it (as expected). I'll code review for one specific behavior I think should be different, if I can find it... |
Found it. vscode-powershell/src/settings.ts Line 201 in 01c4a2b
So the settings change method always only writes to the user settings, which leads to the following undesirable scenario:
Try it, you keep trying to change the session and it keeps going back to whatever the workspace setting is, because only the user setting is getting updated but the workspace setting takes precedence. The behavior for Session Menu should be (IMHO):
I'm not sure if this should be true for all powershell settings (adjust default CaveatThe one rub here is that if a module author has set this in the workspace for his repository as an indicator to the user which powershell to use, it will get changed and potentially committed back to the repository by the user as they try out different shells. The fix for this is probably out of scope (and just tell the user "dont do it" or block .vscode commit updates) but an idea could be something along the lines of:
In addition, potentially add setting to make shell changes nonpersistent, where it will switch to the shell but not update the workspace setting. |
Also: Potential regression - I've tried the CI build on two computers, and it prompted to remove PSExePath. After it prompted for reload it crashed with:
However doing a Developer: Reload window and it works fine. A minor item but may be worth investigating. |
@JustinGrote thanks for pointing that out! That is an issue. I've addressed it in the last commit. Here's what we do now - the session menu will always impact user settings. In the future we could have a nice wizard that does more... but for now, it will always impact user settings. That said, with that last commit we force the extension to start with the PowerShell exe that was chosen no matter what the workspace setting is set to. |
Looks like the crash came from PowerShellEditorServices... how consistent is that repro? I cant seem to repro at all. |
Not super consistent but the common denominator was neither
powershellexepath or defaultpowershell were set.
…On Thu, Nov 14, 2019, 3:35 PM Tyler James Leonhardt < ***@***.***> wrote:
Also: Potential regression
Looks like the crash came from PowerShellEditorServices... how consistent
is that repro? I cant seem to repro at all.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2304?email_source=notifications&email_token=ADUNKUSODQYKBSGLR6TM5BDQTXOFZA5CNFSM4JNDO4UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEDW4LI#issuecomment-554135085>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADUNKUXKX24SJY7UFT2OFI3QTXOFZANCNFSM4JNDO4UA>
.
|
Hmm interesting. I'll give it a try a few times but I don't think it's this change's fault. That's a PowerShell Editor Services issue. This PR is ready for a real review now. |
@TylerLeonhardt #2311 might be a bug from this I ran into since I'm running the VSIX from this PR. So far I can consistently reproduce by starting the powershell editor in an "empty" vscode window (no folder opened) and starting a new powershell file. |
nice find - got a PR out to fix it. |
src/session.ts
Outdated
@@ -691,53 +629,15 @@ export class SessionManager implements Middleware { | |||
SessionStatus.Failed); | |||
} | |||
|
|||
private changePowerShellExePath(exePath: string) { | |||
private changePowerShellDefaultVersion(exePath: IPowerShellExeDetails) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it would be a simple async
method now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/settings.ts
Outdated
@@ -69,7 +69,7 @@ export interface IDebuggingSettings { | |||
|
|||
export interface IDeveloperSettings { | |||
featureFlags?: string[]; | |||
powerShellExePath?: string; | |||
// This setting is no longer used but is here to assist in cleaning up the users settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What setting does this comment apply to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops - removed that.
PR Summary
fixes #2099
At long last, this PR removes the use of the
powerShellExePath
setting. @rkeithhill added an awesome feature a while back which allowed folks to be more granular with what version of PowerShell they want to use via the session menu.This PR does the following:
Any operation that previously changed
powerShellExePath
now changespowerShellDefaultVersion
If the user has

powerShellExePath
andpowerShellDefaultVersion
set, a notification appears to remove thepowerShellExePath
from the settings.If the user has

powerShellExePath
but notpowerShellDefaultVersion
, a notification appears to removepowerShellExePath
and shows the session menu so the user can choose which version they want to use.This does mess up users who have set
powerShellExePath
to "non well-known" locations... but I think those will be a small case... also, to help those folks and other folks who want to add additional PS exes, I added an item to the session menu that tells people they can modify a setting to add additional PS exes.For this, it just jumps to the settings.json but in the future maybe we could have a little wizard that helps with adding them.
PR Checklist
Note: Tick the boxes below that apply to this pull request by putting an
x
between the square brackets.Please mark anything not applicable to this PR
NA
.WIP:
to the beginning of the title and remove the prefix when the PR is ready