@@ -61,7 +61,7 @@ Once the basic language configurations have been installed, add this to your
61
61
``` lua
62
62
local on_attach = function (client , bufnr )
63
63
-- Enable completion triggered by <c-x><c-o>
64
- vim .api .nvim_buf_set_option ( bufnr , ' omnifunc' , ' v:lua.vim.lsp.omnifunc' )
64
+ vim .api .nvim_set_option_value ( " omnifunc" , " v:lua.vim.lsp.omnifunc" , { buf = bufnr } )
65
65
66
66
local bufopts = { noremap = true , silent = true , buffer = bufnr }
67
67
vim .keymap .set (' n' , ' <C-k>' , vim .lsp .buf .signature_help , bufopts )
@@ -101,6 +101,15 @@ lua << EOF
101
101
EOF
102
102
```
103
103
104
+ #### Theme Troubleshooting
105
+ If you find that your colorscheme appears correctly for a second and then
106
+ changes to not having full highlighting, you'll need to disable semantic
107
+ highlighting.
108
+ Add this line to the ` on_attach ` function.
109
+ ``` lua
110
+ client .server_capabilities .semanticTokensProvider = nil
111
+ ```
112
+
104
113
#### Configure Additional Settings
105
114
To further configure the server, you can supply settings to the setup table.
106
115
For example, you can set the code formatting preset to one true brace style
@@ -112,6 +121,8 @@ require('lspconfig')['powershell_es'].setup {
112
121
settings = { powershell = { codeFormatting = { Preset = ' OTBS' } } }
113
122
}
114
123
```
124
+ For a more complete list of options have a look at this schema:
125
+ [ nvim-lsp-installer powershell_es reference] ( https://github.com/williamboman/nvim-lsp-installer/blob/main/lua/nvim-lsp-installer/_generated/schemas/powershell_es.lua )
115
126
116
127
You can also set the bundled PSScriptAnalyzer's custom rule path like so:
117
128
``` lua
@@ -122,3 +133,34 @@ require('lspconfig')['powershell_es'].setup {
122
133
settings = { powershell = { scriptAnalysis = { settingsPath = custom_settings_path } } }
123
134
}
124
135
```
136
+
137
+ #### Autocomplete Brackets Troubleshooting
138
+ If you're using ` blink.cmp ` and you're getting brackets when autocompleting
139
+ cmdlet names, you'll need to add ` { "ps1", "psm1" } ` to the blocked filetypes
140
+ for both ` kind_resolution ` and ` semantic_token_resolution ` in the plugin's
141
+ config file.
142
+
143
+ [ Blink.cmp completion reference] ( https://cmp.saghen.dev/configuration/reference#completion-accept )
144
+
145
+ ### Indentation
146
+
147
+ Vim/Neovim does not contain default ` :h indentexpr ` for filetype ` ps1 ` .
148
+ So you might notice indentation on newline is not behaving as expected for powershell files.
149
+ Luckily powershell has similar syntax like C, so we can use ` :h cindent ` to fix the indentation problem.
150
+ You can use the following snippet to either callback of an autocmd or ftplugin.
151
+
152
+ ``` lua
153
+ --- ./nvim/lua/ftplugin/ps1.lua
154
+
155
+ -- disable indent from powershell treesitter parser
156
+ -- because the parse isn't mature currently
157
+ -- you can ignore this step if don't use treesitter
158
+ if pcall (require , ' nvim-treesitter' ) then
159
+ vim .schedule (function () vim .cmd ([[ TSBufDisable indent]] ) end )
160
+ end
161
+
162
+ vim .opt_local .cindent = true
163
+ vim .opt_local .cinoptions :append { ' J1' , ' (1s' , ' +0' } -- see :h cino-J, cino-(, cino-+
164
+
165
+ vim .opt_local .iskeyword :remove { ' -' } -- OPTIONALLY consider Verb-Noun as a whole word
166
+ ```
0 commit comments