A sourcemap is a JSON file that describes your project’s instance tree and points each node back to the file (or files) it was created from. Luau language servers and other static analysis tools read this file to understand your project’s structure without needing to run Roblox.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/rojo-rbx/rojo/llms.txt
Use this file to discover all available pages before exploring further.
What the sourcemap contains
Each node in the sourcemap describes one Roblox instance with four fields:| Field | Type | Description |
|---|---|---|
name | string | The instance’s name (equivalent to Instance.Name) |
className | string | The Roblox class name (e.g. "ModuleScript", "Folder") |
filePaths | string[] | Paths to the source files that produced this instance |
children | node[] | Child instances, recursively |
filePaths and children are omitted from the output when empty.
Example output
sourcemap.json
Generating a sourcemap
--output to write to a file.
Flags
Path to write the sourcemap JSON file. If omitted, the output is printed to stdout.
By default, the sourcemap only includes script instances (
Script, LocalScript, ModuleScript) and their ancestors. Pass this flag to include all instances in the tree regardless of class.Regenerate the sourcemap whenever any input file changes. The command runs until interrupted. Useful when integrated into an editor workflow or a tool that reloads the sourcemap on disk changes.
Emit absolute filesystem paths in
filePaths instead of paths relative to the project directory. Some tools require absolute paths to locate files correctly.Use with luau-lsp
luau-lsp is the most common consumer of Rojo sourcemaps. To set it up:Generate the sourcemap
Run sourcemap generation in watch mode so the language server always has an up-to-date view:
Filtering behavior
When--include-non-scripts is not set, Rojo builds the full instance tree internally but prunes any node that is neither a script class nor an ancestor of one. This keeps the sourcemap small and focused on the instances that language tools actually care about.
A node is retained if:
- Its
classNameisScript,LocalScript, orModuleScript, or - It has at least one child that is retained.
