Initial Release
English | 简体中文
Apply consistent indentation to InterSystems ObjectScript class files (.cls) and MAC routines (.mac). The parser and printer were written for this project. The plugin runs with Prettier 3. The local validation used Node.js 23.11 and Prettier 3.10.1.
The two examples deliberately use uneven indentation. Run these commands in the plugin source directory.
npm ci
npm test
npx prettier --plugin ./index.js "examples/*" --check
npx prettier --plugin ./index.js examples/FormatRoutine.mac
The check should exit with status 1 for the original examples. The last command prints the formatted routine to the terminal.
Copy the IPM archive prettier-plugin-objectscript-ipm-0.2.0.tgz to a path readable by the IRIS server. In the desired namespace, load the archive from the IRIS terminal. Replace /packages with your directory.
zpm "load /packages/prettier-plugin-objectscript-ipm-0.2.0.tgz -v"
zpm "list"
For a source checkout you can instead run zpm "load /path/to/prettier-plugin-objectscript -v" against the directory containing module.xml. IPM installs the two JS files, package metadata, and both READMEs under the instance’s lib/prettier-plugin-objectscript/<namespace>/ directory. The verbose output shows the resolved path.
Run Prettier on a machine with Node.js and Prettier 3. If that machine can read the deployed files, pass the installed entry point directly, as below for a Linux instance and the USER namespace. For a separate CI runner, copy the installed directory to the runner and adjust the path.
npx prettier --plugin /usr/irissys/lib/prettier-plugin-objectscript/USER/index.js --check "**/*.{cls,mac}"
To remove the installed files, run zpm "uninstall prettier-plugin-objectscript" in the same namespace. The separate npm tarball in the next section is intended for Node.js package managers.
Run npm pack in the plugin directory. Copy prettier-plugin-objectscript-0.2.0.tgz into the target repository’s vendor/ directory and install it from the repository root.
npm install --save-dev prettier@3 ./vendor/prettier-plugin-objectscript-0.2.0.tgz
Merge these settings into .prettierrc.json. Commit the configuration, tarball, package.json, and lockfile together so CI can install the same plugin.
{
"plugins": ["prettier-plugin-objectscript"],
"overrides": [
{ "files": ["*.cls", "*.mac"], "options": { "tabWidth": 4 } }
]
}
Run the first command locally and review the Git diff. Run the second in CI after npm ci. The check fails when tracked formatting rules would change the input.
npx prettier --write "**/*.{cls,mac}"
npx prettier --check "**/*.{cls,mac}"
tabWidth and useTabs.endOfLine setting.&sql(...) commands, block comments, and common macro definitions, then resume indentation. If it cannot determine the boundary, it preserves the layout from that point to the end of the file. Examples include foreign-language methods, complex XData, conditional compilation, and multiline method signatures. A passing check covers only the rules applied.$TEXT can observe indentation changes.--stdin-filepath Sum.mac to infer the parser, or select --parser objectscript-class or --parser objectscript-routine.See the Prettier plugin API and InterSystems ObjectScript syntax guide.