merlin icon indicating copy to clipboard operation
merlin copied to clipboard

Binding operators don't work in occurrences and locate

Open mattiase opened this issue 3 years ago • 3 comments

Binding operators (let*, and+ etc) don't work in merlin-occurrences or merlin-locate, for various reasons:

  • Uses of the operators as such (ie, not the function syntax as in (let*)) aren't found at all
  • Reconstructing the identifier from a location doesn't work (the lexer used doesn't seem to know about the syntax)

I have an addendum to PR #1385 that parses these operators for Emacs Xref but it doesn't work without help from the merlin machinery.

Issue #949 seems to be related.

mattiase avatar Nov 02 '21 21:11 mattiase

PR #1405 almost fixes this. It's still not possible to run Occurrence from the use of a non-bracketed binding operator, and I'm not sure how to fix that – guidance from someone who knows the code would be useful.

mattiase avatar Nov 17 '21 17:11 mattiase

(from a conversation with @voodoos)

As an extra piece of info (that might be another issue), typeof has trouble with expressions that use and+ (though a single let+ seems fine).

Consider this piece of code:

let+ a = ea
and+ b = eb in
()

When I'm on a or b and asking for the type, the whole let+.... expression gets highlighted and I get the type for the full one (unit t).

I suspect this is because Refis laws are a bit weird with these operators, so the query does not detect I'm asking about the binders in a (ghost?) Pexp_fun expression.

emillon avatar Nov 15 '22 11:11 emillon

As an extra piece of info (that might be another issue), typeof has trouble with expressions that use and+ (though a single let+ seems fine).

Fixed in #1653

Occurrences and locate should be fixed when we'll roll out the project-wide occurrences.

voodoos avatar Jul 27 '23 16:07 voodoos