update packages

This commit is contained in:
2025-06-22 17:08:08 +02:00
parent 54e5633369
commit 16a0a6db93
558 changed files with 68349 additions and 26568 deletions

View File

@@ -1,14 +1,10 @@
(define-package "powershell" "20240825.1440" "Mode for editing PowerShell scripts"
;; -*- no-byte-compile: t; lexical-binding: nil -*-
(define-package "powershell" "20250614.1529"
"Mode for editing PowerShell scripts."
'((emacs "24"))
:commit "38727f1cdaf0c937a62b68ee52ec7196b8149f93" :authors
'(("Frédéric Perrin" . "fredericperrinreselfr"))
:maintainers
'(("Frédéric Perrin" . "fredericperrinreselfr"))
:maintainer
'("Frédéric Perrin" . "fredericperrinreselfr")
:keywords
'("powershell" "languages")
:url "http://github.com/jschaf/powershell.el")
;; Local Variables:
;; no-byte-compile: t
;; End:
:url "http://github.com/jschaf/powershell.el"
:commit "99e0e73082fd48314a9825254dac45f318e5bb59"
:revdesc "99e0e73082fd"
:keywords '("powershell" "languages")
:authors '(("Frédéric Perrin" . "fredericperrinreselfr"))
:maintainers '(("Frédéric Perrin" . "fredericperrinreselfr")))

View File

@@ -6,7 +6,8 @@
;; Author: Frédéric Perrin <frederic (dot) perrin (arobas) resel (dot) fr>
;; URL: http://github.com/jschaf/powershell.el
;; Version: 0.3
;; Package-Version: 20250614.1529
;; Package-Revision: 99e0e73082fd
;; Package-Requires: ((emacs "24"))
;; Keywords: powershell, languages
@@ -118,6 +119,15 @@ Value is a list of strings, which may be nil."
:type '(repeat (string :tag "Argument"))
:group 'powershell)
(defcustom powershell-default-langserver-path
(expand-file-name ".cache/powershell/" user-emacs-directory)
"Default expression used to locate Powershell Languageserver.
If found, added to eglot. Supports environment-variables and glob-pattterns.
Changes may require an Emacs-restart to take effect."
:type 'string
:group 'powershell)
(defun powershell-continuation-line-p ()
"Return t is the current line is a continuation line.
The current line is a continued line when the previous line ends
@@ -781,7 +791,9 @@ that value is non-nil."
(powershell-setup-imenu)
(powershell-setup-speedbar)
(powershell-setup-menu)
(powershell-setup-eldoc))
(powershell-setup-eldoc)
(with-eval-after-load 'eglot
(powershell--register-langserver)))
;;; PowerShell inferior mode
@@ -1387,6 +1399,67 @@ This insures we get and display the prompt."
;; (insert " "))
;; success)))
(defun powershell--fetch-json-array (url)
"Fetch JSON from URL, parse as if array."
(with-temp-buffer (url-insert-file-contents url)
(json-parse-buffer :array-type 'list)))
(defun powershell--unzip-file (zip-file destination)
"Unzip ZIP-FILE into DESTINATION directory using the 'unzip' command."
(make-directory destination t) ;; Ensure the destination directory exists
(let ((exit-code (call-process "unzip" nil nil nil "-o" zip-file "-d" destination)))
(if (zerop exit-code)
(message "Successfully unzipped %s to %s" zip-file destination)
(error "Failed to unzip %s (exit code %d)" zip-file exit-code))))
(defun powershell--get-latest-release-version ()
(let* ((release-json (powershell--fetch-json-array "https://api.github.com/repos/PowerShell/PowerShellEditorServices/releases"))
(first (car release-json)) ;; assume first = latest
(version (gethash "tag_name" first)))
version))
(defun powershell--download-langserver ()
(let* ((download-dir (expand-file-name "dl" powershell-default-langserver-path))
(download-file (expand-file-name "powershell-langserver.zip" download-dir)))
(make-directory download-dir :parents)
(let* ((version (powershell--get-latest-release-version))
(url (format "https://github.com/PowerShell/PowerShellEditorServices/releases/download/%s/PowerShellEditorServices.zip" version)))
(url-copy-file url download-file 't)
(powershell--unzip-file download-file powershell-default-langserver-path)
(delete-directory download-dir t)
;; make our function respond with something more interesting than nil :)
(message (format "Powershell LangServer version %s downloaded and unpacked to \'%s\'" version powershell-default-langserver-path)))))
(defun powershell-install-langserver ()
"Downloads the lang-server and unpacks it in the default location."
(interactive)
(powershell--download-langserver)
(powershell--register-langserver))
(defun powershell--register-langserver ()
(defvar eglot-server-programs)
(let* ((langserver-path (powershell-langserver-file-name))
(langserver-exe (expand-file-name "PowerShellEditorServices/Start-EditorServices.ps1" langserver-path)))
(and (file-exists-p langserver-exe)
(add-to-list 'eglot-server-programs
`(powershell-mode . ("pwsh"
"-OutputFormat" "Text"
"-File"
,langserver-exe
"-Stdio"
"-HostVersion" "1.0"
"-HostName" "Emacs"
"-HostProfileId" "Emacs.Eglot"
"-SessionDetailsPath"
,(expand-file-name "eglot-powershell" temporary-file-directory)
"-BundledModulesPath"
,langserver-path))))))
(defun powershell-langserver-file-name ()
(car (file-expand-wildcards
(substitute-in-file-name powershell-default-langserver-path))))
(provide 'powershell)
;;; powershell.el ends here