PowerShell / PowerShell/PowerShellEditorServices
pwsh-ls error on emacs (with fix)
@andyleejordan 已经在做这个了。
开始于 2021年7月28日。
- 主要语言
- C#
- 星标
- 767
- 派生
- 266
- 平均合并
- 3 天 16 小时
- 30 天内合并 PR
- 1
描述
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;
- install the lsp-mode package
- open a .ps1 powershell script file, emacs will prompt to install the pwsh-ls language server
- pwsh-ls::stderr reports error message provided at start of this issue
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!

贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
评估
这个 Issue 还没有评估数据。