aerial.nvim icon indicating copy to clipboard operation
aerial.nvim copied to clipboard

feature request: Treesitter Ocaml support

Open arutonee1 opened this issue 4 months ago • 0 comments

Language: OCaml

(Mostly) minimal file example:

let inc = (+) 1
let inc' x = x + 1
let rec
  is_even = function
  | 0 -> true
  | n -> is_odd (n-1)
and
  is_odd = function
  | 0 -> false
  | n -> is_even (n-1)

type ml = OCaml | StandardML
type my_number = PlusInfinity | MinusInfinity | Real of float

type animal =
   {
      name: string;
      color: string;
      legs: int;
   }

let main () =
  let x = 10 in x + 2

module Hi : sig
  val hi : unit -> unit
end = struct
  let hi () = ()
end

class point =
  object
    val mutable x = 0
    method get_x = x
    method move d = x <- x + d
  end

Here is an example query set that works afaict, but I'm not familiar enough with the codebase to confidently make tests and implement it.

(compilation_unit
  (value_definition
    (let_binding
      pattern: (value_name) @name
      (#set! "kind" "Function")) @symbol))

(module_binding
  body: (structure
          (value_definition
            (let_binding
              pattern: (value_name) @name
              (#set! "kind" "Function")) @symbol)))

(type_binding
  name: (type_constructor) @name
  (#set! "kind" "Interface")) @symbol

(module_binding
  (module_name) @name
  (#set! "kind" "Module")) @symbol

(value_specification
  (value_name) @name
  (#set! "kind" "Interface")) @symbol

(class_binding
  (class_name) @name
  (#set! "kind" "Class")) @symbol

(method_definition
  (method_name) @name
  (#set! "kind" "Method")) @symbol

arutonee1 avatar Aug 16 '25 16:08 arutonee1