File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -98,14 +98,25 @@ PATH is the download destination dir."
9898 (f-join dap-utils-extension-path " openvsx" (concat publisher " ." name)))))
9999 (dap-utils--get-extension url dest)))
100100
101- (defun dap-utils-get-github-extension (owner repo version &optional path )
101+ (defun dap-utils-get-github-extension (owner repo &optional version path )
102102 " Get extension from github named OWNER/REPO with VERSION.
103103PATH is the download destination path."
104- (let* ((url (format dap-utils-github-extension-url owner repo version))
104+ (let* ((version (or version (dap-utils-get-github-extension-latest-version owner repo)))
105+ (url (format dap-utils-github-extension-url owner repo version))
105106 (dest (or path
106107 (f-join dap-utils-extension-path " github" (concat owner " ." repo)))))
107108 (dap-utils--get-extension url dest)))
108109
110+ (defun dap-utils-get-github-extension-latest-version (owner repo )
111+ (let ((latest
112+ (with-temp-buffer
113+ (url-insert-file-contents
114+ (format
115+ " https://api.github.com/repos/%s/%s/releases/latest"
116+ owner repo))
117+ (json-parse-buffer :object-type 'plist ))))
118+ (car (last (split-string (plist-get latest :html_url ) " /" )))))
119+
109120(defun dap-utils-vscode-get-installed-extension-version (path )
110121 " Check the version of the vscode extension installed in PATH.
111122Returns nil if the extension is not installed."
You can’t perform that action at this time.
0 commit comments