ocaml / tuareg

Emacs OCaml mode
GNU General Public License v3.0
360 stars 79 forks source link

OCaml keywords as extension names confuses indentation #225

Open jtoman opened 4 years ago

jtoman commented 4 years ago

If the name of an extension node is an OCaml keyword, the indentation mode gets extremely confused. I have observed this in at least two scenarios. Once when trying to add a monadic do block as in:

begin%do
 ...
end

In another example, using the ppxlib.metaquot functionality and the type extension deeply confuses Tuareg, e.g.

match x with
| [%type: int] -> ...
Chris00 commented 4 years ago

I understand for the first (and it is not related to the fact that it is %do) but the second is indented as

let _ =
  match x with
  | [%type: int] -> x
  | u -> v

which looks fine to me.

jtoman commented 4 years ago

Interesting, in my version of Tuareg, I get the following indentation:

let x =
  match x with
  | [%type: int] -> assert false
               | u -> u

According to Emacs, I'm using the most recent version available from Melpa, would something have changed since the last reason to explain this?