Use Sublime Text alongside Retool to write and refine JavaScript transformer code, Custom Component logic, and Retool CLI app definition files in a lightweight, fast editor. You work locally in Sublime Text, then paste polished code into Retool's query or transformer editor. Useful packages include JSPrettier for formatting and SublimeLinter for catching JavaScript errors before they reach Retool.
| Fact | Value |
|---|---|
| Tool | Sublime Text |
| Category | DevOps |
| Method | Development Workflow |
| Difficulty | Beginner |
| Time required | 15 minutes |
| Last updated | April 2026 |
Use Sublime Text as Your Local Editor for Retool JavaScript and App Definitions
Retool's built-in code editor — used for JavaScript queries, transformers, and Custom Components — is functional but intentionally compact. For anything beyond a few lines of logic, working in a full local editor offers significant advantages: syntax highlighting, multi-cursor editing, auto-formatting, and the ability to run linters before the code ever reaches Retool. Sublime Text excels in this role due to its speed, low memory footprint, and clean interface that does not get in the way of quick editing sessions.
The integration pattern is straightforward: you write your JavaScript in Sublime Text, format it with JSPrettier, and paste the finished function into Retool's transformer or query editor. For transformer functions, this typically means editing a self-contained JavaScript function that receives a data parameter and returns transformed results. For Custom Components — Retool's mechanism for embedding arbitrary HTML, CSS, and JavaScript into an app — you write the full component source in Sublime Text and paste it into the Custom Component editor. The separation of concerns keeps your complex logic versioned locally while Retool handles UI binding and data sourcing.
For teams using the Retool CLI to export and version-control app definitions as JSON files, Sublime Text becomes even more useful. App definition files are structured JSON that describes every component, query, and transformer in an app. Sublime Text's JSON syntax support, multi-cursor capability for bulk edits, and lightweight startup make it a fast choice for reviewing or modifying exported app definitions before committing them to a repository and re-importing into Retool.
Integration method
Sublime Text integrates with Retool through a local development workflow rather than a live API connection. Developers write JavaScript transformer functions, Custom Component source code, and Retool CLI app definition JSON files in Sublime Text, then bring that code into Retool's visual editor by pasting into the appropriate panel. For teams using the Retool CLI for version-controlled app management, Sublime Text serves as the primary editor for app definition files stored in a local repository.
Prerequisites
- Sublime Text 4 installed (sublimetext.com/download)
- Package Control installed in Sublime Text for managing packages
- A Retool account with at least one app that uses JavaScript transformers or Custom Components
- Node.js installed locally if you plan to use the Retool CLI for app definition management
- Basic familiarity with JavaScript and Retool's transformer pattern (function receiving data and returning transformed results)
Step-by-step guide
Install Package Control and JavaScript packages in Sublime Text
To get the most out of Sublime Text for Retool development, you need a few key packages installed via Package Control. If Package Control is not already installed, open Sublime Text's command palette with Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows/Linux), type 'Install Package Control', and press Enter. Wait a moment for it to install — you may need to restart Sublime Text. Once Package Control is installed, open the command palette again and type 'Package Control: Install Package', then press Enter. A searchable package list will appear. Install these packages one at a time: JSPrettier (auto-formats JavaScript using Prettier, keeping transformer functions clean and consistently indented), SublimeLinter (framework for linting in Sublime Text), SublimeLinter-jshint (JavaScript linting to catch undefined variables and syntax errors before pasting into Retool), and Emmet (HTML abbreviation expander, essential for writing Custom Component HTML quickly). After installing all packages, go to Preferences → Package Settings → JSPrettier → Settings — User and add a configuration to match Retool's 2-space indent style and single-quote preference. Restart Sublime Text after package installation to ensure all packages activate correctly.
1{2 "prettier_cli_path": "",3 "auto_format_on_save": false,4 "prettier_options": {5 "printWidth": 100,6 "tabWidth": 2,7 "singleQuote": true,8 "semi": true,9 "trailingComma": "es5"10 }11}Pro tip: Set auto_format_on_save to false for Retool transformer files — you want to explicitly trigger formatting with Cmd+Shift+P → 'JSPrettier: Format JavaScript' rather than having it format every save, which can disrupt work-in-progress code.
Expected result: Package Control, JSPrettier, SublimeLinter, and Emmet are installed. The command palette shows JSPrettier format options. SublimeLinter shows error indicators in the gutter for JavaScript syntax problems.
Set up a local Retool transformers project structure
Organize your Retool transformer functions in a local folder structure so they are easy to find, version, and reuse across apps. Create a folder in your development directory named retool-transformers or similar. Inside, create subdirectories organized by Retool app name or by function purpose (e.g., /data-cleaning, /api-response-parsers, /chart-formatters). Each file in these directories contains a single transformer function. Open this folder in Sublime Text by going to File → Open Folder, which loads it as a project with a sidebar showing all files. Create a new file for each transformer, name it descriptively (e.g., flatten-stripe-charges.js), and set the syntax to JavaScript via the bottom status bar → Plain Text → JavaScript. Write your transformer function in the standard Retool pattern: a JavaScript expression where the data variable holds the raw query results and the return value replaces queryName.data. Include a comment at the top of each file explaining which Retool app and query the transformer belongs to, which resource it operates on, and what the input and output shapes look like. This makes it easy to find the right file when you need to update a transformer months later.
1// App: Customer Dashboard2// Query: getStripeCharges3// Input: raw Stripe /v1/charges list response4// Output: flat array of charge objects for Table component56const charges = data.data || [];78return charges.map(charge => ({9 id: charge.id,10 amount: `$${(charge.amount / 100).toFixed(2)}`,11 currency: charge.currency.toUpperCase(),12 status: charge.status,13 customer_email: charge.billing_details?.email || 'N/A',14 created: new Date(charge.created * 1000).toLocaleDateString(),15 description: charge.description || ''16}));Pro tip: Use Sublime Text's Projects feature (Project → Save Project As) to save your retool-transformers folder as a named project. This lets you quickly switch to it from the recent projects list without browsing to the folder each time.
Expected result: A local folder is open in Sublime Text as a project, showing transformer .js files organized by app. Syntax highlighting and JSPrettier work correctly for JavaScript files. SublimeLinter highlights any syntax errors inline.
Write and format a transformer function, then paste into Retool
The core workflow loop is: write transformer logic in Sublime Text, format it, verify it, then paste into Retool. Open one of your transformer .js files in Sublime Text. Write the JavaScript function body — remember that Retool transformers are expressions, not complete function definitions. You have access to the data variable containing raw query results, and your code's return value becomes the new .data property of the query. Write the logic, using Sublime Text's multi-cursor editing (Cmd+click or Ctrl+click on multiple points) to efficiently edit repetitive patterns like mapping object keys. When the logic is complete, trigger JSPrettier by opening the command palette with Cmd+Shift+P and typing 'JSPrettier: Format JavaScript', then pressing Enter. The code reformats instantly with consistent indentation and spacing. Review the formatted output, then select all the code with Cmd+A and copy it with Cmd+C. Switch to your Retool browser tab, open the app, navigate to the Code panel at the bottom, and click on the query whose transformer you want to update. Click the 'Advanced' tab and scroll to the Transform results section. If the toggle is off, turn it on. Click inside the transformer code area, select all existing content, and paste your code. Click 'Run' to execute the query with the new transformer and verify the output in the right-hand results pane.
1// Before formatting (written in Sublime Text)2const rawItems = data.items||[];3return rawItems.filter(item=>item.active===true).map(item=>({id:item.id,name:item.name||'N/A',price:item.price_money?`$${(item.price_money.amount/100).toFixed(2)}`:'Free',category:item.category_id||'Uncategorized'}));Pro tip: Sublime Text's multi-cursor editing is particularly useful for transformer code where you need to rename a field key across multiple places. Hold Cmd (macOS) and click at each location, then type once to update all cursors simultaneously.
Expected result: The transformer function is formatted, pasted into Retool's Advanced tab, and the query runs successfully. The query's .data output reflects the transformed array visible in the Results panel.
Use the Retool CLI with Sublime Text for version-controlled apps
For teams that use the Retool CLI to manage app definitions as code, Sublime Text becomes the primary editor for reviewing and modifying exported JSON files. First, install the Retool CLI globally using npm (run npm install -g retool-cli in your terminal). Authenticate with retool login and configure your organization URL. Create a local directory for your Retool app definitions and run retool apps pull to export your apps as JSON files — each app exports as a single JSON file containing all components, queries, transformers, and event handler configurations. Open the exported directory in Sublime Text (File → Open Folder). App definition files are deeply nested JSON with a structure following Retool's internal schema. Use Sublime Text's JSON folding (click the triangle icons in the gutter) to collapse sections you do not need to edit. Use Cmd+F to search for specific component names or query names within the large JSON file. When you need to make bulk changes — such as updating a resource name across all queries in an app after renaming a Resource in Retool — Sublime Text's Find and Replace (Cmd+H) with regex mode makes this straightforward. After editing, format the JSON with Cmd+Shift+P → 'Reindent Lines' and validate it is valid JSON before running retool apps push to re-import the modified app definition back into Retool.
Pro tip: App definition JSON files can be large (several hundred kilobytes for complex apps). Use Sublime Text's Goto Symbol feature (Cmd+R) to navigate quickly — it indexes named keys in JSON, letting you jump directly to specific component or query definitions by name.
Expected result: Retool app definition JSON files are open in Sublime Text with syntax highlighting and code folding. The Find and Replace tool can locate and update resource names or query references across the entire file. retool apps push re-imports the modified app successfully.
Configure Sublime Text for Custom Component development
Retool Custom Components allow you to embed arbitrary HTML, CSS, and JavaScript inside a Retool app using an iframe. They are typically written as a single HTML file with embedded styles and scripts. Sublime Text is well-suited for this because Custom Components are self-contained HTML documents that benefit from Emmet's abbreviation system and syntax highlighting for all three languages (HTML, CSS, JavaScript) in one file. Create a file with a .html extension in your transformers project folder. Set the syntax to HTML. At the top of the file, write the standard Retool Custom Component boilerplate: an HTML document structure with a script tag that imports Retool's Custom Component SDK from the Retool CDN, and the initialization code that calls Retool.subscribe() to receive model data from the parent Retool app. Use Emmet to generate HTML structure quickly — type an Emmet abbreviation like div.chart-container>canvas#myChart and press Tab to expand it. Write your component's CSS in a style tag and JavaScript in a script tag within the same file. When the component is complete, select all (Cmd+A), copy (Cmd+C), switch to Retool, open or create a Custom Component in your app, click 'Edit source', select all existing code in the editor, and paste your component. Click 'Save' to apply the component. The component renders immediately in Retool's preview, receiving data from any query you bind to it via the model.
1<!DOCTYPE html>2<html>3<head>4 <style>5 body { margin: 0; font-family: sans-serif; }6 .container { padding: 16px; }7 .metric { font-size: 2rem; font-weight: bold; color: #2563eb; }8 .label { font-size: 0.875rem; color: #6b7280; margin-top: 4px; }9 </style>10</head>11<body>12 <div class="container">13 <div class="metric" id="value">—</div>14 <div class="label" id="label">Loading...</div>15 </div>16 <script src="https://cdn.tryretool.com/js/custom-component.js"></script>17 <script>18 Retool.subscribe(function(model) {19 document.getElementById('value').textContent = model.value || '—';20 document.getElementById('label').textContent = model.label || 'Metric';21 });22 </script>23</body>24</html>Pro tip: Keep Custom Component source files in your Sublime Text project alongside your transformer .js files. This creates a local library of reusable components you can paste into any Retool app, and version control them alongside app definition files in Git.
Expected result: The Custom Component HTML is written and formatted in Sublime Text, pasted into Retool's Custom Component source editor, and renders correctly in the app preview. The component receives and displays model data from the parent Retool app.
Common use cases
Write and test complex transformer functions locally
You need to write a multi-step JavaScript transformer that joins data from three Retool queries, applies business logic, and returns a formatted array for a Table component. Writing this in Retool's embedded editor is cramped and has no formatting. In Sublime Text with JSPrettier installed, you write the function, auto-format it, and validate the logic mentally before pasting the finished version into Retool's transformer editor — saving debugging time inside Retool.
Open Sublime Text, create a new file with syntax set to JavaScript, write a transformer function that merges two arrays by a shared key, use JSPrettier to format it, then copy the function body and paste it into Retool's transformer editor under your query's Advanced tab.
Copy this prompt to try it in Retool
Edit Retool app definition files exported via the CLI
Your team uses the Retool CLI to export app definitions as JSON files stored in a Git repository for version control. When reviewing a pull request that modifies a complex app, you open the exported JSON in Sublime Text to read the component structure, query definitions, and event handler logic. Sublime Text's JSON folding and multi-cursor editing let you navigate and modify the file efficiently before re-importing into Retool.
Run `retool apps pull` to export your app definition to a local JSON file, open the file in Sublime Text, use Cmd+R to jump to specific component sections, make your edits, format with JSPrettier, and run `retool apps push` to re-import the updated definition.
Copy this prompt to try it in Retool
Build Custom Component HTML and JavaScript
You need a Retool Custom Component that renders a specialized chart library not available in Retool's native Chart component. You write the full component source — including HTML structure, CSS styles, and the JavaScript initialization logic for the chart library — in Sublime Text. With Emmet installed, you generate the HTML scaffolding quickly, then paste the complete component source into Retool's Custom Component editor panel.
Create a new file in Sublime Text, set syntax to HTML, use Emmet shortcuts to scaffold the component structure, add JavaScript for a D3.js visualization, format with JSPrettier, then paste the entire source into the Retool Custom Component's source code editor.
Copy this prompt to try it in Retool
Troubleshooting
JSPrettier fails to format and shows 'Prettier not found' error
Cause: JSPrettier requires Prettier to be installed either globally via npm or as a project-level dependency. If Node.js or Prettier is not available on your PATH, JSPrettier cannot locate the formatter binary.
Solution: Install Prettier globally by running npm install -g prettier in your terminal. Then open JSPrettier settings in Sublime Text (Preferences → Package Settings → JSPrettier → Settings - User) and set prettier_cli_path to the full path of your Prettier binary, which you can find by running which prettier in your terminal. Alternatively, install Prettier as a project dependency in a package.json alongside your transformer files and set prettier_cli_path to ./node_modules/.bin/prettier.
1{2 "prettier_cli_path": "/usr/local/bin/prettier"3}Transformer code pasted from Sublime Text causes a syntax error in Retool
Cause: Retool transformers expect a JavaScript expression or a series of statements ending with a return statement — not a complete function definition with function keyword and name. If you wrote the code as a named function in Sublime Text and pasted the entire definition including the function keyword, Retool's transformer editor treats it as an invalid expression.
Solution: In Retool's transformer editor, paste only the function body — the code between the opening and closing braces, excluding the function keyword and name. The transformer editor wraps your code in a function automatically. Alternatively, if you prefer to write complete functions locally, wrap your logic in an IIFE (immediately invoked function expression) that Retool can evaluate as an expression.
1// Instead of: function myTransformer(data) { return data.map(...); }2// Paste this into Retool's transformer:3return data.map(item => ({4 id: item.id,5 name: item.name6}));SublimeLinter shows no errors but code fails in Retool with 'X is not defined'
Cause: SublimeLinter with jshint does not know about Retool's implicit global variables — data, utils, moment, _, and other globals that Retool injects into the transformer execution context. jshint reports these as undefined variables even though they are valid in Retool's runtime.
Solution: Add a jshint configuration file (.jshintrc) in your transformer project folder that declares Retool's globals as known. This tells SublimeLinter to treat them as pre-defined and suppresses false-positive 'undefined variable' warnings while still catching genuine errors.
1{2 "globals": {3 "data": true,4 "utils": true,5 "moment": true,6 "_": true,7 "Retool": true8 },9 "esversion": 1110}Best practices
- Organize transformer files by Retool app name and query name in a local directory structure, and commit them to a Git repository alongside your Retool CLI app definitions — this gives you a full version history of all transformer logic.
- Include a comment block at the top of each transformer file documenting the Retool app name, query name, resource type, input data shape, and expected output shape. This context is invaluable when returning to transformer code weeks or months later.
- Use Sublime Text's Find in Files (Cmd+Shift+F) to search across all transformer files when you need to find where a particular API field or pattern is used — this is much faster than searching inside Retool's app editor.
- Run JSPrettier formatting before every paste into Retool to maintain consistent indentation. Retool's embedded editor does not auto-format, so messy transformer code accumulated over time becomes difficult to read and maintain.
- Leverage Sublime Text's multi-cursor editing to make bulk edits to transformer files — for example, renaming a field key that appears many times in a map() call, or updating a pattern used across multiple transformers simultaneously.
- Keep Custom Component HTML files in the same version-controlled repository as transformer files so the full Retool development surface is tracked together. Name each file after the component's purpose (e.g., d3-bar-chart.html, metric-card.html) for easy discovery.
- When editing Retool CLI app definition JSON files, use Sublime Text's JSON syntax mode and folding to navigate complex nested structures. Validate JSON syntax before pushing — an invalid JSON file will fail to import and may corrupt app state.
Alternatives
VS Code offers richer TypeScript and React support with built-in IntelliSense and a larger extension ecosystem, making it a better choice for teams building complex Retool Custom Components or managing large numbers of app definitions.
Atom is another lightweight editor alternative that is now archived (no longer actively developed), making Sublime Text the more sustainable choice for teams not ready to adopt VS Code's full feature set.
Git version control pairs with any editor choice and is the recommended companion for the Retool CLI workflow, providing the actual versioning and collaboration layer that Sublime Text alone does not offer.
Frequently asked questions
Can Sublime Text connect directly to Retool to sync code automatically?
No. Sublime Text does not have a native plugin for live syncing with Retool. The workflow is copy-and-paste for transformers and Custom Component code, or using the Retool CLI (retool apps push/pull) for full app definition files. There is no real-time sync between the two tools.
Is there a Retool-specific Sublime Text package?
No dedicated Retool package exists for Sublime Text as of 2026. The recommended setup is JavaScript syntax highlighting (built-in), JSPrettier for formatting, and SublimeLinter for error checking — all general-purpose JavaScript tooling that works well for Retool's transformer and Custom Component code patterns.
When should I use Sublime Text versus writing code directly in Retool's editor?
Use Retool's built-in editor for short, simple transformers (under 20 lines) where you want immediate feedback while building the app. Switch to Sublime Text for complex multi-step transformers, Custom Component source code, or any code that you want to reuse across multiple apps and version-control in Git. The larger and more complex the code, the more value the local editor workflow provides.
How do I use the Retool CLI with Sublime Text?
Install the Retool CLI globally (npm install -g retool-cli), authenticate with retool login, and run retool apps pull to export app definitions as JSON files to a local directory. Open that directory in Sublime Text as a project. Edit the JSON files as needed, then run retool apps push to re-import the modified definition back into Retool. This workflow enables Git-based version control for your Retool apps with Sublime Text as the editing interface.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation