Closed scottmckendry closed 8 months ago
How are you setting up "IntelliSense" aka completion requests in NeoVim? The only "snippets" that should exist in the realm of using just PSES are from PSSA, which comment-help is, so at least the analysis service (PSSA) is working.
I suppose that's where I'm stuck. I've checked the default config and nothing immediately stands out to me that says "this will enable code-completion".
I've not run into this problem when installing other LSPs (yet) so I was hoping to get some advice from someone who has had success with this in the past.
I think you need to set it up then...from the lspconfig
readme:
Manual, triggered completion is provided by Nvim's builtin omnifunc. For autocompletion, a general purpose autocompletion plugin is required.
For nvimp-cmp
it looks like it must be explicitly setup to use LSP completions, the readme has an example:
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' }, -- For vsnip users.
-- { name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}
My best guess...the default configuration you're loading from https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/powershell_es.lua probably needs to be revised to advertise completion capabilities, I sort of found an example of that in https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/clangd.lua.
That's what I'm doing in my config (I think). I pull in the default capabilities from the NVChad lsp config with this line:
local capabilities = require("plugins.configs.lspconfig").capabilities
Which should look something like this:
M.capabilities = vim.lsp.protocol.make_client_capabilities()
M.capabilities.textDocument.completion.completionItem = {
documentationFormat = { "markdown", "plaintext" },
snippetSupport = true,
preselectSupport = true,
insertReplaceSupport = true,
labelDetailsSupport = true,
deprecatedSupport = true,
commitCharactersSupport = true,
tagSupport = { valueSet = { 1 } },
resolveSupport = {
properties = {
"documentation",
"detail",
"additionalTextEdits",
},
},
}
I've had success with this method using go and bicep LSPs but PowerShell eludes me...
I think you're missing this part:
completionItemKind?: {
/**
* The completion item kind values the client supports. When this
* property exists the client also guarantees that it will
* handle values outside its set gracefully and falls back
* to a default value when unknown.
*
* If this property is not present the client only supports
* the completion items kinds from `Text` to `Reference` as defined in
* the initial version of the protocol.
*/
valueSet?: [CompletionItemKind](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItemKind)[];
};
Thanks, unfortunately, no luck getting this going on my end. I've also raised this as an issue on the nvim-lsp repo: https://github.com/neovim/nvim-lspconfig/issues/2747
I did come across a log file generated by PSES with this line:
2023-08-05 21:35:20.494 +12:00 [WRN] Tried to send request or notification before initialization was completed and will be sent later {"Id":1,"Error":{"Code":-32800,"Data":null,"Message":"Request Cancelled","$type":"ErrorMessage"},"Method":"initialize","$type":"RequestCancelled"}
Not sure if this helps at all.
Hm, the thing that reminds me of is https://github.com/OmniSharp/csharp-language-server-protocol/issues/588
That was a bug in our LSP library because the spec is very confusing about the ordering of the initialize and initialized requests. Might be worth looking into for nvim-lspconfig, but could also be a red herring.
same issue, any updates?
same issue, any updates?
No progress on Windows 11. However, PSES on Linux is working. Tested in Ubuntu 22.04 (WSL) and Arch running essentially identical neovim configurations.
The language server starts on Windows, but doesn't attach to the active buffer. Every other LSP-compatible language I've tried on Windows works fine, but PSES does not.
I also tried turning on verbose logging to see if I could see anything that might be useful. No errors or warnings. Also I'm no longer able to replicate the error in my previous comment. Seems like to LSP implementation just isn't Windows-friendly.
Hm, are there over LSP plugins for Vim that could be tried?
I can confirm that coc-powershell works on Windows. But it's not as good as the native nvim lsp.
I'm not the first person to run into this issue.
@andyleejordan @ogios I've opened a new issue in the nvim-lspconfig repo. If you have anything you can add that the maintainers might find helpful that would be appreciated 👍🏻
Prerequisites
Steps to reproduce
Using PowerShell Editor Services in neovim with the following LSPConfig:
As part of troubleshooting, I set the cmd to include my profile which had this line:
However, still no modules in Intellisense.
Expected behavior
Actual behavior
Error details
No response
Environment data
Version
3.8.7 - Mason Registry
Visuals
Example of missing IntelliSense
Output of :LspInfo