Skip to content

Use PSRL release and filter out previous betas #745

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

Merged
merged 13 commits into from
Sep 13, 2018

Conversation

rjmholt
Copy link
Contributor

@rjmholt rjmholt commented Sep 6, 2018

  • Uses the PSReadLine beta3 release from PowerShell gallery instead of downloading the master build from AppVeyor
  • Filters out the old beta versions that don't have @SeeminglyScience's private API in it (which effectively break us trying to pull PSRL2 in)

Quick question: is there anything else that needs changing for better PSRL module support here?

@TylerLeonhardt
Copy link
Member

lolololol

$module = Get-Module -ListAvailable PSReadLine | Where-Object Version -ge '2.0.0' | Sort-Object -Descending Version | Select-Object -First 1
$module = Get-Module -ListAvailable PSReadLine `
| Where-Object Version -ge '2.0.0' `
| Where-Object { $psd = Import-PowerShellDataFile $_.Path; $release = $psd.PrivateData.PSData.Prerelease; -not (@('beta1', 'beta2') -contains $release) } `
Copy link
Member

Choose a reason for hiding this comment

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

wow

Copy link
Member

Choose a reason for hiding this comment

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

I can't believe we need to do this lol

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah 😢

Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

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

🚢 it

$module = Get-Module -ListAvailable PSReadLine | Where-Object Version -ge '2.0.0' | Sort-Object -Descending Version | Select-Object -First 1
$module = Get-Module -ListAvailable PSReadLine `
| Where-Object Version -ge '2.0.0' `
| Where-Object { $psd = Import-PowerShellDataFile $_.Path; $release = $psd.PrivateData.PSData.Prerelease; -not (@('beta1', 'beta2') -contains $release) } `
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe simplify a bit with $release -notin @('beta1','beta2')? If only we had a SemanticVersion class we could use for sorting in Win PS 5.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aha! I wondered if an operator like that existed

Copy link
Contributor

@rkeithhill rkeithhill left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

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

LGTM except some nits

@rjmholt
Copy link
Contributor Author

rjmholt commented Sep 11, 2018

Anyone know why it suddenly doesn't like -AllowPrereleaseVersions?

@rjmholt
Copy link
Contributor Author

rjmholt commented Sep 11, 2018

I've tried @tylerl0706's suggestions: https://www.powershellgallery.com/packages/PowerShellGet/1.5.0.0

Works fine on my machines though

@rjmholt
Copy link
Contributor Author

rjmholt commented Sep 11, 2018

@@ -20,7 +20,7 @@ internal class PSReadLinePromptContext : IPromptContext {
[System.Diagnostics.DebuggerHidden()]
[System.Diagnostics.DebuggerStepThrough()]
param()
return [Microsoft.PowerShell.PSConsoleReadLine]::ReadLine(
return [Microsoft.PowerShell.PSConsoleReadLine, Microsoft.PowerShell.PSReadLine2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null]::ReadLine(
Copy link
Member

Choose a reason for hiding this comment

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

😢

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rkeithhill, @SeeminglyScience turns out:

  • PSCore 6.0 bundles and loaded PSReadLine.dll in $PSHome, so we need to use the assembly-qualified name of the type and we have to provide the version for it to work
  • Windows PowerShell doesn't like assembly-qualified names without the Culture and PublicKeyToken, so I had to add that too...........

But it works and we can take it out when PSCore 6.0 support is ended

Copy link
Collaborator

Choose a reason for hiding this comment

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

On the bright side it's still a whole lot better than having to manually replace the DLL!

@TylerLeonhardt
Copy link
Member

Can you open an issue to remind us to remove that fully qualifying when 6.0 goes out of support?

@rjmholt rjmholt merged commit 0a29e44 into PowerShell:2.0.0 Sep 13, 2018
rjmholt added a commit to rjmholt/PowerShellEditorServices that referenced this pull request Oct 2, 2018
* Use PSRL release and filter out previous betas
* Use fully qualified type name for broad PowerShell support
* Fix CI module installation
rjmholt added a commit to rjmholt/PowerShellEditorServices that referenced this pull request Oct 2, 2018
* Use PSRL release and filter out previous betas
* Use fully qualified type name for broad PowerShell support
* Fix CI module installation
@rjmholt rjmholt deleted the psrl-beta3-release branch December 12, 2018 06:02
TylerLeonhardt pushed a commit to TylerLeonhardt/PowerShellEditorServices that referenced this pull request Dec 14, 2018
* Use PSRL release and filter out previous betas
* Use fully qualified type name for broad PowerShell support
* Fix CI module installation
rjmholt added a commit to rjmholt/PowerShellEditorServices that referenced this pull request Jan 18, 2019
* Use PSRL release and filter out previous betas
* Use fully qualified type name for broad PowerShell support
* Fix CI module installation
rjmholt pushed a commit to rjmholt/PowerShellEditorServices that referenced this pull request Jan 18, 2019
* Add infrastructure for managing context

Adds classes that manage the state of the prompt, nested contexts,
and multiple ReadLine implementations of varying complexity.

(cherry picked from commit 7ca8b9b)

* Console related classes changes

Change ReadLine method to call out to PowerShellContext. This lets
the PowerShellContext determine which ReadLine implementation to use
based on available modules.

Also includes some changes to the System.Console proxy classes to
account for PSReadLine.

(cherry picked from commit 59bfa3b)

* Rewrite command invocation operations for PSRL

Refactor PowerShellContext to have a more robust system for
tracking the context in which commands are invoked. This is a
significant change in that all interactions with the runspace
must be done through methods in PowerShellContext. These changes
also greatly increase stability.

(cherry picked from commit 21e6b5f)

* Rewrite direct SessionStateProxy calls

All interactions with the runspace must be done through
PowerShellContext now that nested PowerShell instances are
encountered frequently.

Also fix a bunch of race conditions that were made more obvious
with the changes.

(cherry picked from commit fa2faba)

* Pass feature flags to Start-EditorServicesHost

* Address feedback and fix travis build error

- Address feedback from @bergmeister

- Fix a few other similar mistakes I found

- Fix travis build failing due to missing documentation comment tag

* Fix all tests except ServiceLoadsProfileOnDemand

- Fix an issue where intellisense wouldn't finish if PSReadLine was not
  running

- Fix a crash that would occur if the PSHost was not set up for input
  like the one used in our tests

- Fix a compile error when building against PSv3/4

- Fix a hang that occurred when the PromptNest was disposed during a
  debug session

- Fix some XML documentation comment syntax errors

* Fix extra new lines outputted after each command

Removed a call to WriteOutput where it wasn't required.  This was
creating extra new lines which failed tests (and obviously didn't
look right).

* Remove unused field from InvocationEventQueue

And also fix spacing between the other fields.

* Remove copying of PDB's in build script

@rjmholt did a better job of this in a different PR that we can merge
into 2.0.0 later. It also doesn't make sense in this PR.

* Add AppVeyor tracking to branch 2.0.0

* Fix ambiguous method crash on CoreCLR

Simplify delegate creation in PSReadLineProxy and fix the immediate
ambiguous method crash the complicated code caused on CoreCLR.

* first round of feedback changes

* Some more feedback changes

* add a bunch of copyright headers I missed

* remove KeyAvailable query

* Get the latest PSReadLine module installed

* Add PSReadLine installation to build script

* the file should be downloaded as a .zip

* Address remaining feedback

* Attempt to fix issue with native apps and input

On Unix like platforms some native applications do not work properly if
our event subscriber is active. I suspect this is due to PSReadLine
querying cursor position prior to checking for events. I believe the
cursor position response emitted is being read as input.

I've attempted to fix this by hooking into PSHost.NotifyBeginApplication
to temporarly remove the event subscriber, and
PSHost.NotifyEndApplication to recreate it afterwards.

* Revert "Attempt to fix issue with native apps and input"

This reverts commit 1682410.

* Fix build failure

Use latest PSReadLine (PowerShell#745)

* Use PSRL release and filter out previous betas
* Use fully qualified type name for broad PowerShell support
* Fix CI module installation
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

Successfully merging this pull request may close these issues.

4 participants