feat: Add comprehensive OCaml language support with ocaml-lsp-server integration (#573)

This commit is contained in:
John Haley authored and GitHub committed 2026-03-04 21:56:49 +01:00
1 parent 2c901b0a0e
commit 13e20c1cbd
19 files changed
+899 -5

No files matched your search

@@ -0,0 +1,4 @@
(executable
(public_name test_repo)
(name main)
(libraries test_repo))
@@ -0,0 +1,9 @@
open Test_repo
let n = 20
let () =
let res = fib n in
Printf.printf "fib(%d) = %d\n" n res;
let greeting = DemoModule.someFunction "Hello" in
Printf.printf "%s\n" greeting
@@ -0,0 +1,26 @@
(lang dune 3.18)
(name test_repo)
(generate_opam_files true)
(source
(github username/reponame))
(authors "Author Name <author@example.com>")
(maintainers "Maintainer Name <maintainer@example.com>")
(license LICENSE)
(documentation https://url/to/documentation)
(package
(name test_repo)
(synopsis "A short synopsis")
(description "A longer description")
(depends ocaml)
(tags
("add topics" "to describe" your project)))
; See the complete stanza docs at https://dune.readthedocs.io/en/stable/reference/dune-project/index.html
@@ -0,0 +1,3 @@
(library
(public_name test_repo)
(name test_repo))
@@ -0,0 +1,12 @@
module DemoModule = struct
type value = string
let someFunction s =
s ^ " More String"
end
let rec fib n =
if n < 2 then 1
else fib (n-1) + fib (n-2)
let num_domains = 2
@@ -0,0 +1,7 @@
module DemoModule : sig
type value = string
val someFunction : string -> string
end
val fib : int -> int
val num_domains : int
@@ -0,0 +1,3 @@
(test
(name test_test_repo)
(libraries test_repo))
@@ -0,0 +1,18 @@
open Test_repo
let test_fib () =
assert (fib 0 = 1);
assert (fib 1 = 1);
assert (fib 2 = 2);
assert (fib 5 = 8);
Printf.printf "fib tests passed\n"
let test_demo_module () =
let result = DemoModule.someFunction "Test" in
assert (result = "Test More String");
Printf.printf "DemoModule tests passed\n"
let () =
test_fib ();
test_demo_module ();
Printf.printf "All tests passed!\n"
@@ -0,0 +1,32 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "A short synopsis"
description: "A longer description"
maintainer: ["Maintainer Name <maintainer@example.com>"]
authors: ["Author Name <author@example.com>"]
license: "LICENSE"
tags: ["add topics" "to describe" "your" "project"]
homepage: "https://github.com/username/reponame"
doc: "https://url/to/documentation"
bug-reports: "https://github.com/username/reponame/issues"
depends: [
"dune" {>= "3.18"}
"ocaml"
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/username/reponame.git"
x-maintenance-intent: ["(latest)"]