Setting up Sublime Text 4 for Gno development
Joseph Kato
Posted on September 5, 2023
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
The Gno package provides syntax highlighting for .gno
, gno.mod
, and gno.sum
files.
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.
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": "..."
}
}
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:
- Syntax highlighting for
.gno
,gno.mod
, andgno.sum
files; - autocomplete for the Gno standard library;
- hover information for the Gno standard library;
- the ability to auto-format your Gno files; and
- Code Lens annotations for running tests and benchmarks.
Posted on September 5, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
October 3, 2022