Files

30 lines
1005 B
VimL

function! neoformat#formatters#powershell#enabled() abort
return ['pwshfmt']
endfunction
function! neoformat#formatters#powershell#pwshfmt() abort
"if has('win32') || has('win64')
" let l:args = [
" \ '-NoProfile',
" \ '-Command',
" \ 'Import-Module PSScriptAnalyzer; Invoke-Formatter -ScriptDefinition (\$input | Out-String)',
" \ ]
"else
" let l:args = [
" \ '-NoProfile',
" \ '-Command',
" \ '"Import-Module (Resolve-Path \"/opt/powershell-editor-services/PSScriptAnalyzer/*/PSScriptAnalyzer.psd1\" | Select-Object -ExpandProperty Path); Invoke-Formatter -ScriptDefinition (\$input | Out-String)"'
" \ ]
"endif
"
return {
\ 'exe': 'pwsh',
\ 'args': [
\ '-NoProfile',
\ '-Command',
\ 'Import-Module PSScriptAnalyzer; Invoke-Formatter -ScriptDefinition ($input | Out-String)'
\ ],
\ 'stdin': 1,
\ }
endfunction