Stata 19 MP with Antigravity
Use Antigravity and other VS Code-compatible editors with the existing Stata automation workflow on Ubuntu 24.04-based Linux.
What This Guide Achieves
This guide adapts the existing Stata + VS Code workflow to Antigravity, a VS Code-compatible editor installed on the tested Ubuntu 24.04-based system.
By the end, Antigravity can use the same Stata automation pattern:
| Feature | Status |
|---|---|
Open .do files with Stata syntax highlighting | Verified |
Use Ctrl+Enter to run the current .do file in Stata GUI | Verified |
| Use Shift+Enter to run selected Stata code in Stata GUI | Verified |
Reuse the same stata_run_do.sh and stata_run_selection.sh scripts from VS Code | Verified |
| Use Antigravity’s own settings, keybindings, tasks, and extensions folders | Verified |
| Keep VS Code and Antigravity configurations separate | Verified |
This guide does not reinstall Stata. Complete the Stata 19 MP Complete Installation and VS Code Integration guide first, then use this guide to make the same workflow available in Antigravity.
Tested Antigravity Setup
On the tested system:
command -v antigravity
returned:
/usr/bin/antigravity
The installed version was:
antigravity --version
1.107.0
62335c71d47037adf0a8de54e250bb8ea6016b15
x64
The desktop launcher was installed here:
/usr/share/applications/antigravity.desktop
The user configuration directory was:
~/.config/Antigravity/User/
The extension directory was:
~/.antigravity/extensions/
These paths are important because Antigravity does not use VS Code’s ~/.config/Code/User/ folder. It has its own user configuration folder.
What Carries Over from VS Code
Antigravity supports the same core concepts used by the VS Code Stata workflow:
| VS Code Concept | Antigravity Equivalent |
|---|---|
settings.json | ~/.config/Antigravity/User/settings.json |
keybindings.json | ~/.config/Antigravity/User/keybindings.json |
tasks.json | ~/.config/Antigravity/User/tasks.json |
| Extensions | ~/.antigravity/extensions/ |
| CLI command | antigravity |
| Install extension from CLI | antigravity --install-extension publisher.extension |
| List installed extensions | antigravity --list-extensions --show-versions |
The workflow is therefore almost the same as VS Code, but every configuration file must go into Antigravity’s own folder.
Prerequisites
Complete these first:
| Requirement | Verify |
|---|---|
| Stata 19 MP installed | ls /usr/local/stata19/xstata-mp |
| X11/Xorg session | echo $XDG_SESSION_TYPE should print x11 |
| Required Linux automation tools | which wmctrl xdotool xclip |
| Whole-file runner script | which stata_run_do.sh |
| Selection runner script | which stata_run_selection.sh |
| Antigravity installed | antigravity --version |
Install missing automation tools:
sudo apt update
sudo apt install wmctrl xdotool xclip
These tools require X11/Xorg. If echo $XDG_SESSION_TYPE prints wayland, log out and choose your Xorg session. On the tested Zorin setup, the login-session label was Zorin on Xorg. On standard Ubuntu GNOME, look for an Ubuntu on Xorg style label.
Step 1 - Confirm Antigravity’s Config Paths
List the Antigravity user config folder:
ls -la ~/.config/Antigravity/User
Expected files after configuration:
settings.json
keybindings.json
tasks.json
If the folder does not exist yet, launch Antigravity once:
antigravity
Then close it and check again.
Step 2 - Install Required Extensions
Antigravity uses its own extension directory, so an extension installed in VS Code is not automatically guaranteed to be installed in Antigravity.
Install the Stata syntax extension:
antigravity --install-extension kylebarron.stata-enhanced
Install the multi-command extension:
antigravity --install-extension ryuta46.multi-command
Verify:
antigravity --list-extensions --show-versions | grep -E "kylebarron.stata-enhanced|ryuta46.multi-command"
On the tested system, both were installed:
kylebarron.stata-enhanced@1.6.1
ryuta46.multi-command@1.6.0
Why both are needed:
| Extension | Purpose |
|---|---|
kylebarron.stata-enhanced | Stata syntax highlighting for .do, .ado, and related files |
ryuta46.multi-command | Lets Shift+Enter copy selected code and then run the Stata task |
Step 3 - Create Antigravity Tasks
Create or edit:
nano ~/.config/Antigravity/User/tasks.json
Use this configuration:
{
"version": "2.0.0",
"tasks": [
{
"label": "Run do-file in Stata GUI",
"type": "shell",
"command": "${env:HOME}/.local/bin/stata_run_do.sh",
"args": ["${file}"],
"problemMatcher": [],
"presentation": {
"reveal": "silent",
"panel": "shared"
}
},
{
"label": "Run selection in Stata GUI",
"type": "shell",
"command": "${env:HOME}/.local/bin/stata_run_selection.sh",
"args": [],
"problemMatcher": [],
"presentation": {
"reveal": "silent",
"panel": "shared"
}
}
]
}
This is the same task structure used in the VS Code workflow. The scripts stay in ~/.local/bin/, so both VS Code and Antigravity can reuse them.
If you already configured VS Code and want the exact same tasks in Antigravity, you can copy the file:
cp ~/.config/Code/User/tasks.json ~/.config/Antigravity/User/tasks.json
On the tested system, this copy was the missing step that made the existing Antigravity keybindings useful.
Step 4 - Create Antigravity Keybindings
Create or edit:
nano ~/.config/Antigravity/User/keybindings.json
Use:
[
{
"key": "ctrl+enter",
"command": "workbench.action.tasks.runTask",
"args": "Run do-file in Stata GUI"
},
{
"key": "shift+enter",
"command": "extension.multiCommand.execute",
"args": {
"sequence": [
"editor.action.clipboardCopyAction",
{
"command": "workbench.action.tasks.runTask",
"args": "Run selection in Stata GUI"
}
]
},
"when": "editorTextFocus"
}
]
How it works:
| Keybinding | What Happens |
|---|---|
Ctrl+Enter | Runs the current file through stata_run_do.sh |
Shift+Enter | Copies selected code, then runs stata_run_selection.sh |
The selection runner reads the clipboard with xclip, writes the selected code into /tmp/stata_selection_run.do, then sends do "/tmp/stata_selection_run.do" to Stata. This avoids shell expansion problems with Stata backticks, globals, and block comments.
Step 5 - Add Useful Antigravity Settings
Create or edit:
nano ~/.config/Antigravity/User/settings.json
A minimal Stata-friendly setup:
{
"editor.minimap.enabled": false,
"files.associations": {
"*.do": "stata",
"*.ado": "stata",
"*.mata": "stata"
},
"terminal.integrated.defaultProfile.linux": "bash",
"files.trimTrailingWhitespace": true
}
If your existing Antigravity settings already contain other keys, merge these values instead of replacing the whole file.
On the tested system, Antigravity already had its own settings.json and keybindings.json. The important point is not to edit ~/.config/Code/User/ when you mean to configure Antigravity.
Step 6 - Validate the JSON Files
Before testing inside the editor, validate the JSON files:
node -e "JSON.parse(require('fs').readFileSync(process.env.HOME+'/.config/Antigravity/User/settings.json','utf8')); JSON.parse(require('fs').readFileSync(process.env.HOME+'/.config/Antigravity/User/keybindings.json','utf8')); JSON.parse(require('fs').readFileSync(process.env.HOME+'/.config/Antigravity/User/tasks.json','utf8')); console.log('Antigravity user JSON files are valid')"
Expected:
Antigravity user JSON files are valid
If this fails, fix the reported JSON syntax error before launching Antigravity. Common mistakes are missing commas, trailing comments in strict JSON files, or accidentally pasting two separate JSON objects into one file.
Step 7 - Test the Workflow
Open a folder or file:
antigravity /path/to/your/stata/project
Open a .do file and test:
| Test | Expected Result |
|---|---|
Open .do file | Stata syntax highlighting appears |
Press Ctrl+Enter | Current .do file runs in Stata GUI |
Select one or more lines, press Shift+Enter | Selection runs in Stata GUI |
| Select code with backticks or globals | Code still runs as a temp .do file |
| Run the task again while Stata is open | It reuses the existing Stata window |
For a single line:
- Put the cursor on the line.
- Press
Ctrl+Lto select the line. - Press
Shift+Enter.
What I Verified on the Tested System
These checks were performed locally:
command -v antigravity
antigravity --version
find ~/.config/Antigravity/User -maxdepth 1 -type f
antigravity --list-extensions --show-versions | grep -E "kylebarron.stata-enhanced|ryuta46.multi-command"
node -e "JSON.parse(require('fs').readFileSync(process.env.HOME+'/.config/Antigravity/User/tasks.json','utf8')); console.log('tasks valid')"
The local state after configuration:
| Item | Verified Value |
|---|---|
| Antigravity command | /usr/bin/antigravity |
| Antigravity version | 1.107.0 |
| Settings path | ~/.config/Antigravity/User/settings.json |
| Keybindings path | ~/.config/Antigravity/User/keybindings.json |
| Tasks path | ~/.config/Antigravity/User/tasks.json |
| Extensions path | ~/.antigravity/extensions/ |
| Stata extension | kylebarron.stata-enhanced@1.6.1 |
| Multi-command extension | ryuta46.multi-command@1.6.0 |
Other VS Code-Compatible Editors
The same idea usually applies to editors that keep VS Code-style user files, tasks, keybindings, and extensions.
| Editor | What Usually Changes |
|---|---|
| VS Code | Uses ~/.config/Code/User/ and command code |
| Antigravity | Uses ~/.config/Antigravity/User/ and command antigravity |
| VSCodium | Usually uses ~/.config/VSCodium/User/ and command codium |
| Cursor | Usually uses its own config folder and command, commonly cursor |
| Windsurf | Usually uses its own config folder and command, commonly windsurf |
The portable principle:
- Install
kylebarron.stata-enhanced. - Install
ryuta46.multi-command. - Put the same
tasks.jsoninto that editor’s user config folder. - Put the same
keybindings.jsoninto that editor’s user config folder. - Reuse
~/.local/bin/stata_run_do.shand~/.local/bin/stata_run_selection.sh.
Do not assume all VS Code forks use exactly the same folder names. Verify with:
command -v editor-command
editor-command --version
editor-command --list-extensions --show-versions
Then inspect ~/.config/ for that editor’s user folder.
Troubleshooting
| Problem | Likely Cause | Fix |
|---|---|---|
Ctrl+Enter does nothing | Missing tasks.json or wrong task label | Recreate ~/.config/Antigravity/User/tasks.json |
Shift+Enter does nothing | multi-command missing | antigravity --install-extension ryuta46.multi-command |
.do files have no Stata highlighting | Stata extension missing | antigravity --install-extension kylebarron.stata-enhanced |
| Task opens terminal but not Stata | Missing scripts or PATH issue | Check which stata_run_do.sh and which stata_run_selection.sh |
| Stata does not receive paste | Not on X11/Xorg | Confirm echo $XDG_SESSION_TYPE prints x11 |
| Selection with comments fails | Raw paste workflow was used | Confirm keybinding uses editor.action.clipboardCopyAction plus task |
| Antigravity config changed but behavior did not | Window needs reload | Use command palette reload or restart Antigravity |
| You edited VS Code but Antigravity did not change | Wrong config folder | Edit ~/.config/Antigravity/User/, not ~/.config/Code/User/ |
Inspect Antigravity’s desktop launcher
If you need to confirm the installed app metadata:
sed -n '1,120p' /usr/share/applications/antigravity.desktop
On the tested system, the launcher included:
Name=Antigravity
GenericName=Text Editor
Exec=/usr/share/antigravity/antigravity %F
StartupWMClass=Antigravity
Keywords=vscode;
This confirms that the app is installed as a desktop editor and is intended to behave like a VS Code-style editor.
Removal or Reset
To remove only the Stata automation from Antigravity:
rm -f ~/.config/Antigravity/User/tasks.json
Then edit:
nano ~/.config/Antigravity/User/keybindings.json
Remove the Ctrl+Enter and Shift+Enter Stata bindings.
To uninstall the two extensions from Antigravity:
antigravity --uninstall-extension kylebarron.stata-enhanced
antigravity --uninstall-extension ryuta46.multi-command
This does not remove VS Code settings or VS Code extensions. Antigravity and VS Code use separate user folders.
Related Guides
- Stata 19 MP Complete Installation and VS Code Integration - install Stata and create the shared runner scripts
- VS Code Setup on Linux - baseline VS Code concepts, extensions, and settings paths
- Stata 19 MP with Zed Editor - alternative non-VS-Code editor workflow
- Display Server: Wayland vs X11 - why the Stata automation needs X11/Xorg
Discussion