Using Lazarus for other computer languages

From Lazarus wiki
Jump to navigationJump to search

Lazarus is great for Free Pascal. But you can use the IDE for other languages too. This is useful to port C code or to edit cross multi tier applications, without the need to use different editors and reducing the trouble when switching between different sets of shortcuts and menu entries.

Syntax Highlighting

Lazarus comes with syntax highlighting for more than a douzand languages. The language is guessed from the file extension. The colors can be setup in the editor options.

If your language is not yet there, you can either use one of the existing highlighters by extending the list of file extensions in the editor options. Or you can create your own highlighter and send us the new highlighter. The easiest way to create a new highlighter is to copy an existing file in lazarus/components/synedit/. The highlighter units all begin with 'synhighlighter', for example synhighlighterphp.pp is the php highlighter.

Tipp: You can quick switch the syntax highlighter for a file via the popup menu of the source editor. Just right click / file settings / highlighter.

Compilation

To setup the compile command there are three possibilities:

1. Create a new shortcut

You can create a new shortcut and a menu item, that starts an external program with Tools / Configure Custom Tools / Add.

For example to invoke 'make' to compile via Makefile:

  • Title: Build via make
  • Programfilename: $MakeExe(make)
  • Parameters:
  • Working Directory: $ProjPath()
  • Options: all disabled
  • Key: choose one or leave untouched

The MakeExe macro function appends the file extension '.exe' under windows. The ProjPath macro is replaced by the current project directory - the directory where the .lpi file is.