Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ unreleased
- Remove `C-c C-c` for `ocaml-eglot-error-prev`, clash with usual `compile` ([#67](https://github.com/tarides/ocaml-eglot/pull/67))
- Rewrite `find/locate` function in term of `xref` ([#73](https://github.com/tarides/ocaml-eglot/pull/73))
- Rewrite `phrase/type-expression` using dedicated custom request instead of tunneling ([#77](https://github.com/tarides/ocaml-eglot/pull/77))
- Remove blocking highlighting for `type-enclosing` ([#83](https://github.com/tarides/ocaml-eglot/pull/83))

ocaml-eglot 1.2.0
======================
Expand Down
10 changes: 4 additions & 6 deletions ocaml-eglot-util.el
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
(require 'json)
(require 'eglot)
(require 'cl-lib)
(defvar pulse-flag)

;; Generic util

Expand Down Expand Up @@ -226,13 +227,10 @@ current window otherwise."

(defun ocaml-eglot-util--highlight-range (range face)
"Highlight a given RANGE using a given FACE."
(remove-overlays nil nil 'ocaml-eglot-highlight 'highlight)
(let* ((beg (eglot--lsp-position-to-point (cl-getf range :start)))
(let ((beg (eglot--lsp-position-to-point (cl-getf range :start)))
(end (eglot--lsp-position-to-point (cl-getf range :end)))
(overlay (make-overlay beg end)))
(overlay-put overlay 'face face)
(overlay-put overlay 'ocaml-eglot-highlight 'highlight)
(unwind-protect (sit-for 60) (delete-overlay overlay))))
(pulse-flag nil))
(pulse-momentary-highlight-region beg end face)))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it would be nice if we bound pulse-flag to nil here, so that it will be highlighted until the next command. This makes using grow/shrink easier.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks. Done in b609988


(defun ocaml-eglot-util--as-json (str)
"Parse a string STR as a Json object."
Expand Down