Terminal-Icons
Terminal-Icons copied to clipboard
Import-Module Terminal-Icons breaks application of custom Format.ps1xml files (when loaded in VsCode)
When I load Import-Module Terminal-Icons
during my profile, and then load my custom module that contains Format.ps1xml
files that are loaded via the Modules PSD1, they do not appear
Expected Behavior
Custom Format files to be applied when custom module is imported after Terminal-Icons
Current Behavior
No custom Format files seem to apply
Possible Solution
unknown, current workaround: not loading Terminal-Icons
Steps to Reproduce (for bugs)
- Import-Module Terminal-Icons
- Import any Module with Formats
- Run a command that would use one of the formats
Context
This has cost my afternoon/evening yesterday and let me to dream of code, not an unpleasant dreams, but Formats where merging into dynamic parameters, so you could class it as a nightmare?
Your Environment
- Module version used: 0.11.0
- Operating System and PowerShell version:
Name Value
---- -----
PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
NOTE: I admit, during writing of this issue, I have realized I only tested this in VsCode... it seems, the issue is with the VsCode terminal, as it works normally in Windows Terminal Still wanted to bring it to your attention, if not useful, please close.
Yeah, I think the main solution is to build your own format file and Update-FormatData -PrependPath
after you Import-Module
.
Examples are here.
https://github.com/devblackops/Terminal-Icons/pull/10
Could it be that this code hiyacks the cursor and left me unable to use normal keys? I suddenly coudn't use ')' anymore and than things got even wurse...
So I uninstalled everything...
Terminal-Icons
overloads the [FileSystemInfo]
class format. If another module overloads it again using Update-FormatData -PrependPath
then you would lose the Terminal-Icons
format.
The issue with your cursor or key bindings is a different thing completely. It could be related to your terminal application or maybe install-module PSReadline
.
I'd recommend you launch pwsh
with the -noprofile
flag and then run the repro with the secondary module to produce the issue. Then we can look at it. I've never seen this issue that you are describing and I think something else is going on. I have my own format-override and it works great.
P.S. I would also check all the $PROFILE
files with $PROFILE | Format-List * -Force
.
P.P.S. I'm now seeing you had issues with VS Code. You can try disabling this feature. Additionally, you can see weird issues with modules depending on how you launch code
and what your $env:PSModulePath
looks like. VSCode uses its own set of modules. See the issue below.
https://github.com/PowerShell/vscode-powershell/issues/3886
Hello, very interesting stuff. I think you may have just solved another problem I have had in VsCode... My PowerShell terminal just randomly froze after typing a single character (and I had eyed PSreadline and my custom key handlers for this one, but alas, I think the Terminal integration is to blame here...)
I will monitor this to see if that addresses this issue here as well, been a while since I played with formatting stuff