Arthas VSCodeEnglish | 简体中文 Generate and copy Arthas commands right from your editor. Place the cursor on a Java class / method / field / enum, right-click "Arthas Command", and the matching Feature set ported from arthas-idea-plugin (the IntelliJ version); command templates match the original plugin one by one. Feature OverviewBasic commands (right-click "Arthas Command" menu, shown dynamically per cursor context)
Supports Lombok: Quickly Get Available Command
Mybatis Mapper XML Hot ReloadRight-click a single mapper Prerequisites:
Context Resolution
Deliberate difference from the IDEA plugin: the cursor inside a method body counts as that method (the original requires the method name), which is more intuitive. Settings (
|
| Setting | Default | Notes |
|---|---|---|
arthas.invokeCount |
5 | -n for watch/trace/stack/tt |
arthas.monitorCount / arthas.monitorInterval |
10 / 10 | -n and --cycle for monitor |
arthas.depth |
3 | -x expansion depth |
arthas.printConditionExpress |
false | Append -v |
arthas.conditionExpressDisplay |
false | Append the '1==1' condition express |
arthas.traceSkipJdk |
false | When false, trace appends --skipJDKMethod false |
arthas.staticSpringContextOgnl |
@applicationContextProvider@context |
Static Spring Context ognl; set to a non-default value (e.g. @com.demo.ApplicationContextProvider@context) to enable the static-Spring commands |
arthas.autoToUnicode |
true | Convert Chinese characters to \uXXXX when copying |
arthas.showCopyNotification |
true | Post-copy notification (carries the "Open doc / AOP variant" buttons); click Don't show again on it to mute |
arthas.manualSelectPid |
true | Interactive jps pid selection inside generated scripts; when off, selectProjectName is used directly |
arthas.selectProjectName |
empty | --select value for generated scripts (jps -l process name) |
arthas.arthasZipDownloadUrl |
arthas official URL | arthas zip download URL used by generated scripts (swap for intranet mirrors) |
arthas.mybatis.reloadBeanName |
mybatisMapperXmlFileReloadService |
Mybatis reload service bean name (app must contain it) |
arthas.mybatis.reloadMethodName |
reloadAllSqlSessionFactoryMapper |
Mybatis reload service method name |
Development
npm install
npm run compile # esbuild bundle to out/
npm test # mocha unit tests
npm run test-integration # real VSCode host integration tests (base + Lombok suites)
F5to debug in the Extension Development Hostnpx @vscode/vsce packageto build a .vsix
Integration tests
npm run test-integration launches a real VSCode instance via @vscode/test-electron, opens test/fixtures/Demo.java in the extension host, moves the cursor / selects text, runs the same commands as the context menu, and asserts the full command strings written to the clipboard.
- Reuses the local VSCode by default (common install paths auto-detected; override with
VSCODE_EXECUTABLE_PATH); downloads a stable VSCode into.vscode-test/when not found (slow the first time). - The test instance uses an isolated profile under
.vscode-test/— your local VSCode settings and extensions are untouched. - By default it covers the text-parser fallback path (java language assigned via
setTextDocumentLanguage, no Java extension needed). - Run
node tools/setup-redhat.jsonce to register the local redhat.java into the test instance: the base suite then also covers the DocumentSymbol primary path, and the Lombok suite is appended automatically (@Data/@Builderfixtures; method-name normalization, annotated-field range matching, Lombok setter inference, synthetic Builder class filtering). Put a lombok jar intest/fixtures-lombok/lib/to enable full annotation processing (jar not committed).
Project layout
src/
├── extension.ts # command registration, dynamic menu visibility (context keys), UI flows
├── java/ # Java context analysis (symbolProvider primary + textParser fallback + default values)
├── command/ # command template engine (templates / commandContext / constantCommands / ttCommands)
├── script/ # one-click bash script foundation (templates + one-liner generation)
├── mybatis/ # Mybatis mapper xml hot reload flow
├── util/ # QuickPick/InputBox, clipboard, i18n
└── settings.ts # configuration reader
Differences from the IDEA plugin
- The stray
#beforeinstances[0]in the vmtool setter command was removed (likely a typo in the original template; every other variant and the official docs omit it). - One-click scripts (Mybatis reload etc.) are distributed via clipboard or saved file only; OSS/S3/Redis delivery and the Arthas Tunnel terminal are not ported. Hot swap redefine/retransform can be added on the same script foundation.
- Accidental double spaces caused by optional parameters are collapsed to single spaces (functionally equivalent).