Closed TheLeoP closed 8 months ago
You know, I think maybe it's getting stuck loading your profile on Windows? Because I see this line:
2023-10-20 11:54:05.097 -05:00 [DBG] Loading profiles...
but never the accompanying line:
_logger.LogDebug("Profiles loaded!");
which means it never finishes initializing (and therefore doesn't answer the request).
@andyleejordan
I'm new to powershell, so sorry for my lack of knowledge. I guess that using the parameter -NoProfile
has no effect on this, right? Do you have any idea about why it would be stuck loading my profiles? Or how I could test this without my profiles to check if that's the problem?
Because, on the issue I linked (this one) people are having the same problem on Windows when everything works fine on Linux.
That's right. I would try setting enableProfileLoading
to false
in the initialization options you're setting the server up with. -NoProfile
is parsed by the pwsh
executable, which is in essence just the host program that runs the LSP server, and that server has its own logic to enable (or disable) profile loading. Users on Linux don't usually have anything in any of the multiple profile paths that are checked, but often do on Windows because some of them are shared.
@andyleejordan confirming that this is the same issue I was having on #2048. Removing my profile, the LSP starts and works as expected. However, I'm not sure how I go about setting the value of enableProfileLoading
.
It seems that neovim's LSP doesn't implement it. Is there a way I can pass it in as a parameter to Start-EditorServices
? Or some other config file?
@andyleejordan Thaaaaaaaaaaaaaanks, that was it.
@scottmckendry You only need to do the following:
require("lspconfig").powershell_es.setup {
bundle_path = "path/to/your/bundle_path",
init_options = {
enableProfileLoading = false,
},
}
Glad to help and happy it's working for you! I'm sorry the setup for PSES for Vim/Emacs etc. is not the greatest. It's been on our docket to simplify and clean up for a long time but I keep getting pulled into other work.
Prerequisites
Steps to reproduce
I'm using Neovim as my editor, so I'm using the minimal reproduction of this issue (but using the
Diagnostic
log level for powershellEditorServices).a.ps1
initiliaze
request. There is more info on the logs)If the same things are done on linux, everything works as expected.
Expected behavior
Actual behavior
Error details
No response
Environment data
Version
3.13
Visuals
Powershell logs on Linux (everything works fine here): pwsh_linux.log
Neovim LSP logs on Linux (everything works fine here): neovim_linux.log
Powershell logs on Windows (it looks like the server takes too long loading some libraries and then cancels the initialize request): pwsh_windows.log
Neovim logs on Windows (there is never a response for the
initialize
requets) neovim_windows.log