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

Feat/get latest GitHub release #705

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion dap-codelldb.el
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
(require 'dap-mode)
(require 'dap-utils)

(defcustom dap-codelldb-extension-version "1.7.4"
(defcustom dap-codelldb-extension-version "1.8.1"
"The version of the codelldb vscode extension."
:group 'dap-codelldb
:type 'string)
Expand Down
2 changes: 1 addition & 1 deletion dap-cpptools.el
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
:type 'string)

(defcustom dap-cpptools-extension-version
(let ((current-ver "1.11.5")
(let ((current-ver "1.13.8")
(installed-ver (dap-utils-vscode-get-installed-extension-version dap-cpptools-debug-path)))
(when (and installed-ver (version< installed-ver current-ver))
(warn "You have an old cpptools v%s. Please run `C-u 1 M-x dap-cpptools-setup' \
Expand Down
2 changes: 1 addition & 1 deletion dap-gdb-lldb.el
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
(require 'dap-mode)
(require 'dap-utils)

(defcustom dap-gdb-lldb-extension-version "0.26.0"
(defcustom dap-gdb-lldb-extension-version "0.26.1"
"The version of the gdb-lldb vscode extension."
:group 'dap-gdb-lldb
:type 'string)
Expand Down
15 changes: 13 additions & 2 deletions dap-utils.el
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,25 @@ PATH is the download destination dir."
(f-join dap-utils-extension-path "openvsx" (concat publisher "." name)))))
(dap-utils--get-extension url dest)))

(defun dap-utils-get-github-extension (owner repo version &optional path)
(defun dap-utils-get-github-extension (owner repo &optional version path)
"Get extension from github named OWNER/REPO with VERSION.
PATH is the download destination path."
(let* ((url (format dap-utils-github-extension-url owner repo version))
(let* ((version (or version (dap-utils-get-github-extension-latest-version owner repo)))
(url (format dap-utils-github-extension-url owner repo version))
(dest (or path
(f-join dap-utils-extension-path "github" (concat owner "." repo)))))
(dap-utils--get-extension url dest)))

(defun dap-utils-get-github-extension-latest-version (owner repo)
Copy link
Member

Choose a reason for hiding this comment

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

Will recommend to add documentation for all functions.

(let ((latest
(with-temp-buffer
(url-insert-file-contents
(format
"https://api.github.com/repos/%s/%s/releases/latest"
owner repo))
(json-parse-buffer :object-type 'plist))))
(car (last (split-string (plist-get latest :html_url) "/")))))

(defun dap-utils-vscode-get-installed-extension-version (path)
"Check the version of the vscode extension installed in PATH.
Returns nil if the extension is not installed."
Expand Down