|
69 | 69 | (type (cl-getf result :type))) |
70 | 70 | (setq ocaml-eglot-type-enclosing-current-type type) |
71 | 71 | (setq ocaml-eglot-type-enclosing-verbosity nil) |
72 | | - (ocaml-eglot-type-enclosing--display type))) |
| 72 | + (ocaml-eglot-type-enclosing--display type t))) |
73 | 73 |
|
74 | 74 | (defun ocaml-eglot-type-enclosing-increase-verbosity () |
75 | 75 | "Increase the verbosity of the current request." |
|
115 | 115 | (read-only-mode 1) |
116 | 116 | (setq default-directory curr-dir)))) |
117 | 117 |
|
118 | | -(defun ocaml-eglot-type-enclosing--display (type-expr) |
119 | | - "Display the type-enclosing for TYPE-EXPR in a dedicated buffer." |
120 | | - (let ((current-enclosing (aref ocaml-eglot-type-enclosing-types |
121 | | - ocaml-eglot-type-enclosing-offset))) |
122 | | - (ocaml-eglot-type-enclosing--type-buffer type-expr) |
123 | | - (if (ocaml-eglot-util--text-less-than type-expr 8) |
124 | | - (message "%s" (with-current-buffer ocaml-eglot-type-buffer-name |
125 | | - (font-lock-fontify-region (point-min) (point-max)) |
126 | | - (buffer-string))) |
127 | | - (display-buffer ocaml-eglot-type-buffer-name)) |
128 | | - (ocaml-eglot-util--highlight-range current-enclosing |
129 | | - 'ocaml-eglot-highlight-region-face))) |
| 118 | +(defun ocaml-eglot-type-enclosing--display (type-expr &optional current-enclosing) |
| 119 | + "Display the type-enclosing for TYPE-EXPR in a dedicated buffer. |
| 120 | +If CURRENT-ENCLOSING is set, the range of the enclosing will be highlighted." |
| 121 | + (ocaml-eglot-type-enclosing--type-buffer type-expr) |
| 122 | + (if (ocaml-eglot-util--text-less-than type-expr 8) |
| 123 | + (message "%s" (with-current-buffer ocaml-eglot-type-buffer-name |
| 124 | + (font-lock-fontify-region (point-min) (point-max)) |
| 125 | + (buffer-string))) |
| 126 | + (display-buffer ocaml-eglot-type-buffer-name)) |
| 127 | + (when current-enclosing |
| 128 | + (let ((current-enclosing (aref ocaml-eglot-type-enclosing-types |
| 129 | + ocaml-eglot-type-enclosing-offset))) |
| 130 | + (ocaml-eglot-util--highlight-range current-enclosing |
| 131 | + 'ocaml-eglot-highlight-region-face)))) |
130 | 132 |
|
131 | 133 | (defun ocaml-eglot-type-enclosing--reset () |
132 | 134 | "Reset local variables defined by the enclosing query." |
|
147 | 149 | (setq ocaml-eglot-type-enclosing-offset index) |
148 | 150 | (setq ocaml-eglot-type-enclosing-types enclosings) |
149 | 151 | (setq ocaml-eglot-type-enclosing-current-type type) |
150 | | - (ocaml-eglot-type-enclosing--display type) |
| 152 | + (ocaml-eglot-type-enclosing--display type t) |
151 | 153 | (set-transient-map ocaml-eglot-type-enclosing-map t |
152 | 154 | 'ocaml-eglot-type-enclosing--reset))) |
153 | 155 |
|
|
0 commit comments