Open rmunderwood opened 3 years ago
I'm not familiar with pwsh-ls, but I'd be interested to know where this configuration is coming from. The Start-EditorServices.ps1 script we currently ship doesn't offer a -File
parameter and is really just a proxy for the Start-EditorServices
cmdlet exported by the PowerShellEditorServices module.
So I believe the path it's using is correct (it should have two PowerShellEditorServices folders, the outer folder contains several modules such as PSScriptAnalyzer, but also the PowerShellEditorServices module itself). I tested the download command in lsp-mode
by hand, and it seems like it would extract the zip properly. What's strange is that your screenshot shows that all the other modules are missing. Try downloading the zip from here, extract it, and take a look to see what I mean.
So I believe the path it's using is correct (it should have two PowerShellEditorServices folders, the outer folder contains several modules such as PSScriptAnalyzer, but also the PowerShellEditorServices module itself). I tested the download command in
lsp-mode
by hand, and it seems like it would extract the zip properly. What's strange is that your screenshot shows that all the other modules are missing. Try downloading the zip from here, extract it, and take a look to see what I mean.
I decided to uninstall the pwsh-ls and re-install to show you exactly what I mean, emacs prompts to install the language server
"c:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe" "-noprofile" "-noninteractive" "-nologo" "-ex" "bypass" "-command" "Invoke-WebRequest" "-UseBasicParsing" "-uri" "https://github.com/PowerShell/PowerShellEditorServices/releases/latest/download/PowerShellEditorServices.zip" "-outfile" "c:/Users/Ryan/AppData/Local/Temp/extteTVRX.zip" ";" "Expand-Archive" "-Path" "c:/Users/Ryan/AppData/Local/Temp/extteTVRX.zip" "-DestinationPath" "c:/Users/Ryan/AppData/Roaming/.emacs.d/.cache/lsp/pwsh/"
As you can see, the url it's getting the ZIP from is exactly the one you linked, though in my c:/Users/Ryan/AppData/Roaming/.emacs.d/.cache/lsp/pwsh/" there is only one PowerShellEditorServices subdirectory as originally shown in this screenshot
which is all very confusing to me as to why the other directory and modules are not there
Oh dear, looks like I may have been quite silly - why I didn't think to check the pwsh directory itself I'm not sure but everything seems to be in the /pwsh/ directory, though the arguments for lsp are expecting /PowerShellEditorServices/PowerShellEditorServices/ and not /pwsh/PowerShellEditorServices/ , I think that could be the issue
Ok, I installed Emacs on my machine and have (to be honest) really missed it, so I will try to get lsp-mode
fixed. I think its variables for directory paths need to be double-checked.
Hey @rmunderwood is this still reproing for you? I got PSES to work with the Emacs package eglot
and it's even incorporated as an end-to-end test, so theoretically lsp-mode
should work too.
I noticed an error when trying to use pwsh-ls with emacs for editing powershell scripts. I get this error on the pwsh-ls::stderr buffer: Process pwsh-ls stderr finished The argument 'c:/Users/Ryan/AppData/Roaming/.emacs.d/.cache/lsp/pwsh/PowerShellEditorServices/PowerShellEditorServices/Start-EditorServices.ps1' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the -File parameter.
It looked strange that the directory argument after /pwsh/ is /PowerShellEditorServices/PowerShellEditorServices/ and this is where the issue is, as there is not actually another directory named "PowerShellEditorServices" inside the first when I check my own folder as installed from the language server, as shown in this image below.
I am not entirely sure if this is just a one off issue or something wrong with my install, but I freshly installed windows today and emacs, so I may assume it could be persistent issue, clearly if it is then the solution is to change the argument applied to not have two subdirectories of /PowerShellEditorServices/ because clearly it doesn't exist.
The steps to reproduce this is to;
Steps to fix: (until this is patched if it's a persistent isssue)
Create another folder in "C:\Users\USER\AppData\Roaming.emacs.d.cache\lsp\pwsh\PowerShellEditorServices" with the name PowerShellEditorServices
Copy every thing into the deeper directory so it looks like this:
Restart emacs and the language server should be somewhat working..
If you are getting errors like below in your lsp-log buffer then you need to install PSScriptAnalyzer at https://github.com/PowerShell/PSScriptAnalyzer after that everything should be working smoothly!