Skip to article
Documentation

Packages and editing

Open a Gleam package, navigate symbols, and refactor safely.

On this page

Open a package#

Open the folder containing gleam.toml. Wait for indexing and package discovery, then open src/<package>.gleam. Completion, Go to Declaration, Find Usages, and the Structure view work with the package model and official language server.

For a small application, a source file can start with:

import gleam/io

pub fn main() {
  io.println("Hello from Gleam Pro")
}

Use Go to Declaration on println to check that dependency sources resolve. If the dependency has not been downloaded, resolve the package dependencies before investigating navigation.

Rename and extract#

Place the caret on a symbol and invoke Refactor → Rename. Review usages before applying the change. Use Extract Variable on an expression to introduce a local binding, or the Gleam move-module action to move a module with reference updates. Use IDE refactorings so imports and usages can be updated together.

Manage dependencies#

Open the Gleam Packages tool window to inspect packages and their dependencies. Search Hex, review the proposed manifest changes, and add or remove a dependency. The package graph is useful in workspaces containing several gleam.toml files: select the intended package before making a change.

Version 2026.2.4 also understands Git dependencies located in repository subdirectories. Keep manifest and dependency-lock changes together in version control. Run the compiler after a refactor or dependency change to validate the complete package.

Manual for version 2026.2.4 · Reviewed