Reference
Monaco Tooling and Language Service
Look up syntax, contracts, layouts, algorithms, and exact behavior.
The Monaco integration turns the compiler into an interactive language workbench. The editor registers an OJaml language ID, language configuration, Monarch tokenizer, dark and light themes, completion provider, hover provider, signature help provider, and diagnostic marker producer.
hover(offset) | +-- parse + check succeeds? | | | +-- checked token covers offset -> show inferred detail | | | +-- otherwise -> lexical fallback | +-- parse/check fails -> lexical fallback
let main =
let names = Map.set (Map.empty ()) "ada" 1815 in
Map.get names "ada"
hover Map.get:
Map.get : (string, int) map -> string -> intDiagnostics call parse and check on the current source. On OJamlError, the provider translates byte offsets to Monaco line/column ranges. Completion items include keywords, snippets, top-level symbols, module members, and standard-library functions. Module-qualified autocomplete is context-aware: after Array., Float., List., Map., Set., String., or a user-defined module prefix, it offers value and constructor members from that namespace rather than inserting a second module prefix.
Hover data is checker-first and lexical-second. If the program parses and type checks, the hover provider uses checked token metadata so identifiers and builtin calls show inferred or instantiated types. If no checked token applies, lexical fallback still describes keywords, literals, operators, delimiters, declaration separators, and unknown identifiers.
- Completion details come from the same stdlib signature table used by the checker.
- Signature help currently focuses on print and println because they accept int, float, or string.
- Token-level checked hovers cover locals, params, top-level declarations, literals, and builtin calls.
- Lexical hovers identify non-typed tokens as keyword, operator, delimiter, separator, literal, or identifier.