[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/idris-mode edc2f60c75 7/7: Merge pull request #547 from oh
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/idris-mode edc2f60c75 7/7: Merge pull request #547 from ohad/ide-messages |
Date: |
Wed, 5 Jan 2022 05:58:10 -0500 (EST) |
branch: elpa/idris-mode
commit edc2f60c75dd55744a00a1365e2015113f7ee903
Merge: 7d834ebbf8 8b6f76da89
Author: Jan de Muijnck-Hughes <jfdm@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
Merge pull request #547 from ohad/ide-messages
Update semantic highlighting code in line with the update IDE protocol
---
idris-commands.el | 20 ++++++++++++++++----
idris-common-utils.el | 8 ++++++++
idris-highlight-input.el | 4 ++--
idris-warnings.el | 16 ++++++++++++----
inferior-idris.el | 5 ++---
5 files changed, 40 insertions(+), 13 deletions(-)
diff --git a/idris-commands.el b/idris-commands.el
index f7cb915f8a..00fb152590 100644
--- a/idris-commands.el
+++ b/idris-commands.el
@@ -229,15 +229,27 @@ A prefix argument forces loading but only up to the
current line."
for h in hs
do (pcase h
(`(((:filename ,fn)
- (:start ,start-line ,start-col)
- (:end ,end-line ,end-col))
+ (:start ,start-line-raw ,start-col-raw)
+ (:end ,end-line-raw ,end-col-raw))
,props)
(when (string= (file-name-nondirectory fn)
(file-name-nondirectory
(buffer-file-name)))
- (idris-highlight-input-region (current-buffer)
+ (let ((start-line (if (>=-protocol-version 2 1)
+ (+ 1 start-line-raw)
+ start-line-raw))
+ (start-col (if (>=-protocol-version 2 1)
+ (+ 1 start-col-raw)
+ start-col-raw))
+ (end-line (if (>=-protocol-version 2 1)
+ (+ 1 end-line-raw)
+ end-line-raw ))
+ (end-col (if (>= idris-protocol-version 2 1)
+ (+ 1 end-col-raw)
+ end-col-raw )))
+ (idris-highlight-input-region (current-buffer)
start-line start-col
end-line end-col
- props))))))
+ props)))))))
(_ (idris-make-clean)
(idris-update-options-cache)
diff --git a/idris-common-utils.el b/idris-common-utils.el
index d08b451acc..be9b8c4382 100644
--- a/idris-common-utils.el
+++ b/idris-common-utils.el
@@ -402,4 +402,12 @@ relative to SRC-DIR"
(when (file-exists-p lidr)
(make-link lidr))))))
+(defvar idris-protocol-version 0 "The protocol version")
+(defvar idris-protocol-version-minor 0 "The protocol minor version")
+
+(defun >=-protocol-version (major minor)
+ (or (> idris-protocol-version major)
+ (and (>= idris-protocol-version major)
+ (>= idris-protocol-version-minor minor))))
+
(provide 'idris-common-utils)
diff --git a/idris-highlight-input.el b/idris-highlight-input.el
index 56f46a624f..396ff202c5 100644
--- a/idris-highlight-input.el
+++ b/idris-highlight-input.el
@@ -60,14 +60,14 @@ See Info node `(elisp)Overlay Properties' to understand how
ARGS are used."
(widen)
(if (or (> end-line start-line)
(and (= end-line start-line)
- (>= end-col start-col)))
+ (> end-col start-col)))
(with-current-buffer buffer
(save-excursion
(goto-char (point-min))
(let* ((start-pos (+ (line-beginning-position start-line)
(idris-highlight-column start-col)))
(end-pos (+ (line-beginning-position end-line)
- (idris-highlight-column (+ 1 end-col))))
+ (idris-highlight-column end-col)))
(highlight-overlay (make-overlay start-pos end-pos
(get-buffer buffer))))
(overlay-put highlight-overlay 'idris-source-highlight t)
diff --git a/idris-warnings.el b/idris-warnings.el
index bec2ad1a53..927d6a9cc8 100644
--- a/idris-warnings.el
+++ b/idris-warnings.el
@@ -81,10 +81,18 @@ WARNING is of form (filename (startline startcolumn)
(endline endcolumn) message
As of 20140807 (Idris 0.9.14.1-git:abee538) (endline endcolumn) is mostly the
same as (startline startcolumn)
"
(cl-destructuring-bind (filename sl1 sl2 message spans) warning
- (let ((startline (nth 0 sl1))
- (startcol (1- (nth 1 sl1)))
- (endline (nth 0 sl2))
- (endcol (1- (nth 1 sl2))))
+ (let ((startline (if (>=-protocol-version 2 1)
+ (1+ (nth 0 sl1))
+ (nth 0 sl1)))
+ (startcol (if (>=-protocol-version 2 1)
+ (nth 1 sl1)
+ (1- (nth 1 sl1))))
+ (endline (if (>=-protocol-version 2 1)
+ (1+ (nth 0 sl2))
+ (nth 0 sl2)))
+ (endcol (if (>=-protocol-version 2 1)
+ (nth 1 sl2)
+ (1- (nth 1 sl2)))))
(push (list filename startline startcol message spans)
idris-raw-warnings)
(let* ((fullpath (concat (file-name-as-directory
idris-process-current-working-directory)
filename))
diff --git a/inferior-idris.el b/inferior-idris.el
index ac818c2eee..7f73923fc6 100644
--- a/inferior-idris.el
+++ b/inferior-idris.el
@@ -66,12 +66,11 @@
(defvar idris-connection nil
"The Idris connection.")
-(defvar idris-protocol-version 0 "The protocol version")
-
(defun idris-version-hook-function (event)
(pcase event
- (`(:protocol-version ,version ,_target)
+ (`(:protocol-version ,version ,minor)
(setf idris-protocol-version version)
+ (setf idris-protocol-version-minor minor)
(remove-hook 'idris-event-hooks 'idris-version-hook-function)
t)))
- [nongnu] elpa/idris-mode updated (2e4b5c6a97 -> edc2f60c75), ELPA Syncer, 2022/01/05
- [nongnu] elpa/idris-mode e3d1266db6 2/7: Fix more 'bounds' to spec in newer IDE protocols, ELPA Syncer, 2022/01/05
- [nongnu] elpa/idris-mode 8b6f76da89 6/7: Merge remote-tracking branch 'origin/main' into ide-messages, ELPA Syncer, 2022/01/05
- [nongnu] elpa/idris-mode d9aa6cb9d5 4/7: [ CI ] When refreshing package contexts need to intialise in batch mode., ELPA Syncer, 2022/01/05
- [nongnu] elpa/idris-mode 7d834ebbf8 5/7: Merge pull request #548 from jfdm/fix-emacs-testing, ELPA Syncer, 2022/01/05
- [nongnu] elpa/idris-mode 8d69b70432 1/7: Update semantic highlighting code in line with the update IDE protocol, ELPA Syncer, 2022/01/05
- [nongnu] elpa/idris-mode edc2f60c75 7/7: Merge pull request #547 from ohad/ide-messages,
ELPA Syncer <=
- [nongnu] elpa/idris-mode fce35c4349 3/7: Move idris-protocol-version vars and access function to common-utils, ELPA Syncer, 2022/01/05