Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>OceletNew to Visual Studio Code? Get it now.
Ocelet

Ocelet

Cirad Tetis

| (0) | Free
Ocelet spatial modelling language (.oclt): highlighting, language server and model runs
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Ocelet for VS Code

Support for the Ocelet modelling language (.oclt files):

  • syntax and semantic highlighting (variables, parameters, attributes, methods, model and library types);
  • errors and warnings as you type;
  • content assist (Ctrl+Space), go to definition (F12), hovers, document symbols (Ctrl+Shift+O);
  • running models with the VS Code Run button.

An Ocelet project is a folder containing an oclt/ subfolder; the model name is read from the .project file next to it (otherwise, the folder name is used). Do not delete .project: the model name gives the Java package (fr.ocelet.model.<name>), so without it a model whose folder was renamed (or whose code uses qualified names such as fr.ocelet.model.arbocarto.Action) shows "cannot be resolved" errors. A project without .project gets a warning in the Problems panel and when it is run; creating or deleting a .project restarts the language server.

Projects created by the Ocelet Modelling Platform also have a .classpath (pointing to the OMP's old jars): the Java extension (Red Hat) imports them as Eclipse projects, shows errors everywhere in src/ and writes into the same bin/ folder ("ENOTEMPTY" when a model is run). The generated Java is compiled by the Ocelet extension, so disable the Java extension for these folders only: Extensions (Ctrl+Shift+X)

Language Support for Java > Disable (Workspace). When a folder contains only Ocelet projects with a .classpath, the Ocelet extension suggests it.

Creating a project

Right-click a folder in the Explorer > Nouveau projet Ocelet... (or click the project icon in the Explorer's title bar, next to "New Folder", to create it at the root of the opened folder), then type the project name. A subfolder with that name is created, with the same layout as the Ocelet Modelling Platform: oclt/<Name>.oclt (a minimal scenario, opened in the editor), config/gradients.ocg, data/, output/, src/, bin/ and a .project file. Spaces become _ and the first letter is capitalized; the name must be a valid Java identifier (it becomes the model's class name).

Running a model

Open a .oclt file of the model, then click the ▷ button at the top right of the editor (or Ctrl+F5, or F5 with the "Ocelet : lancer le modèle" configuration). From the Explorer: right-click the project folder (or its oclt/ folder, or a .oclt file) > Ocelet : lancer le modèle; this entry only appears on Ocelet projects (folders containing oclt/*.oclt). The extension:

  1. generates the Java code from the .oclt files into the project's src/ folder;
  2. compiles it into bin/ (a JDK 21 is required);
  3. runs the model from the project folder (paths such as data/, output/… are relative to it).

While a file of the model is open, the language server generates the Java itself each time a .oclt file is saved without errors (only that file, in about a second), and records it in src/.ocelet-generated. Once every .oclt file of the model is generated, the server also compiles the Java in the background into bin/ (about a second, 3 s for the first compilation after VS Code starts; a JDK is required), and records it in bin/.ocelet-compiled: steps 1 and 2 are then skipped and the model starts at once (0.4 s instead of 14 for LandCraft). If you run the model while the server is still compiling, the run waits for it. A file modified but not saved, or with errors, is not generated by the server: steps 1 and 2 then run as usual and show the errors. While a model runs (.ocelet-running in the project folder), the server does not replace its bin/ folder.

Steps 1 and 2 are skipped when no .oclt file has changed since the last successful build (a fingerprint is kept in bin/.ocelet-build); the Ocelet : tout regénérer et lancer le modèle command (or "force": true in launch.json) regenerates and recompiles everything anyway. After each generation, the Debug Console shows the time spent in each step and the slowest files.

The output is shown in the Debug Console; the ■ button stops the model. JVM options for the model are set with ocelet.model.vmargs (default -XX:MaxRAMPercentage=50: up to half of the computer's memory; -Xmx8g for a fixed amount). In launch.json:

{ "type": "ocelet", "request": "launch", "name": "Ocelet : lancer le modèle", "project": "${file}" }

Optional attributes: mainClass, vmArgs, args (model parameters), generate (false to skip Java generation), force (true to regenerate even if nothing changed).

Command line

The extension installs an ocelet command in ~/.ocelet/bin (ocelet.cmd and, for Git Bash, Linux and macOS, ocelet), added to the PATH of VS Code terminals. It runs with the Node.js embedded in VS Code: nothing else to install. It is meant for terminals, scripts and coding assistants (Claude Code…), which can check their changes to a model by themselves:

ocelet check            # validates the .oclt files, without generating Java (fast)
ocelet build            # generates the Java and compiles it
ocelet run -- <args>    # generates, compiles and runs the model
ocelet help             # all options (--force, --main, --vm)

The project is the folder containing oclt/: by default the one of the current folder, or given as an argument (a project folder or a .oclt file). Messages on .oclt files have the usual compiler format, oclt/X.oclt:line:column: error|warning|info: message. Exit code: 0 success, 1 errors in the .oclt files, 2 Java compilation errors, 3 the model stopped with an error, 4 installation or usage problem. Java is found like the extension does (the ocelet.java.home setting is passed on); OCELET_JAVA_HOME chooses another one.

Restricted Mode (folder not trusted)

When VS Code asks whether you trust the authors of the opened folder and you answer no, it opens it in Restricted Mode. Ocelet then only keeps what displays files: syntax highlighting, Windows-1252 encoding of .oclt files, icons, project creation. The language server (errors, content assist) and running models, which execute Java, stay disabled, and a message says so; they start as soon as the folder is trusted (Ctrl+Shift+P > "Workspaces: Manage Workspace Trust", or the "Restricted Mode" indicator in the status bar).

Requirement: Java 21

Ocelet needs an installed Java 21 or later (preferably a JDK, for instance Liberica JDK 21 Full). The language server, the generator and the models run with it. Models are started with -Dfile.encoding=COMPAT, so that text files are read and written with the system encoding (Windows-1252 on Windows), as with Java 8.

The extension finds it automatically (JAVA_HOME, PATH, Windows registry, usual installation folders), even if JAVA_HOME points to another Java (for instance Java 8, kept for other software): there is no need to change JAVA_HOME, installing Java 21 is enough. If none is found, an error message says so, lists the Java versions found, and lets you download Liberica JDK 21 or choose its folder; it can also be set manually:

Setting Role
ocelet.java.home Java 21 (or later) folder (empty: automatic detection)
ocelet.server.vmargs JVM options of the language server (default -Xmx3g -Xms128m -XX:+ExitOnOutOfMemoryError). The server keeps the models of the opened folder in memory (about 100 MB for a 10,000-line model); -Xms128m keeps the initial heap small (otherwise 1/64 of the machine memory, 1 GB on a 64 GB PC); increase -Xmx if the client reports that it cannot connect to the server
ocelet.model.vmargs JVM options used to run models (default -XX:MaxRAMPercentage=50, up to half of the memory)

Commands

  • Ocelet : Nouveau projet Ocelet... (create a project; also in the Explorer's context menu)
  • Ocelet : lancer le modèle (run the model)
  • Ocelet : tout regénérer et lancer le modèle (regenerate, recompile and run)
  • Ocelet : redémarrer le serveur de langage (restart the language server)
  • Ocelet : choisir le dossier de Java (choose the Java folder)

If something goes wrong: Output panel (Ctrl+Shift+U), select "Ocelet" in the list.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft