Skip to content

Commit e45776d

Browse files
authored
chore: Compatible to latest github-tags (#34)
1 parent 1ae99b4 commit e45776d

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

lsp-ltex.el

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ This must be a positive integer."
221221

222222
(defcustom lsp-ltex-completion-enabled nil ;; TODO: Add proper implementation
223223
"If this this is enabled, auto-completion list for the current word is sent.
224-
The editor need to send a completion request.")
224+
The editor need to send a completion request."
225+
:type 'boolean
226+
:group 'lsp-ltex)
225227

226228
(defcustom lsp-ltex-diagnostic-severity "information"
227229
"Severity of the diagnostics corresponding to the grammar and spelling errors."
@@ -259,8 +261,6 @@ The editor need to send a completion request.")
259261
;; (@* "Externals" )
260262
;;
261263

262-
(defvar github-tags-names)
263-
264264
(declare-function github-tags "ext:github-tags.el")
265265

266266
;;
@@ -386,15 +386,17 @@ This is use to active language server and check if language server's existence."
386386

387387
(defun lsp-ltex--latest-version ()
388388
"Return the latest version from remote repository."
389-
(when (and (featurep 'github-tags) (ignore-errors (github-tags lsp-ltex-repo-path)))
390-
(let ((index 0) version ver)
391-
;; Loop through tag name and fine the stable version
392-
(while (and (not version) (< index (length github-tags-names)))
393-
(setq ver (nth index github-tags-names)
394-
index (1+ index))
395-
(when (string-match-p "^[0-9.]+$" ver) ; stable version are only with numbers and dot
396-
(setq version ver)))
397-
version)))
389+
(when (featurep 'github-tags)
390+
(when-let ((response (ignore-errors (github-tags lsp-ltex-repo-path))))
391+
(let ((names (plist-get (cdr response) :names))
392+
(index 0) version ver)
393+
;; Loop through tag name and fine the stable version
394+
(while (and (not version) (< index (length names)))
395+
(setq ver (nth index names)
396+
index (1+ index))
397+
(when (string-match-p "^[0-9.]+$" ver) ; stable version are only with numbers and dot
398+
(setq version ver)))
399+
version))))
398400

399401
(defun lsp-ltex--lsp-dependency ()
400402
"Register LSP dependency once."

0 commit comments

Comments
 (0)