DEV Community

Cover image for Setting up Sublime Text 4 for Gno development
Joseph Kato
Joseph Kato

Posted on

Setting up Sublime Text 4 for Gno development

Gno.land Logo

Gnolang (Gno) is an interpretation of the widely-used Golang (Go) programming language for blockchain created by Cosmos co-founder Jae Kwon in 2022 to mark a new era in smart contracting. - About the Gnolang, the Gno Language


When you first open a Gno file in Sublime Text, you'll see something like the screenshot below: a simple plain-text file. No syntax highlighting or fancy language-specific intelligence features that you're probably used to.

While it would be easy enough to simply assign the Go syntax to the .gno extension (super+shift+p -> Set Syntax: Go), this has the undesirable effect of instructing Sublime Text to treat .gno files as .go files -- meaning it assumes that all Go-related tooling (go test, gopls, etc.) works when it actually doesn't.

Instead, we want to teach Sublime Text to understand .gno files as a standalone filetype and how to make use of its own tooling.

Step 1: Install the Gno package


super+shift+p -> Package Control: Install Package -> Gno

The Gno package provides syntax highlighting for .gno, gno.mod, and gno.sum files.

Gno file with syntax highlighting

After installing the package and re-opening the buffer, you'll see some nice syntax highlighting.

Step 2: Install the LSP-gnols package

NOTE: Before completing this step, you'll need to install the Terminus and LSP packages (if you haven't already).

LSP-gnols is a package for gnols, an implementation of the Language Server Protocol.


super+shift+p -> Package Control: Install Package -> LSP-gnols

After installing the package, you'll need to provide a few configuration values. Go to Settings -> Package Settings -> LSP -> Servers -> LSP-gnols and fill in the following:

{
    "settings": {
        "gno": "...",
        "root": "..."
    }
}
Enter fullscreen mode Exit fullscreen mode

where gno is an absolute path to the gno binary and root is the clone location of github.com/gnolang/gno.

Step 3: Write Gno code!

After following these steps, you'll now have:

  1. Syntax highlighting for .gno, gno.mod, and gno.sum files;
  2. autocomplete for the Gno standard library;
  3. hover information for the Gno standard library;
  4. the ability to auto-format your Gno files; and
  5. Code Lens annotations for running tests and benchmarks.

Top comments (0)