PowerShell / PowerShell/PowerShellEditorServices

pwsh-ls error on emacs (with fix)

オープン
#1,531 コメント 6 件 リアクション 0 件 担当者 1 名 GitHub で見る

@andyleejordan がすでに取り組んでいます。

2021年7月28日 から。

Issue-Bug
主要言語
C#
スター
767
フォーク
266
平均マージ
3日 16時間
マージ済み PR(30日)
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:
image
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.

image

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;

  1. install the lsp-mode package
  2. open a .ps1 powershell script file, emacs will prompt to install the pwsh-ls language server
  3. 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)

  1. Create another folder in "C:\Users\USER\AppData\Roaming.emacs.d.cache\lsp\pwsh\PowerShellEditorServices" with the name PowerShellEditorServices

  2. Copy every thing into the deeper directory so it looks like this:
    image

  3. Restart emacs and the language server should be somewhat working..
    image

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!
image

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。