Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Gmsh GEONew to Visual Studio Code? Get it now.
Gmsh GEO

Gmsh GEO

Jeff Baylor

|
10 installs
| (0) | Free
Syntax highlighting and folding for Gmsh .geo geometry input files
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Gmsh GEO VSCode Extension

A Visual Studio Code extension providing language support for Gmsh .geo geometry and mesh input files.

Gmsh is a free, open-source 3D finite element mesh generator with a built-in CAD engine and post-processor. Its input file format (.geo) defines geometry, mesh settings, and physical groups used by FEA solvers.


Features

Syntax Highlighting

Token-level colorization for all major Gmsh GEO constructs:

Category Examples
Geometry primitives Point, Line, Circle, Ellipse, Spline, BSpline
Surfaces & volumes Plane Surface, Surface Loop, Volume
Boolean operations BooleanUnion, BooleanIntersection, BooleanDifference, BooleanFragments
Transformations Extrude, Rotate, Translate, Scale, Symmetry
Physical groups Physical Point, Physical Line, Physical Surface, Physical Volume
Mesh control Transfinite Line, Transfinite Surface, Recombine Surface, Field
Control flow For/EndFor, If/ElseIf/Else/EndIf, Function/Return
Built-in math Sin, Cos, Sqrt, Exp, Log, Atan2, Hypot
Comments // line comments, /* */ block comments
Literals Numbers, strings, Pi, Sqrt2, GoldenRatio
Parameters DefineConstant, SetFactory, Coherence

Code Folding

Two levels of smart folding:

  1. Block folds — matched structural pairs collapse as a unit:

    • For / EndFor
    • If / EndIf
    • Function / Return
  2. Statement folds — multi-line geometry definitions (e.g. a Point call split across lines) collapse to their opening line.

  3. Group folds — consecutive definitions of the same command (e.g. a block of Point(...) entries or a block of Line(...) entries) collapse as a group. A blank line or a different command ends the group.


Supported File Types

Extension Description
.geo Gmsh geometry and mesh input file
.geo_unrolled Gmsh unrolled (preprocessed) geometry

GEO File Format Overview

Gmsh input files use a C-like language. A typical workflow builds geometry bottom-up:

// characteristic mesh length
lc = 1e-2;

// Points: Point(tag) = {x, y, z, mesh_size};
Point(1) = {0,   0,   0, lc};
Point(2) = {0.1, 0,   0, lc};
Point(3) = {0.1, 0.3, 0, lc};
Point(4) = {0,   0.3, 0, lc};

// Lines connecting points
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};

// Closed curve loop and surface
Curve Loop(1)    = {1, 2, 3, 4};
Plane Surface(1) = {1};

// Assign FEA boundary conditions via Physical Groups
Physical Line("Dirichlet") = {4};
Physical Surface("Domain") = {1};

// Mesh
Mesh 2;

Key Concepts

Tags — Every entity (point, line, surface, volume) has an integer tag. Tags must be unique within each dimension.

Curve Loops — An ordered list of line tags that forms a closed boundary. Negative tags reverse orientation.

Physical Groups — Named sets of entities exported to the mesh file. Only entities in Physical Groups appear in the solver input unless Mesh.SaveAll = 1.

Characteristic Length — The fourth argument to Point{} (or a Field) controls local mesh density.

SetFactory — Switches the CAD kernel. SetFactory("OpenCASCADE") enables the OCCT kernel for Boolean operations; the default is the native Gmsh kernel.


Building and Packaging

npm install
npm run compile        # transpile TypeScript → out/
npm run package        # compile + vsce package → .vsix

Install the packaged extension:

Extensions: Install from VSIX...

Testing (Development)

Press F5 in VSCode to launch an Extension Development Host with the extension loaded. Open any .geo file to verify syntax highlighting and folding.


Requirements

  • Visual Studio Code ^1.74.0

License

MIT — Jeff Baylor 2026

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft