anderssonpeter / powertype Goto Github PK
View Code? Open in Web Editor NEWAutocomplete for PowerShell
License: MIT License
Autocomplete for PowerShell
License: MIT License
Describe the bug
When trying to enable PowerType to use it, it emits an unsupported platform error:
Enable-PowerType: Operation is not supported on this platform.
To Reproduce
Steps to reproduce the behavior:
Install-Module PowerType -AllowPrerelease
Enable-PowerType
Expected behavior
To function as expected from the README.
Environment (please complete the following information):
$PSVersionTable
Name Value
---- -----
PSVersion 7.2.6
PSEdition Core
GitCommitId 7.2.6
OS Linux 5.19.11-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 24 Sep 2022 18:24:15 +0000
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Additional context
Using https://stackoverflow.com/a/798136 to get the error.
Inspecting the source, it faults around here:
PowerType/PowerType/BackgroundProcessing/ExecutionEngineThread.cs
Lines 93 to 99 in d1c6cc1
PSMessageDetails :
Exception : System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Management.Automation.Internal.SecuritySupport.SetExecutionPolicy(ExecutionPolicyScope scope, ExecutionPolicy policy, String shellId)
at System.Management.Automation.Runspaces.InitialSessionState.Bind(ExecutionContext context, Boolean updateOnly, PSModuleInfo module, Boolean noClobber, Boolean
local, Boolean setLocation)
at System.Management.Automation.AutomationEngine..ctor(PSHost hostInterface, InitialSessionState iss)
at System.Management.Automation.Runspaces.LocalRunspace.DoOpenHelper()
at System.Management.Automation.Runspaces.LocalRunspace.OpenHelper(Boolean syncCall)
at System.Management.Automation.Runspaces.RunspaceBase.CoreOpen(Boolean syncCall)
at System.Management.Automation.Runspaces.RunspaceBase.Open()
at PowerType.BackgroundProcessing.ExecutionEngineThread.CreateRunspace() in
D:\a\PowerType\PowerType\PowerType\BackgroundProcessing\ExecutionEngineThread.cs:line 99
at PowerType.BackgroundProcessing.ExecutionEngineThread..ctor(ThreadQueue`1 queue) in
D:\a\PowerType\PowerType\PowerType\BackgroundProcessing\ExecutionEngineThread.cs:line 29
at PowerType.BackgroundProcessing.ExecutionEngine.Start() in D:\a\PowerType\PowerType\PowerType\BackgroundProcessing\ExecutionEngine.cs:line 29
at PowerType.PowerTypePredictor..ctor(ICurrentWorkingDirectoryProvider currentWorkingDirectoryProvider, IEnumerable`1 dictionaryFiles) in
D:\a\PowerType\PowerType\PowerType\PowerTypePredictor.cs:line 28
at PowerType.EnablePowerTypePredictor.ProcessRecord() in D:\a\PowerType\PowerType\PowerType\EnablePowerTypePredictor.cs:line 56
at System.Management.Automation.Cmdlet.DoProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
TargetObject :
CategoryInfo : NotSpecified: (:) [Enable-PowerType], PlatformNotSupportedException
FullyQualifiedErrorId : System.PlatformNotSupportedException,PowerType.EnablePowerTypePredictor
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
MyCommand : Enable-PowerType
BoundParameters : {}
UnboundArguments : {}
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 50
ScriptName :
Line : Enable-PowerType
PositionMessage : At line:1 char:1
+ Enable-PowerType
+ ~~~~~~~~~~~~~~~~
PSScriptRoot :
PSCommandPath :
InvocationName : Enable-PowerType
PipelineLength : 0
PipelinePosition : 0
ExpectingInput : False
CommandOrigin : Internal
DisplayScriptPosition :
00000000000000000000000000000000000000000000000000000000000000000000000000000000
TargetSite : Void SetExecutionPolicy(Microsoft.PowerShell.ExecutionPolicyScope, Microsoft.PowerShell.ExecutionPolicy, System.String)
Message : Operation is not supported on this platform.
Data : {}
InnerException :
HelpLink :
Source : System.Management.Automation
HResult : -2146233031
StackTrace : at System.Management.Automation.Internal.SecuritySupport.SetExecutionPolicy(ExecutionPolicyScope scope, ExecutionPolicy policy, String shellId)
at System.Management.Automation.Runspaces.InitialSessionState.Bind(ExecutionContext context, Boolean updateOnly, PSModuleInfo module, Boolean noClobber, Boolean local,
Boolean setLocation)
at System.Management.Automation.AutomationEngine..ctor(PSHost hostInterface, InitialSessionState iss)
at System.Management.Automation.Runspaces.LocalRunspace.DoOpenHelper()
at System.Management.Automation.Runspaces.LocalRunspace.OpenHelper(Boolean syncCall)
at System.Management.Automation.Runspaces.RunspaceBase.CoreOpen(Boolean syncCall)
at System.Management.Automation.Runspaces.RunspaceBase.Open()
at PowerType.BackgroundProcessing.ExecutionEngineThread.CreateRunspace() in D:\a\PowerType\PowerType\PowerType\BackgroundProcessing\ExecutionEngineThread.cs:line 99
at PowerType.BackgroundProcessing.ExecutionEngineThread..ctor(ThreadQueue`1 queue) in
D:\a\PowerType\PowerType\PowerType\BackgroundProcessing\ExecutionEngineThread.cs:line 29
at PowerType.BackgroundProcessing.ExecutionEngine.Start() in D:\a\PowerType\PowerType\PowerType\BackgroundProcessing\ExecutionEngine.cs:line 29
at PowerType.PowerTypePredictor..ctor(ICurrentWorkingDirectoryProvider currentWorkingDirectoryProvider, IEnumerable`1 dictionaryFiles) in
D:\a\PowerType\PowerType\PowerType\PowerTypePredictor.cs:line 28
at PowerType.EnablePowerTypePredictor.ProcessRecord() in D:\a\PowerType\PowerType\PowerType\EnablePowerTypePredictor.cs:line 56
at System.Management.Automation.Cmdlet.DoProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
Tracking issue for:
simplify conditions to constant when possible (no dynamic expressions are involved).
This should improve performance as conditions are evaluated many times.
This is causing 2 unit tests to currently fail
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
git merge
Add logging of ast, result, query time, background processing time, background processing health.
Would it be possible to show more than 10 items of hints?
Maybe this could be a parameter on Enable-PowerType
?
Enable-PowerType -HintCount 20
It would be nice if we could provide something like -1
, which would mean "rest of the screen" which would just do as many items as the terminal screen fits.
Improve expression execution by adding additional variables
It should return the following fields: Name, Platforms, Loaded
Describe the bug
Default instructions are incomplete, or there is a bug somewhere.
To Reproduce
Steps to reproduce the behavior:
Install-Module PowerType -AllowPrerelease
Enable-PowerType
Expected behavior
I expected PowerType to be enabled without throwing any errors.
Environment (please complete the following information):
Additional context
There is no need for move that logic into ExecutionEngineThread.Handle(InitializeDictionaryCommand)
The current handle ling of the inpit ast is fairly basic and easily breaks.
Improve it to handle both prefix and suffix.
Describe the bug
Installing 0.0.13-preview fails with an error about needing either Admin rights or "-Scope CurrentUser". Both are set.
Installing 0.0.12-preview works fine.
Fails both without PowerType installed and with 0.0.12 installed. In both cases PSReadLine 2.2.6 is installed (cannot easily downgrade).
To Reproduce
❯ Install-Module -Name PowerType -AllowPrerelease -Scope CurrentUser -Verbose -RequiredVersion 0.0.13-preview
VERBOSE: Acquiring providers for assembly: C:\Users\vincent.goossens\Documents\PowerShell\Modules\PackageManagement\1.4.8.1\coreclr\netstandard2.0\Microsoft.PackageManagement.NuGetProvider.dll
VERBOSE: Acquiring providers for assembly: C:\Users\vincent.goossens\Documents\PowerShell\Modules\PackageManagement\1.4.8.1\coreclr\netstandard2.0\Microsoft.PackageManagement.ArchiverProviders.dll
VERBOSE: Acquiring providers for assembly: C:\Users\vincent.goossens\Documents\PowerShell\Modules\PackageManagement\1.4.8.1\coreclr\netstandard2.0\Microsoft.PackageManagement.CoreProviders.dll
VERBOSE: Acquiring providers for assembly: C:\Users\vincent.goossens\Documents\PowerShell\Modules\PackageManagement\1.4.8.1\coreclr\netstandard2.0\Microsoft.PackageManagement.MetaProvider.PowerShell.dll
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: The -Repository parameter was not specified. PowerShellGet will use all of the registered repositories.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerType'' for ''.
VERBOSE: Total package yield:'1' for the specified package 'PowerType'.
VERBOSE: Performing the operation "Install-Module" on target "Version '0.0.13-preview' of module 'PowerType'".
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): a
VERBOSE: The installation scope is specified to be 'CurrentUser'.
VERBOSE: The specified module will be installed in 'C:\Users\vincent.goossens\Documents\PowerShell\Modules'.
VERBOSE: The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'.
VERBOSE: Downloading module 'PowerType' with version '0.0.13-preview' from the repository 'https://www.powershellgallery.com/api/v2'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerType'' for ''.
VERBOSE: InstallPackage' - name='PowerType', version='0.0.13-preview',destination='C:\Users\vincent.goossens\AppData\Local\Temp\655688694'
VERBOSE: DownloadPackage' - name='PowerType', version='0.0.13-preview',destination='C:\Users\vincent.goossens\AppData\Local\Temp\655688694\PowerType.0.0.13-preview\PowerType.0.0.13-preview.nupkg', uri='https://www.powershellgallery.com/api/v2/package/PowerType/0.0.13-preview'
VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/PowerType/0.0.13-preview'.
VERBOSE: Completed downloading 'https://www.powershellgallery.com/api/v2/package/PowerType/0.0.13-preview'.
VERBOSE: Completed downloading 'PowerType'.
VERBOSE: InstallPackageLocal' - name='PowerType', version='0.0.13-preview',destination='C:\Users\vincent.goossens\AppData\Local\Temp\655688694'
VERBOSE: Validating the 'PowerType' module contents under 'C:\Users\vincent.goossens\AppData\Local\Temp\655688694\PowerType.0.0.13-preview' path.
VERBOSE: Test-ModuleManifest successfully validated the module manifest file 'C:\Users\vincent.goossens\AppData\Local\Temp\655688694\PowerType.0.0.13-preview'.
VERBOSE: Validating the authenticode signature and publisher of the catalog file or module manifest file of the module 'PowerType'.
VERBOSE: Catalog file 'PowerType.cat' is not found in the contents of the module 'PowerType' being installed.
VERBOSE: For publisher validation, current module 'PowerType' with version '0.0.13' with publisher name '' from root certificate authority ''. Is this module signed by Microsoft: 'False'.
VERBOSE: For publisher validation, using the previously-installed module 'PowerType' with version '0.0.12' under 'C:\Users\vincent.goossens\Documents\PowerShell\Modules\PowerType\0.0.12' with publisher name '' from root certificate authority ''. Is this module signed by Microsoft: 'False'.
VERBOSE: Checking for possible command collisions for the module 'PowerType' commands.
Install-Package: Administrator rights are required to install or update. Log on to the computer with an account that has Administrator
rights, and then try again, or install by adding "-Scope CurrentUser" to your command. You can also try running the
Windows PowerShell session with elevated rights (Run as Administrator).
Environment (please complete the following information):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.