Skip to content

Commit 1671b5d

Browse files
committed
OCaml: Remove previous function that allowed to retrieve only the signature
This function was useful because textDocument/hover returned the type and documentation of the identifier at point making it hard to kill the type only Now that ocamllsp/typeEnclosing is used instead there is no reason to keep this poorly written function (I was young and innocent)
1 parent ecb6c8d commit 1671b5d

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

clients/lsp-ocaml.el

-46
Original file line numberDiff line numberDiff line change
@@ -104,52 +104,6 @@
104104
:group 'lsp-ocaml-server
105105
:type 'boolean)
106106

107-
(cl-defmethod lsp-clients-extract-signature-on-hover (contents (_server-id (eql ocaml-lsp-server)) &optional storable)
108-
"Extract a representative line from OCaml's CONTENTS, to show in the echo area.
109-
This function splits the content between the signature
110-
and the documentation to display the signature
111-
and truncate it if it's too wide.
112-
The STORABLE argument is used if you want to use this
113-
function to get the type and, for example, kill and yank it.
114-
115-
An example of function using STORABLE is:
116-
117-
(defun mdrp/lsp-get-type-and-kill ()
118-
(interactive)
119-
(let ((contents (-some->> (lsp--text-document-position-params)
120-
(lsp--make-request \"textDocument/hover\")
121-
(lsp--send-request)
122-
(lsp:hover-contents))))
123-
(let ((contents (and contents
124-
(lsp--render-on-hover-content
125-
contents
126-
t))))
127-
(let ((contents
128-
(pcase (lsp-workspaces)
129-
(`(,workspace)
130-
(lsp-clients-extract-signature-on-hover
131-
contents
132-
(lsp--workspace-server-id workspace)
133-
t))
134-
(lsp-clients-extract-signature-on-hover
135-
contents
136-
nil)
137-
)))
138-
(message \"Copied %s to kill-ring\" contents)
139-
(kill-new contents)))))"
140-
(let ((type (s-trim (lsp--render-element (lsp-make-marked-string
141-
:language "ocaml"
142-
:value (car (s-split "---" (lsp--render-element contents))))))))
143-
(if (equal nil storable)
144-
(if (eq lsp-cut-signature 'cut)
145-
(car (s-lines type))
146-
;; else lsp-cut-signature is 'space
147-
(let ((ntype (s-replace "\n" " " type)))
148-
(if (>= (length ntype) (frame-width))
149-
(concat (substring ntype 0 (- (frame-width) 4)) "...")
150-
ntype)))
151-
type)))
152-
153107
;;; -------------------
154108
;;; OCaml-lsp faces
155109
;;; -------------------

0 commit comments

Comments
 (0)