Title: Improve authoring experience for Format.ps1xml and Types.ps1xml files · Issue #7749 · PowerShell/PowerShell · GitHub
Open Graph Title: Improve authoring experience for Format.ps1xml and Types.ps1xml files · Issue #7749 · PowerShell/PowerShell
X Title: Improve authoring experience for Format.ps1xml and Types.ps1xml files · Issue #7749 · PowerShell/PowerShell
Description: The Format.ps1xml and Types.ps1xml system in PowerShell is incredibly powerful. It's awesome how we can output objects, then totally separate from that define how these should be displayed in similar ways to how UIs are declared in XAML ...
Open Graph Description: The Format.ps1xml and Types.ps1xml system in PowerShell is incredibly powerful. It's awesome how we can output objects, then totally separate from that define how these should be displayed in simil...
X Description: The Format.ps1xml and Types.ps1xml system in PowerShell is incredibly powerful. It's awesome how we can output objects, then totally separate from that define how these should be displayed in s...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/7749
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Improve authoring experience for Format.ps1xml and Types.ps1xml files","articleBody":"The Format.ps1xml and Types.ps1xml system in PowerShell is incredibly powerful. It's awesome how we can output objects, then totally separate from that define how these should be displayed in similar ways to how UIs are declared in XAML or JSX. Some really cool things are possible with it:\r\n\r\n[](https://github.com/sourcegraph/PSSourcegraph)\r\n\r\n[](https://github.com/felixfbecker/PowerGit)\r\n\r\nHowever, authoring these files is incredibly frustrating. There is no autocompletion, hovers or validation for these files in your editor. The [reference documentation](https://docs.microsoft.com/en-us/powershell/developer/format/format-schema-xml-reference) is incredibly hard to find, browse and search (a bunch of duplicate `element Foo for Bar for Baz for Quz (Format)`. [Error messages are often very confusing](https://github.com/PowerShell/PowerShell/issues/6788).\r\n\r\nThe way this could be improved a _lot_ would be with an XSD for these files, which would allow validation, hovers and autocompletion. I started working on this:\r\n\r\n\r\n\r\nThis is with the [vscode-xml](https://github.com/redhat-developer/vscode-xml) extension.\r\nSchemas are here: https://github.com/felixfbecker/PowerShellXSD\r\n\r\nI currently just autogenerated this schema from the Format file in that repo.\r\n\r\nI will investigate writing a script that parses the official schema markdown reference [here](https://github.com/PowerShell/PowerShell-Docs/blob/staging/developer/format/format-schema-xml-reference.md) and converts it into an XSD (probably with manual edits afterwards).\r\n\r\nI couldn't find reference docs for Types.ps1xml files unfortunately, but they also seem simpler.\r\n\r\nWhat's in the way of using this is that any attribute declaration on the root `Configuration` element will cause an error:\r\n```\r\nUpdate-FormatData : Errors occurred while loading the format data file:\r\nFormat.ps1xml, Error at XPath in file Format.ps1xml: The XML element Configuration does not allow attributes.\r\n```\r\nWhich means the schema instance attributes need to be removed again before loading the Format file. It would be great if PowerShell could instead just ignore attributes on the root element:\r\n```xml\r\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n\u003cConfiguration xsi:noNamespaceSchemaLocation=\"https://raw.githubusercontent.com/felixfbecker/PowerShellXSD/master/Format.xsd\"\r\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n```\r\n\r\nAnother unfortunate thing to mention is that schema validation won't work if you want to use ANSI color codes in Format files because of https://github.com/PowerShell/PowerShell/issues/7526\r\n\r\nI am posting this here in case someone wants to help out and because it would be great if eventually these schemas would be versioned in the PowerShell repo and hosted by Microsoft.","author":{"url":"https://github.com/felixfbecker","@type":"Person","name":"felixfbecker"},"datePublished":"2018-09-10T12:49:35Z","url":"https://github.com/PowerShell/PowerShell/issues/7749"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:02a60dd5-3bd6-2916-bc21-8786de436033 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B99C:3DE870:2B1239F:3BFBDA9:6AFD5AB4 |
| html-safe-nonce | a1716cf2ef626294d465960bd85b4819f9b6f346e9b3473159796376b2f108cb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTlDOjNERTg3MDoyQjEyMzlGOjNCRkJEQTk6NkFGRDVBQjQiLCJ2aXNpdG9yX2lkIjoiODg4NDU4NjI2ODE3Njc2NzY2OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 05656a225597b22025a62f9e929c30393ad38e813b6b04e3cf04b74b7cdbbd22 |
| hovercard-subject-tag | issue:358607847 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/7749/issue_layout |
| twitter:image | https://opengraph.githubassets.com/03dcf8f11c9d17043640cd493b89cee7d8e3cfb3bc38bf14f45d16989f699e0c/PowerShell/PowerShell/issues/7749 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/03dcf8f11c9d17043640cd493b89cee7d8e3cfb3bc38bf14f45d16989f699e0c/PowerShell/PowerShell/issues/7749 |
| og:image:alt | The Format.ps1xml and Types.ps1xml system in PowerShell is incredibly powerful. It's awesome how we can output objects, then totally separate from that define how these should be displayed in simil... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | felixfbecker |
| hostname | github.com |
| expected-hostname | github.com |
| None | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width