Skip to content

freixas/gamma-language-support

Repository files navigation

Gamma Language Support

Screenshot 1

Gamma is a tool I wrote some years ago to support drawing Minkowski spacetime diagrams. Diagrams are created using the Gamma language, and this plugin supports creating Gamma scripts.

Actually, Gamma uses two languages: one for programming and one for styling. At this time I only support the programming language. File ending with ".gam" are recognized as Gamma programs. Should I add support for the styling language, I will use ".gcss" as the file extension.

The plugin is installed into a JetBrains IDE. Any of their IDEs should work, but I have only tested the plugin using IntelliJ IDEA, and mostly with version 2025.3. If you don't already use one of the JetBrains IDEs, I'd recommend trying the latest version of IntelliJ IDEA.

Using this plugin is completely optional—Gamma works fine without it. However, Gamma is a tool that one uses only occasionally, so it's easy to forget syntax. Within the IDE environment, you get code completion and hover documentation, so it reduces the need to look things up in the documentation

The IDE offers many other advantages. For example, Gamma normally reports only the first error it finds—the IDE will locate all syntax errors.

Version 0.9.0 is a pre-release version. I expect that there will be some bugs, but the bugs should only affect how your script files look, and not how they work in Gamma.

Features Supported/Not Supported

Supported

  • Syntax highlighting.
  • Syntax error reporting (multiple syntax errors) are caught).
  • Code completion for keywords and variables.
  • Formatting.
  • Some fancy handling of {}, (), and [], as well as smart backspacing.
  • A structure view showing all variable definitions.
  • The ability to find all uses of a variable or navigate to the place a variable is first assigned a value.
  • The ability to quickly comment/uncomment a chunk of code.
  • Variable renaming.
  • Quick documentation on hover for all statements and functions.
  • Generic features (editing features that supported for all languages, from sorting lines to source control).

Not Supported

  • Quick fixes
  • Inspections
  • Code folding
  • Symbols
  • Intentions
  • Parameter hints/inline parameter names/signature help
  • File templates (there's not much to template)
  • Support for include files.

To expand on the last item, an IDE usually works on a set of files designed to produce a single program. Gamma scripts are usually complete programs, so the concept is not usually relevant. Include files are an exception. A variable created in one file might be used in another. The plugin will not correctly rename a variable that exists in more than one file. This may be added in the future.

Installation

  • Install and run the JetBrains IDE.
  • Download the latest release of this plugin, and install it manually using Settings > Plugins > ⚙️ > Install Plugin from Disk...

Setting up Gamma and the JetBrains IDE

  • Run Gamma at least once, and create a new Gamma script file (File > New). This creates the Gamma folder.
  • Run the JetBrains IDE.
  • Use File > New > Project > Gamma > Create to create a Gamma project.
  • For the project name, give it the name of your Gamma folder (typically "Gamma").
  • For the folder name, give it the name of the parent folder (not the Gamma folder).
  • Return to Gamma.
  • Set File > Preferences > Editor command to idea "$F$".

If using idea gives you any problems, try using the full path to the executable, which on my Windows system looks like this: C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2025.2.4\bin\idea64.exe

Using Gamma with JetBrains

  • Start the JetBrains IDE, and open the Gamma project you created (the file will appear in whatever project you have open).
  • Start Gamma. In Gamma, create a new file or open an existing one.
  • The file's output should appear in the Gamma window, and the script source should open up in the IDE.

JetBrain's IDEs tend to aggressively autosave files. This can cause unwanted compilations when switching focus to other windows. To minimize this behavior go to File > Settings > Appearance & Behavior > System Settings and disable Save files when switching to a different application.... Some other options might also need to be disabled.

About

A plugin that supports the Gamma language.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages