Add support for Types.ps1xml files
See original GitHub issueSystem Details
- Operating system name and version: Windows 10 Pro x64
- VS Code version: 1.16.0
- PowerShell extension version: 1.4.2
- Output from
$PSVersionTable
:Name Value ---- ----- PSVersion 5.1.15063.502 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.15063.502 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:
PS C:\> code -v
1.16.0
787b31c0474e6165390b5a5989c9619e3e16f953
PS C:\> $pseditor.EditorServicesVersion
Major Minor Build Revision
----- ----- ----- --------
1 4 1 0
PS C:\> code --list-extensions --show-versions
ms-vscode.PowerShell@1.4.2
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.15063.502
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.15063.502
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Issue Description
Currently, there’s no support for Types.ps1xml files - used for augmenting PoSH/CLR types through the Extended Type System. While the built-in XML language parser kind-of works, it only handles XML language folding/highlighting - any PowerShell types/scripts/etc. are treated as basic data.
Consider the basic Types.ps1xml file in my PSEWS module project. Some potential methods for improving the experience could entail:
- Schema validation (Someone wrote an XSD expressing the Types.ps1xml format, but I don’t know if VSCode supports XSDs yet)
- Auto-completion of type/method names, where available
- Support for PowerShell language parsing inside of elements containing PowerShell scripts (Script and Get/SetScriptBlock come to mind)
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
about Types.ps1xml - PowerShell - Microsoft Learn
The Types.ps1xml file in the PowerShell installation directory ( $PSHOME ) is an XML-based text file that lets you add properties and methods...
Read more >Improve authoring experience for Format.ps1xml and Types ...
Many years ago we produced xsd files for both format and types ps1xml, I've shared them here, and we should probably include them...
Read more >Formatting object output in PowerShell with Format.ps1xml files
The ETS gives the ability to add additional dynamic members to types and objects. The ETS area we're looking at in this article...
Read more >about_Types.ps1xml - Help and Support
LONG DESCRIPTION The Types.ps1xml file in the Windows PowerShell installation directory ($pshome) is an XML-based text file that lets you add properties and ......
Read more >Select-Xml - PowerShell Command - PDQ
The first command saves the path to the Types.ps1xml file in the $Path variable. ... Search PowerShell Help files: ... Diagnostics.dll-Help.xml Add-Computer ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Here’s also some docs from the vscode docs page.
@felixfbecker actually created PowerShellXSD, which allows ps1xml schema checking with the VSCode XML extension.
I believe that currently offers the best experience.
Adding that extra functionality to PSScriptAnalyzer may be straightforward in some scenarios (anyone wanting to investigate is welcome to look at some work I did a while ago on it), but some ps1xml analysis requires whole-module context, which PSScriptAnalyzer isn’t really built for.