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.

Intermediate Verified Working Updated 9 min read Tested on Zorin OS 18.1 Pro (Ubuntu 24.04 Noble base) Hardware Lenovo ThinkPad L14 Gen 2

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:

FeatureStatus
Open .do files with Stata syntax highlightingVerified
Use Ctrl+Enter to run the current .do file in Stata GUIVerified
Use Shift+Enter to run selected Stata code in Stata GUIVerified
Reuse the same stata_run_do.sh and stata_run_selection.sh scripts from VS CodeVerified
Use Antigravity’s own settings, keybindings, tasks, and extensions foldersVerified
Keep VS Code and Antigravity configurations separateVerified

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 ConceptAntigravity 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 commandantigravity
Install extension from CLIantigravity --install-extension publisher.extension
List installed extensionsantigravity --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:

RequirementVerify
Stata 19 MP installedls /usr/local/stata19/xstata-mp
X11/Xorg sessionecho $XDG_SESSION_TYPE should print x11
Required Linux automation toolswhich wmctrl xdotool xclip
Whole-file runner scriptwhich stata_run_do.sh
Selection runner scriptwhich stata_run_selection.sh
Antigravity installedantigravity --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:

ExtensionPurpose
kylebarron.stata-enhancedStata syntax highlighting for .do, .ado, and related files
ryuta46.multi-commandLets 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:

KeybindingWhat Happens
Ctrl+EnterRuns the current file through stata_run_do.sh
Shift+EnterCopies 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:

TestExpected Result
Open .do fileStata syntax highlighting appears
Press Ctrl+EnterCurrent .do file runs in Stata GUI
Select one or more lines, press Shift+EnterSelection runs in Stata GUI
Select code with backticks or globalsCode still runs as a temp .do file
Run the task again while Stata is openIt reuses the existing Stata window

For a single line:

  1. Put the cursor on the line.
  2. Press Ctrl+L to select the line.
  3. 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:

ItemVerified Value
Antigravity command/usr/bin/antigravity
Antigravity version1.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 extensionkylebarron.stata-enhanced@1.6.1
Multi-command extensionryuta46.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.

EditorWhat Usually Changes
VS CodeUses ~/.config/Code/User/ and command code
AntigravityUses ~/.config/Antigravity/User/ and command antigravity
VSCodiumUsually uses ~/.config/VSCodium/User/ and command codium
CursorUsually uses its own config folder and command, commonly cursor
WindsurfUsually uses its own config folder and command, commonly windsurf

The portable principle:

  1. Install kylebarron.stata-enhanced.
  2. Install ryuta46.multi-command.
  3. Put the same tasks.json into that editor’s user config folder.
  4. Put the same keybindings.json into that editor’s user config folder.
  5. Reuse ~/.local/bin/stata_run_do.sh and ~/.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

ProblemLikely CauseFix
Ctrl+Enter does nothingMissing tasks.json or wrong task labelRecreate ~/.config/Antigravity/User/tasks.json
Shift+Enter does nothingmulti-command missingantigravity --install-extension ryuta46.multi-command
.do files have no Stata highlightingStata extension missingantigravity --install-extension kylebarron.stata-enhanced
Task opens terminal but not StataMissing scripts or PATH issueCheck which stata_run_do.sh and which stata_run_selection.sh
Stata does not receive pasteNot on X11/XorgConfirm echo $XDG_SESSION_TYPE prints x11
Selection with comments failsRaw paste workflow was usedConfirm keybinding uses editor.action.clipboardCopyAction plus task
Antigravity config changed but behavior did notWindow needs reloadUse command palette reload or restart Antigravity
You edited VS Code but Antigravity did not changeWrong config folderEdit ~/.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.


Discussion