Setting up Sublime Text 4 for Gno development
Tags: web3, programming, blockchain
Published: 2023-09-05 21:45:25

![Gno.land Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qxk0xu5zp59l1pqb4qha.png)

> 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](https://medium.com/r/?url=https%3A%2F%2Fgno.land%2Fgnolang)

---

When you first open a Gno file in [Sublime Text](https://www.sublimetext.com/), 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.

<figure>
  <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7gpc7zkwum146j594lc5.png">
</figure>

While it would be easy enough to simply assign the Go syntax to the `.gno` extension (<kbd>super+shift+p</kbd> -> `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

<figure>
  <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9h7a9d057mdsbt98ojv7.png">
  <figcaption><kbd>super+shift+p</kbd> -> `Package Control: Install Package` -> `Gno`</figcaption>
</figure>

The [Gno](https://packagecontrol.io/packages/Gno) package provides syntax highlighting for `.gno`, `gno.mod`, and `gno.sum` files.

![Gno file with syntax highlighting](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/otnmuj6phauj6tyzcess.png)

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](https://packagecontrol.io/packages/Terminus) and [LSP](https://packagecontrol.io/packages/LSP) packages (if you haven't already).

[`LSP-gnols`](https://packagecontrol.io/packages/LSP-gnols) is a package for [`gnols`](https://github.com/jdkato/gnols), an implementation of the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/).

<figure>
  <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lpbqli6e0j7eio5igamu.png">
  <figcaption><kbd>super+shift+p</kbd> -> `Package Control: Install Package` -> `LSP-gnols`</figcaption>
</figure>

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:

```json
{
    "settings": {
        "gno": "...",
        "root": "..."
    }
}
```
where `gno` is an absolute path to the `gno` binary and `root` is the clone location of [`github.com/gnolang/gno`](https://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.