PowerShell / Modules

MIT License
111 stars 25 forks source link

Add initial pretty printer prototype #64

Open rjmholt opened 4 years ago

JustinGrote commented 4 years ago

Nice! An AST-based formatter has been a long time coming.

My list of asks over what vscode-powershell currently does:

  1. Fix parameter casing and parameter shorthands
  2. Maybe downcompatible support as an option? e.g. if I use || and I'm set to 5.1 or 6 compatibility, convert it to an equivalent PS5.1 if/then.
  3. Shorthand .NET type references if an equivalent using namespace is present.
  4. Similar to 3, with a setting, enable "compressing" type references and sticking an equivalent using namespace at the top.
rjmholt commented 4 years ago

My list of asks over what vscode-powershell currently does:

After writing this tool, it's likely that this pretty printer won't suit those needs, because it prints purely based on the AST and will lose things the AST doesn't capture. Try this printer out on a long script with comments in it for example.

It might be better to register your requests in the PSSA repo, where the current formatter implementation lives. I don't think we'll be able to track them easily here