starship/starship
Language toolchain modules
These modules detect that the current directory is a project of a particular language, then show the version of the relevant toolchain. They follow a near-identical shape; this page describes the shape once and lists the modules that fit it.
Common shape
A typical toolchain module:
- Loads its
<Name>Configstruct (which has at minimumformat,symbol,style,disabled,detect_files,detect_extensions,detect_folders,version_format). - Detects a project via
Context::try_begin_scan()matchingdetect_files,detect_extensions, ordetect_folders. - Resolves the toolchain version, usually by:
- calling
context.exec_cmd("rustc", &["--version"])(mockable in tests viaModuleRenderer::cmd), - or reading a manifest file (
Cargo.toml,pyproject.toml,package.json,go.mod, …) directly withContext::read_file_from_pwd, - or honoring an environment variable (
PYENV_VERSION,RBENV_VERSION,JAVA_HOME, …).
- calling
- Formats the raw version string via
VersionFormatter::format_module_version, which trims leadingv, allows the user to drop minor/patch parts (v${major}.${minor}), and so on. - Renders through
StringFormatterwith the standard$symbol,$style,$versionvariables.
Modules in this group
| Module | Default symbol | Detection | Notes |
|---|---|---|---|
bun |
🥟 |
bun.lock, bun.lockb, bunfig.toml |
Reads version from bun --version |
c |
C |
*.c, *.h |
Compiler info via cc --version (or alternatives in commands config) |
cmake |
△ |
CMakeLists.txt, CMakeCache.txt |
|
cobol |
⚙️ |
*.cbl, *.cob, *.cpy, *.cobol |
|
cpp |
C++ |
*.cpp, *.hpp, *.cxx, *.cc |
Compiler detection mirrors c |
crystal |
🔮 |
shard.yml, *.cr |
|
daml |
Λ |
daml.yaml |
Daml SDK version |
dart |
🎯 |
*.dart, pubspec.yaml, .dart_tool/ |
|
deno |
🦕 |
deno.json, deno.jsonc, mod.ts, mod.js, deps.ts, deps.js |
|
dotnet |
.NET |
*.csproj, global.json, *.sln, Directory.Build.props, … |
Honors global.json SDK pinning |
elixir |
💧 |
mix.exs |
Shows OTP and Elixir versions |
elm |
🌳 |
elm.json, elm-package.json, elm-stuff/, *.elm |
|
erlang |
🖧 |
rebar.config, erlang.mk |
|
fennel |
🧅 |
*.fnl |
|
fortran |
❄️ |
*.f, *.for, *.f90, *.f95, *.f03, *.f08, fpm.toml |
|
gleam |
⭐ |
gleam.toml, *.gleam |
|
golang (variable: golang, config key golang) |
🐹 |
go.mod, go.sum, go.work, glide.yaml, Gopkg.yml, Gopkg.lock, .go-version, *.go, Godeps/ |
Honors GOROOT and go.mod go directive |
gradle |
🅶 |
gradlew, *.gradle, *.gradle.kts |
Reads gradle/wrapper/gradle-wrapper.properties |
haskell |
λ |
*.hs, cabal.project, stack.yaml, package.yaml |
|
haxe |
⌘ |
*.hx, *.hxml |
|
helm |
⎈ |
Chart.yaml, helmfile.yaml, helmfile.lock |
|
java |
☕ |
pom.xml, build.gradle.kts, build.sbt, *.java, *.class, *.jar, .java-version, deps.edn, project.clj, build.boot, .sdkmanrc |
|
julia |
ஃ |
Project.toml, Manifest.toml, *.jl |
|
kotlin |
🅺 |
*.kt, *.kts |
|
lua |
🌙 |
.lua-version, lua/, *.lua |
|
maven |
🅼 |
pom.xml |
Reads Maven Wrapper version |
mojo |
🔥 |
mojoproject.toml, *.mojo, *.🔥 |
|
nim |
👑 |
*.nim, *.nims, *.nimble, nim.cfg |
|
nodejs |
|
package.json, .node-version, .nvmrc, node_modules/, *.js, *.mjs, *.cjs, *.ts, *.mts, *.cts |
Honors engines.node field |
ocaml |
🐫 |
*.opam, _opam/, esy.lock/, dune, dune-project, jbuild, jbuild-ignore, .merlin, *.ml, *.mli, *.re, *.rei |
|
odin |
Ø |
*.odin |
|
opa |
🪖 |
*.rego |
|
perl |
🐪 |
Makefile.PL, Build.PL, cpanfile, cpanfile.snapshot, META.json, META.yml, .perl-version, *.pl, *.pm, *.pod |
|
php |
🐘 |
composer.json, .php-version, *.php |
|
purescript |
<=> |
spago.dhall, spago.yaml, spago.lock, *.purs |
|
python |
🐍 |
requirements.txt, pyproject.toml, pyrightconfig.json, setup.py, tox.ini, Pipfile, __init__.py, *.py, *.ipynb, .python-version, .venv/, venv/ |
Honors pyenv, pyvenv.cfg, VIRTUAL_ENV, CONDA_DEFAULT_ENV |
quarto |
⨁ |
_quarto.yml, *.qmd |
|
raku |
🦋 |
META6.json, *.p6, *.pm6, *.raku, *.rakumod, *.pod6 |
|
red |
🔺 |
*.red, *.reds |
|
rlang (variable: rlang, config key rlang) |
📐 |
.Rprofile, .Rproj.user/, *.R, *.Rd, *.Rmd, *.Rproj, *.Rsx, .Rdata, .Rhistory |
|
ruby |
💎 |
Gemfile, .ruby-version, *.rb |
Honors RUBY_VERSION |
rust |
🦀 |
Cargo.toml, *.rs |
The biggest module in the group at ~950 lines; resolves toolchain via rustup overrides, rust-toolchain.toml, env vars, then rustc -vV |
scala |
🆂 |
.scalaenv, .sbtenv, build.sbt, .metals/, .bloop/, *.scala, *.sbt |
|
solidity |
S |
*.sol |
|
swift |
🐦 |
Package.swift, *.swift |
|
terraform |
💠 |
.terraform/, *.tf, *.tfplan, *.tfstate |
Shows current workspace + version |
typst |
t |
template.typ, *.typ |
|
vagrant |
⍱ |
Vagrantfile |
|
vlang (config key vlang, variable vlang) |
V |
*.v, v.mod, vpkg.json, .vpkg-lock.json |
|
xmake |
🧰 |
xmake.lua |
|
zig |
↯ |
*.zig |
A handful of toolchain-adjacent modules show environment-name-only (no version):
| Module | Default symbol | Trigger | Notes |
|---|---|---|---|
conda |
🅒 |
CONDA_DEFAULT_ENV is set |
Activated env name only |
pixi |
🧚 |
Project files; honors PIXI_ENVIRONMENT_NAME |
Optionally shows version |
direnv |
direnv loaded |
direnv state file detected | |
mise |
mise |
mise output | |
nix_shell |
❄️ |
IN_NIX_SHELL is set |
|
guix_shell |
[guix] |
GUIX_ENVIRONMENT is set |
|
spack |
🅢 |
SPACK_ENV is set |
|
meson |
⬢ |
MESON_DEVENV and MESON_PROJECT_NAME set |
|
quarto |
⨁ |
(already listed above) | |
buf |
🐃 |
buf.yaml, buf.gen.yaml, buf.work.yaml |
Buf CLI version |
Key abstractions reused across the group
| Helper | File | Purpose |
|---|---|---|
VersionFormatter::format_module_version |
src/formatter/version.rs |
Trims v prefix, applies version_format template |
Context::try_begin_scan |
src/context.rs |
One-pass scan of the current directory's files, folders, and extensions |
Context::exec_cmd |
src/context.rs |
Runs a command with a configurable timeout, mockable in tests |
Context::read_file_from_pwd |
src/context.rs |
Reads a file but only after a scan confirms it is present (saves a stat) |
Context::detect_env_vars |
src/context.rs |
Trigger on env var presence, with !VAR for negation |
Entry points for modification
To change how a toolchain module detects projects, edit the detect_files / detect_extensions / detect_folders defaults in src/configs/<name>.rs. To change how it resolves the version, edit the module(context) function in src/modules/<name>.rs — almost always the change is in the part that calls context.exec_cmd or read_file_from_pwd. Tests live at the bottom of the same file and use ModuleRenderer.
For new languages, see Adding a new module.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.