OCaml Development Tools
Overview Screenshots Installation notes Download Tutorial Next release

2 - Workspace presentation

[en] [fr]
1 November 2013, by Emmanuel Dieul

The ODT workspace is divided into several views. Each one has its own functionality.

PNG - 105.1 kb

1: the package explorer - 2: the editor - 3: the outline - 4: the problem view, the console...

The package explorer

PNG - 14.6 kb

The package explorer is a project oriented view, like the resource navigator (included by default into Eclipse).

This explorer can let you visualise the files and the folders of the projects which are opened into the workspace. This explorer is specific to ODT in the way that:

  • the source folders are directly placed under the project (even if it’s not physically the case)
  • the binary folder (where the compiled files are placed into) is hidden, and the packages are shown as a flat hierarchy
  • the ODT notable elements wear a specific icon (source folder, package, source file, executable...)
  • the "warning" or "error" compilation messages are summarised on the several resources (files, folders and projects)

This explorer is also compatible with the CVS version control. The specific operations (update, commit, history...), labels and icons are then supported.

Finally, some default filters are applied to this package explorer:

  • the ".*" files are hidden (like the Eclipse .project file of the ODT .preferences.xml file)
  • the compiled files (following a grammar compilation or a library production) are hidden

This filters can be disabled via the "Customize View" action...


To conclude, all the standard actions are available into this explorer: copy, paste, delete, move...

The editor

The OCaml source editor is the standard Eclipse editor, configured for the several OCaml source types: ml and mli, mll, mly.

Global configuration
As the editor is the Eclipse one, all the functionalities and all the parameters linked to this editor are available: fonts, colours, line numbering, keyboard shortcuts, spelling, file encoding... All the parameters are available under the "Window > Preferences" menu or via a right click and then the "Properties" item.

the Eclipse configuration
the ODT configuration (appearance)
the ODT configuration (automatic completion)

Automatic indentation and other syntax elements
The ODT editor offers automatic indentation in two ways: automatic indentation as the user types (current line and sometimes the next one) and automatic indentation of the whole file. This last action is available into the "Editor/Source" menu and into the editor contextual menu, when a file is opened.

the ODT file automatic indentation (the dialog box may not appear on short files)

In addition to the automatic indentation and the syntax highlighting, ODT also offers some particularities for this editor:

  • the colour selection for the syntax highlighting,
  • the automatic completion for parenthesis, strings...

Code completion assistant
Another functionality of ODT (since 3.0) is an assistant for code completion. This completion is available when a module or a class needs to be completed (e.g. "Unix." or "my_object#").
When typing a "." or a "#", or when pressing [Ctrl]+[space] after such a character, a completion menu appears and shows the possible completions ODT has found.

When using class completion, please be warned that this class completion is based upon type calculus, which is done by the compiler. So, if the editing file is not correct for type calculus, no completion will be proposed.
Moreover, the code completion assistant is "quite simple" now, as the expression before the "." or "#" character can only be an identifier (complex expressions whose type have to be computed are not taken into account yet).

Links between usage and definition
With ODT, it’s also possible to navigate via links between variables and their definition. This functionality uses the same process as the code completion and thus has the same limitations.

On the fly compilation
Finally, the editor performs a temporary "on the fly" compilation, each time the editor content changes. Thus, it highlights, before a save operation, the compilation errors.

The outline

The outline provides a quick overview of the file opened into the editor view. It presents the high-level architecture of the component (in terms of defined variables and types) and also the type of these variable.

A permanent link between the outline and the editor helps:

  • realigning the outline view when the cursor has been moved into the editor
  • selecting the code part linked to an outline element which has just been selected

Finally, a specific icon is attributed to each data type to quickly identify:

  • the standard expressions (let...)
  • the classes, the attributes and the methods
  • the types and enumerations
  • the records and the fileds
  • the modules
  • the private elements (methods and attributes)
  • the virtual/abstract elements (classes, attributes and methods)
  • the native functions
  • ...

The compilation message listing

After saving a source file or after cleaning a project, a compilation is launched. The "warning" or "error" messages generated by this compilation are listed into the Eclipse "Problems" view.

This view is not configured by ODT. All the functionalities are the Eclipse ones:

  • severity problem ("error", "warning") grouping,
  • file opening and code selection with a double click onto the message

The standard library view

The ODT OCaml standard library view is like an Eclipse workspace. It provides:

  • a read only editor
  • a read only resource explorer to navigate among the standard library files
  • an outline which summarises all the data (and their type) declared into the file which has been opened into the read only editor

A standard library file selection updates the editor and the outline immediately. In the same way, a click on an outline element automatically selects the corresponding element into the read-only editor.

This view can then be used as a reference manual, when this one is not available.

The interactive console

An interactive console is available into the "Console" view. It can be accessed via the creation or console access menu.

This interactive console simply corresponds to a classical interaction with the "ocaml" program.

This view can be used to debug OCaml phrases during the development. The ODT specificity, in addition to the workspace incorporation, only consists in distinguishing the "input" (typing) and "ouput" ("ocaml" message display) streams with distinct colours.

To launch a new console, the old one must be closed (e.g. via "exit 0;;"). Then a new one can be created.

The console

ODT also provides a non interactive console. This one let you visualise the compilation command line for the source files.

Although all the compilation problems are listed into the "Problems" view, this view can be used to precisely visualise the detail of the compilation process. It is then useful to debug the ODT plug-ins.

And also

Eclipse provides also several views which can be used during the development process:

  • a task list,
  • an history visualisation (local, CVS...),
  • a CVS synchronisation,
  • ...


November 2013

ODT 3.0 released: code completion and others

January 2013

ODT 2.3 released : OCaml 4.00 support

April 2012

ODT 2.2 released : folding code and full indentation

January 2012

ODT 2.1 released : interface generation, libraries and referenced projects

September 2011

ODT 2.0 released : camlp4 integration, separate compilation and more...

December 2010

ODT 1.3.1 released : OCaml 3.12.0 support

October 2010

ODT 1.3 released : many improvements