-
Notifications
You must be signed in to change notification settings - Fork 20
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
Plugin is not correctly detecting Powershell 7 #259
Comments
Oh, that is a very interesting story, and there's quite a bit to unpack here. First thing, The whole endeavor I assume could be connected with #79, and, through that, to PowerShell/PowerShell#11747 (a long-standing issue I recently fixed myself in PowerShell — the fixed version is also not yet released). When you run > pwsh.exe -Command "(`$PSVersionTable.PSVersion, `$PSVersionTable.PSEdition) -join ' '" Otherwise, it will interpolate But then, it is not yet clear what happens with the process output. Maybe stderr is blocked or something? I digress and let's get to the point, though.
|
Thanks for the response! My bad, I should have been checking the code at the release tag 😅
>pwsh.exe -Command "($PSVersionTable.PSVersion, $PSVersionTable.PSEdition) -join ' '" > out.txt ...which gave no output to the terminal. However, the
Looks like your suspicion is right, it's my profile. The culprits are PowerToys CommandNotFound and I put it into If I modify the command to be pwsh.exe -NoProfile -NonInteractive -Command "($PSVersionTable.PSVersion, $PSVersionTable.PSEdition) -join ' '" > out.txt then the output is as expected: Looks like your merged |
Thanks for your response. |
Environment info
Powershell Plugin version: 2.6.0 JetBrains Rider version 2023.3.4 Powershell version: 7.4.1
Hey there!
The issue
The extension seems to fail to detect the version of Powershell 7 I'm using. The language server seemingly never starts up.
The details
I loaded up a Powershell script I'm authoring in Rider with your extension installed, and got some strange syntax highlighting:
None of the inspections were working, either.
I thought this could be due to a Powershell version mismatch, so I checked the settings for the plugin. Strangely, the executable was the correct one, but the text below said it was version 5.1:
When I tried changing the executable to
powershell.exe
the syntax highlighting and analysis worked correctly, though of course it stumbled on any Powershell 6+ features. I checked Process Explorer to see how Rider was executingpowershell.exe
, and saw it was correctly launching the editor services.At this point, I uninstalled and reinstalled the plugin, for good measure.
After changing the executable back to
pwsh.exe
, I checked the spawnedpwsh.exe
processes and saw a bunch of them:They all had this command line invocation:
It's looking like the plugin code is having trouble interpreting the output of the command. I first thought it could be a quoting/interpolation issue, as when I run the same command from within a
pwsh.exe
shell, it throws an error:Converting to single quotes on the outside and double quotes in the
-join
fixed this when I ran it inpwsh.exe
and I tried poking around in your source to see if I could make that change and test it locally. However, I've never developed anything in Kotlin before and know nothing of the ecosystem. The learning curve is sadly a bit too steep for me to just pick it up and go.However it's likely that's not the issue anyhow, as the command as originally formatted works fine when run through
cmd.exe
, and, I assume, through theGeneralCommandLine
method. I did notice that theGeneralCommandLine
arguments include-NoProfile
, while what's getting executed on my machine does not. Not sure what this means, honestly, seeing as I've got the latest version of the plugin installed.The text was updated successfully, but these errors were encountered: