Skip to content

Commit c53d9a2

Browse files
committed
Some refactoring on type-enclosing verbosity
1 parent b4014eb commit c53d9a2

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

ocaml-eglot-type-enclosing.el

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,12 @@
8484
(defun ocaml-eglot-type-enclosing-decrease-verbosity ()
8585
"Decrease the verbosity of the current request."
8686
(interactive)
87-
(if ocaml-eglot-type-enclosing-verbosity
88-
(progn
89-
(setq ocaml-eglot-type-enclosing-verbosity
90-
(1- ocaml-eglot-type-enclosing-verbosity))
91-
(when (< ocaml-eglot-type-enclosing-verbosity 1)
92-
(setq ocaml-eglot-type-enclosing-verbosity nil)))
93-
(setq ocaml-eglot-type-enclosing-verbosity nil))
87+
(when (and ocaml-eglot-type-enclosing-verbosity
88+
(> ocaml-eglot-type-enclosing-verbosity 0))
89+
(setq ocaml-eglot-type-enclosing-verbosity
90+
(1- ocaml-eglot-type-enclosing-verbosity)))
9491
(ocaml-eglot-type-enclosing--with-fixed-offset))
9592

96-
9793
(defun ocaml-eglot-type-enclosing-grow ()
9894
"Growing of the type enclosing."
9995
(interactive)
@@ -127,19 +123,19 @@
127123
(read-only-mode 1)
128124
(setq default-directory curr-dir))))
129125

130-
(defun ocaml-eglot-type-enclosing--display (type-expr &optional current-enclosing)
126+
(defun ocaml-eglot-type-enclosing--display (type-expr &optional current)
131127
"Display the type-enclosing for TYPE-EXPR in a dedicated buffer.
132-
If CURRENT-ENCLOSING is set, the range of the enclosing will be highlighted."
128+
If CURRENT is set, the range of the enclosing will be highlighted."
133129
(ocaml-eglot-type-enclosing--type-buffer type-expr)
134130
(if (ocaml-eglot-util--text-less-than type-expr 8)
135131
(message "%s" (with-current-buffer ocaml-eglot-type-buffer-name
136132
(font-lock-fontify-region (point-min) (point-max))
137133
(buffer-string)))
138134
(display-buffer ocaml-eglot-type-buffer-name))
139-
(when (and current-enclosing (> (length ocaml-eglot-type-enclosing-types) 0))
140-
(let ((current-enclosing (aref ocaml-eglot-type-enclosing-types
135+
(when (and current (> (length ocaml-eglot-type-enclosing-types) 0))
136+
(let ((current (aref ocaml-eglot-type-enclosing-types
141137
ocaml-eglot-type-enclosing-offset)))
142-
(ocaml-eglot-util--highlight-range current-enclosing
138+
(ocaml-eglot-util--highlight-range current
143139
'ocaml-eglot-highlight-region-face))))
144140

145141
(defun ocaml-eglot-type-enclosing--reset ()

0 commit comments

Comments
 (0)