You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
In merlin mode for emacs, there is a function to jump to enclosing fun, let, module or match, which is very convenient. I would love to have it in vscode too.
In addition, it could be nice to display somewhere those information (in which enclosing fun, let, module, match, the cursor currently is), maybe in the status bar.
Not present in the old protocol doc, but the command is available. I think it is something like ["jump", "fun let module match", "at", POSITION]
(defunmerlin/jump (&optionaltarget)
"Jump to the TARGET"
(let ((result (merlin/send-command
(list'jump (if (equal target "") "fun let module match" target)
'at (merlin/unmake-point (point))))))
(unless result
(error"Not found. (Check *Messages* for potential errors)"))
(unless (listp result)
(error result))
result))
C-c C-j runs the command merlin-jump, which is an interactive Lisp
function in `merlin.el'.
It is bound to C-c C-j.
(merlin-jump &optional TARGET)
Jump to enclosing fun, let, module or match.
Any combination of the above may be entered, separated by spaces, ex.:
fun let or module or module fun match
Empty string defaults to jumping to all these.
The text was updated successfully, but these errors were encountered:
I think it is possible to add this. I've experimented with a similar feature for Reason but I ended up not publishing it because there were reliability issues. I think the problems were specific to Merlin/Reason though so it would probably have been fine with plain OCaml.
As far as signifying where the cursor will jump to, we could probably do that too but I'm not sure that using the status bar for that is ideal. I'd rather try to have some sort of faint outline or similar decoration around the enclosing scope if possible. The problem with the status bar is that there's already a lot of contention with other extensions for space and stuff like that and the API for it just isn't all that flexible to begin with.
I'll take a look at getting something like this implemented in an upcoming release.
If this is implemented, is it possible to put it in the language server so that all the editors using the language server benefit from this or it has to be in this extension? I don't know if the language server protocol is "extensible" to support such additions.
It is possible to implement on the server using custom RPC messages. This would be available to all clients, but they would still need to have some minimal support code to send the command and respond to the result.
This is a feature request
In merlin mode for emacs, there is a function to jump to enclosing fun, let, module or match, which is very convenient. I would love to have it in vscode too.
In addition, it could be nice to display somewhere those information (in which enclosing fun, let, module, match, the cursor currently is), maybe in the status bar.
https://github.com/ocaml/merlin/blob/master/doc/dev/PROTOCOL.md#jump--target-string--position-position
Not present in the old protocol doc, but the command is available. I think it is something like
["jump", "fun let module match", "at", POSITION]
The text was updated successfully, but these errors were encountered: