Powershell_es is so perfect rn

This commit is contained in:
2026-08-31 11:28:41 +02:00
parent 5b0b6f32c5
commit f4ad52f1b1
4 changed files with 538 additions and 498 deletions
@@ -0,0 +1,29 @@
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
+20 -9
View File
@@ -27,7 +27,6 @@ require("mason-lspconfig").setup {
"lua_ls", "lua_ls",
"qmlls", "qmlls",
"rust_analyzer", "rust_analyzer",
"powershell_es",
}, },
handlers = { handlers = {
function(server_name) -- default handler (optional) function(server_name) -- default handler (optional)
@@ -50,13 +49,6 @@ require("mason-lspconfig").setup {
} }
end, end,
["powershell_es"] = function()
local lspconfig = require "lspconfig"
lspconfig.powershell_es.setup {
capabilities = capabilities,
}
end,
["rust_analyzer"] = function() ["rust_analyzer"] = function()
local lspconfig = require "lspconfig" local lspconfig = require "lspconfig"
lspconfig.rust_analyzer.setup { lspconfig.rust_analyzer.setup {
@@ -263,6 +255,25 @@ lspconfig("jsonls", {
}, },
}) })
lspconfig("powershell_es", {
settings = {
powershell = {
codeFormatting = {
preset = "Custom",
openBraceOnSameLine = true,
newLineAfterOpenBrace = false,
newLineAfterCloseBrace = true,
whitespaceBeforeOpenBrace = true,
whitespaceBeforeOpenParen = true,
whitespaceAroundOperator = true,
whitespaceAfterSeparator = true,
ignoreOneLineBlock = true,
pipelineIndentationStyle = "NoIndentation",
},
},
},
})
lspconfig("yamlls", { lspconfig("yamlls", {
settings = { settings = {
yaml = { yaml = {
@@ -285,7 +296,7 @@ local servers = {
"sourcekit", "sourcekit",
"qmlls", "qmlls",
"tailwindcss", "tailwindcss",
-- "systemd-lsp", "systemd-lsp",
require("mason-lspconfig").get_installed_servers(), require("mason-lspconfig").get_installed_servers(),
} }