Skip to content

Commit 508f6d5

Browse files
authored
Merge branch 'main' into add-mel-loglevels
2 parents 6d9c4ac + 6bb322e commit 508f6d5

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# PowerShell Editor Services Release History
22

3+
## Unreleased
4+
5+
- ✨ 📟 [PowerShellEditorServices #2239](https://github.com/PowerShell/PowerShellEditorServices/pull/2239) - Update PSReadLine to v2.4.2-beta2.
6+
37
## v4.3.0
48
### Tuesday, March 18, 2025
59

PowerShellEditorServices.build.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ namespace Microsoft.PowerShell.EditorServices.Hosting
120120

121121
task RestorePsesModules -If (-not (Test-Path "module/PSReadLine") -or -not (Test-Path "module/PSScriptAnalyzer")) {
122122
Write-Build DarkMagenta "Restoring bundled modules"
123+
# NOTE: When updating module versions, ensure they are also saved to the CFS feed
123124
Save-PSResource -Path module -Name PSScriptAnalyzer -Version "1.24.0" -Repository $PSRepository -TrustRepository -Verbose
124-
Save-PSResource -Path module -Name PSReadLine -Version "2.4.1-beta1" -Prerelease -Repository $PSRepository -TrustRepository -Verbose
125+
Save-PSResource -Path module -Name PSReadLine -Version "2.4.2-beta2" -Prerelease -Repository $PSRepository -TrustRepository -Verbose
125126
}
126127

127128
Task Build FindDotNet, CreateBuildInfo, RestorePsesModules, {

docs/guide/getting_started.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Once the basic language configurations have been installed, add this to your
6161
```lua
6262
local on_attach = function(client, bufnr)
6363
-- 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 })
6565

6666
local bufopts = { noremap = true, silent = true, buffer = bufnr }
6767
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
@@ -101,6 +101,15 @@ lua << EOF
101101
EOF
102102
```
103103

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+
104113
#### Configure Additional Settings
105114
To further configure the server, you can supply settings to the setup table.
106115
For example, you can set the code formatting preset to one true brace style
@@ -112,6 +121,8 @@ require('lspconfig')['powershell_es'].setup {
112121
settings = { powershell = { codeFormatting = { Preset = 'OTBS' } } }
113122
}
114123
```
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)
115126

116127
You can also set the bundled PSScriptAnalyzer's custom rule path like so:
117128
```lua
@@ -122,3 +133,34 @@ require('lspconfig')['powershell_es'].setup {
122133
settings = { powershell = { scriptAnalysis = { settingsPath = custom_settings_path } } }
123134
}
124135
```
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

Comments
 (0)