Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add pwsh support for zip decompression, zls wrong bin path #4569

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.org
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
longer generated. *This is a breaking change.* (See #4430.)
* If asm-lsp is installed, lsp-asm won't try to download it to cache store
* Fix lsp-unzip on windows when unzip was found on the PATH
* Fix zls wrong bin path

** 9.0.0
* Add language server config for QML (Qt Modeling Language) using qmlls.
Expand Down
2 changes: 1 addition & 1 deletion clients/lsp-zig.el
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ If `true', replace the text after the cursor."
This is differ from the variable `lsp-zig-zls-executable'; this is local storage
and not the global storage."
(f-join lsp-zig-server-store-path
(pcase system-type ('windows-nt "bin/zls.exe") (_ "bin/zls"))))
(pcase system-type ('windows-nt "zls.exe") (_ "zls"))))

(lsp-dependency
'zls
Expand Down
13 changes: 10 additions & 3 deletions lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -8450,7 +8450,11 @@ archive (e.g. when the archive has multiple files)"

;; unzip

(defconst lsp-ext-pwsh-script "powershell -noprofile -noninteractive \
(defconst lsp-ext-pwsh-script "pwsh -noprofile -noninteractive \
-nologo -ex bypass -c Expand-Archive -Path '%s' -DestinationPath '%s'"
"Pwsh script to unzip file.")

(defconst lsp-ext-powershell-script "powershell -noprofile -noninteractive \
-nologo -ex bypass -command Expand-Archive -path '%s' -dest '%s'"
"Powershell script to unzip file.")

Expand All @@ -8459,10 +8463,13 @@ archive (e.g. when the archive has multiple files)"

(defcustom lsp-unzip-script (lambda ()
(cond ((and (eq system-type 'windows-nt)
(executable-find "powershell"))
(executable-find "pwsh"))
jcs090218 marked this conversation as resolved.
Show resolved Hide resolved
lsp-ext-pwsh-script)
((and (eq system-type 'windows-nt)
(executable-find "powershell"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for powershell 5 @jcs090218

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this! I guess line 8472 is no longer needed? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this! I guess line 8472 is no longer needed? 🤔

Sorry, I forgot to modify line 8472. Powershell 5 only supports windows. This line should use pwsh.

Copy link
Contributor Author

@jinzhongjia jinzhongjia Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I resquashed and the problem was fixed
The current logic is that:
if you are on the windows platform, the priority of decompressing the zip is pwsh->powershell->unzip(bash)->pwsh(Do we still need to skip this step through the detection platform?)
other platform: unzip(bash)->pwsh

lsp-ext-powershell-script)
((executable-find "unzip") lsp-ext-unzip-script)
((executable-find "powershell") lsp-ext-pwsh-script)
((executable-find "pwsh") lsp-ext-pwsh-script)
(t nil)))
"The script to unzip."
:group 'lsp-mode
Expand Down
Loading