Open ghost opened 9 years ago
I don't think this should be handled by Tuareg. We have partial support for features really close to that (like outline), it shouldn't be much work to integrate that to some future version.
@thranur, I'm working on a very similar feature that I currently just call jump. You can have a look at my jump branch. Basically, it introduces a command (right now works only in vim) called :MerlinJump
. You can give it an argument like fun,let,match,module
(default) or subset like match,module
. It'll then jump to the ancestor node that is of this type.
If you have some additional ideas, please share.
If you are still interested, there is a proof of concept for this feature. It is not yet working properly because of some assumptions made in the AST breaking the qualified path, but this shouldn't be too hard to fix.
Though, it won't make it to next release.
@neojski , sorry I didn't have much time lately to try things, especially because I don't use Vim.
@def-lkb, I'm still interested, though I'm not sure about the easiest way to try it (I believe I should use the command-line ocamlmerlin
for that, no? There's no binding yet for Emacs, right?). I'll see if I find instructions on how to use it to be able to test the proof of concept.
@thranur no binding yet, feature is not finished. I will tell you when proof of concept is ready for test.
@thranur, the jump feature is not vim specific. It works in emacs as well.
I couldn't find this feature in merlin, so I'm suggesting and asking if it would be feasible:
I'd like to have a command/indicator that tells me in which function/module the cursor is.
It often happens that when reading code inside a function and/or module that is several buffers long (in the middle of which I arrived e.g. by grepping a certain word), I have to scroll up to identify in which exact function I am, and then scroll down again. And if there is just one empty line between two functions, I may miss it and think I'm inside another function.
I know that the notion of "function name" is not as well defined in OCaml as in imperative languages, but all I'd like to know is the topmost
let
and/ormodule
I'm inside of.Is there already something like this?
If not, would it be relatively simple to implement? Or perhaps this is syntactic enough that could/should be handled by Tuareg?