-
Notifications
You must be signed in to change notification settings - Fork 32
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
PowerLine 3.4.0 fails to read a config that worked with 3.3.0 #66
Comments
This is a module load order problem, it'll probably never happen again after that first time when you loaded things after updating. The issue is that You could fix it by reimporting Pansies ( I've thought of an enhanced way of registering these serializers so that Metadata could rediscover all the ones in modules that are already imported when it's reimported later, rather than loosing them... I've also thought about having Metadata store the serializer list in the global scope so it would survive module reloads... |
I have the same problem as @TBBle. Mind you, though, that I have a fresh install of PowerLine, and I have only a single instance of Removing the |
Same here
The modules are there only once, downloaded yesterday.
|
So, I'll explain how this works, in hopes y'all can help figure this out.
if(Get-Command Add-MetadataConverter -ErrorAction Ignore) {
Add-MetadataConverter @{
RgbColor = { [PoshCode.Pansies.RgbColor]$args[0] }
[PoshCode.Pansies.RgbColor] = { "RgbColor '$_'" }
}
} The situation that TBBle had was due to PANSIES somehow finding the I'm reasonably sure you could resolve the problem in a given PowerShell session by:
But I'm not sure what's going wrong in your specific session. Normally this only happens if PANSIES can't find the Metadata command, so the serialization doesn't get registered, or if the Configuration module gets forcibly re-imported and looses it's memory of the registered serialization metadata.. I suppose that perhaps, since I'm also thinking about whether there's a way that I could improve the way the registration works so it can survive having the Configuration module reimported -- or even be permanent... |
I was still seeing the problem with only Configuration 1.5.0 installed, so I don't think that it was that PANSIES was picking up My suspicion (although I haven't looked in a while) was that something in PowerLine was reloading the Metadata module after PANSIES called I don't know enough PowerShell to know if there's a useful per-session storage where this would make sense, or if indeed it should be persisted between sessions such that importing Metadata is sufficient to re-establish the converters. |
I'm not sure if this is related or not, but PoshCode/Metadata#3 was a bug in Metadata related to the serialization of objects, which is now fixed in Metadata 1.5.3 I have an idea about how to "permanently" register serializations -- based on what I did in EzTheme, but I'm not sure if that's really the root cause. Fwiw, I'm using:
And that's working on PS 5.1 and PS 7.2 However, I might have just re-set my config at some point, and I don't have the old export. If any of you are still stuck, can you dump your Configuration.psd1 and share it? This should work to copy the contents: Get-Module PowerLine | Get-ConfigurationPath | ls | Get-Content | Set-Clipboard They're sometimes hard to read in a non-powerline font: @{
ExtendedCharacters = @{
Branch = ''
ColorSeparator = ''
Gear = '⛯'
Lock = ''
Power = '⚡'
ReverseColorSeparator = ''
ReverseSeparator = ''
Separator = ''
}
EscapeSequences = @{
Clear = '[0m'
Esc = '['
Recall = '[u'
Store = '[s'
}
PowerLineConfig = @{
PowerLineCharacters = @{
ColorSeparator = ''
Separator = ''
ReverseSeparator = ''
ReverseColorSeparator = ''
}
PowerLineFont = $True
DefaultAddIndex = -1
Title = (ScriptBlock '')
Colors = @((RgbColor '#36648B'),(RgbColor '#1874CD'),(RgbColor '#00B2EE'),(RgbColor '#7EC0EE'),(RgbColor '#5CACEE'),(RgbColor '#B0E2FF'))
SetCurrentDirectory = $True
Prompt = @((ScriptBlock ' $MyInvocation.HistoryId '),(ScriptBlock ' "&Gear;" * $NestedPromptLevel '),(ScriptBlock ' $pwd.Drive.Name '),(ScriptBlock ' Split-Path $pwd -leaf '),(ScriptBlock ' "`t" '),(ScriptBlock ' Get-Elapsed -Trim '),(ScriptBlock ' Get-Date -Format "T" '))
PSReadLinePromptText = @('[48;2;102;102;102m[92m♥[38;2;242;242;242m PS[38;2;102;102;102m[49m[0m','[48;2;102;102;102m[38;2;255;99;71m♥[38;2;242;242;242m PS[38;2;102;102;102m[49m[0m')
FullColor = $True
}
} |
My current config dump: @{
PowerLineConfig = @{
PowerLineFont = $True
SetCurrentDirectory = $True
DefaultAddIndex = 2
RestoreVirtualTerminal = $True
FullColor = $True
Prompt = @((ScriptBlock ' New-PromptText { "&OSC;9;9;"+$executionContext.SessionState.Path.CurrentLocation+"&ST;" + $executionContext.SessionState.Path.CurrentLocation } -ForegroundColor DarkYellow -BackgroundColor Black -ElevatedBackgroundColor Gray'),(ScriptBlock ' "`t" '),(ScriptBlock ' New-PromptText { Write-VcsStatus } -ForegroundColor DarkYellow -BackgroundColor Black -ElevatedBackgroundColor Gray'),(ScriptBlock ' "`n" '),(ScriptBlock ' New-PromptText { ">" * ($NestedPromptLevel + 1) } -ForegroundColor Blue -ElevatedForegroundColor Yellow -BackgroundColor Black -ElevatedBackgroundColor Gray'))
Colors = @((RgbColor 'Cyan'),(RgbColor 'DarkCyan'),(RgbColor 'Gray'),(RgbColor 'DarkGray'),(RgbColor 'Gray'))
}
EscapeSequences = @{
Esc = '�['
Store = '�[s'
Recall = '�[u'
Clear = '�[0m'
OSC = '�]'
ST = '�\'
}
ExtendedCharacters = @{
ColorSeparator = ''
ReverseColorSeparator = ''
Separator = ''
ReverseSeparator = ''
Branch = ''
Lock = ''
Gear = '⛯'
Power = '⚡'
}
} which is working with PowerShell 7.2.0:
Am I understanding correctly that the issue might have been fixed with Metadata 1.5.3, and you're looking for a test? I did a quick test, and it still fails in a new Windows Terminal instance with
The state when it failed:
|
I've upgraded PowerLine 3.3.0 to 3.4.0 (also forcing Configuration 1.5.0 installation per PoshCode/Configuration#45 (comment)) and PowerLine now fails, with the following error:
The
Configuration.ps1
in question:I can work around this by forcing the use of PowerLine 3.3.0 in my profile.ps1:
This is under PowerShell 7.1.4, installed as a .NET Global Tool.
The text was updated successfully, but these errors were encountered: