ArkTS
Lightweight ArkTS and ArkUI language support for Sublime Text 4
By
tinysniper
Created
Links
Versions
0.1.2
(>ST4106)
·
ArkTS for Sublime Text
English · 简体中文
Lightweight ArkTS and ArkUI language support for Sublime Text 4. It requires no SDK, Node.js, or additional plugins.
Version 0.1.2 is available under the MIT license. While Package Control inclusion is pending, install the package manually.
Features
- Automatically recognizes
.etsand.d.etsfiles. - Highlights keywords, types, structs, decorators, component calls, strings, template interpolation, numbers, and comments.
- Supports common nested ArkUI components, chained calls, and V1 and V2 decorators.
- Follows your indentation preferences and supports Sublime Text's comment shortcuts, bracket matching, and code folding.
- Use Ctrl+R (Cmd+R on macOS) to navigate to declarations such as structs, classes, interfaces, type aliases, functions, and methods.
- Highlights regular expression literals in common expression positions, including escapes, character classes, and flags.
- Includes 11 snippets. Type a prefix and press Tab to expand it, then press Tab to move between placeholders.
Installation
- Run
py -3 tools/build.pyon Windows orpython3 tools/build.pyon other platforms to generatedist/ArkTS.sublime-package. - In Sublime Text, choose Preferences → Browse Packages…. Copy the package file into Installed Packages, next to the Packages folder.
- Reopen an
.etsfile and look for ArkTS in the status bar. You can also choose View → Syntax → ArkTS.
For development, you can instead copy the source folder to Packages/ArkTS.
To set preferences just for ArkTS, open Preferences → Package Settings → ArkTS → Settings or run Preferences: ArkTS Settings from the Command Palette. Add your overrides in the user settings pane.
Snippets
| Prefix | Expands to |
|---|---|
page |
@Entry page |
component |
@Component component |
componentv2 |
@ComponentV2 component |
state |
@State property |
local |
@Local property |
param |
@Param property |
builder |
@Builder method |
foreach |
ForEach with a key function for strings. Adapt the key function for other item types. |
column / row |
Layout container |
onclick |
Click handler |
Snippets are disabled inside comments and strings. Choose V1 or V2 snippets based on your project's API version and state management model.
Validation and packaging
The build command validates the XML and JSON resources and packages the snippets. To test the syntax in Sublime Text, use an isolated portable copy. Copy the package resources to Data/Packages/ArkTS and the engine check to Data/Packages/User, then launch that copy. The script writes Data/arkts-test-results.json and exits Sublime Text. Confirm that its errors list is empty.
Open the sample file to try nested components, template interpolation, chained calls, indentation, snippet placeholders, and folding.
On November 30, 2026, all 43 engine checks passed on Windows with Sublime Text 4 build 4200. Colors depend on your selected color scheme. macOS and Linux have yet to be verified. Recorded results
Limitations
Highlighting uses syntax rules. Uppercase calls are highlighted as components or constructors, and generic angle brackets use operator scopes. Regular expression detection is conservative and does not parse nested Unicode v character sets. The symbol list covers common declarations. Methods with object literal parameter types, interface signatures without semicolons, and anonymous arrow functions may be omitted.
Type checking, semantic completion, diagnostics, formatting, builds, debugging, and ArkUI previews are outside the scope of this package.
See the changelog, initial plan, and Package Control release guide.