https://github.com/stofte/fastformat
Sublime Text plugin that formats JSON files
https://github.com/stofte/fastformat
Last synced: about 1 year ago
JSON representation
Sublime Text plugin that formats JSON files
- Host: GitHub
- URL: https://github.com/stofte/fastformat
- Owner: stofte
- Created: 2020-08-14T22:29:30.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-17T11:56:23.000Z (almost 6 years ago)
- Last Synced: 2025-02-01T02:18:47.165Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
Fast Format for Sublime Text
============================
A project for playing around with Python to Rust interop in the context of
Sublime Text while still doing something useful. In this case formatting JSON files.
Usage:
- `test.bat` builds and runs the rust library using a python wrapper with some basic tests.
- `pack.bat` builds the rust library and creates a `FastFormat` directory which can be copied into the ST packages directory (usually `%APPDATA%\Sublime Text 3\Packages`.)
The package adds the `Fast Format` command to the command palette (Ctrl+Shift+P).
Performance
-----------
Tested on a single-line JSON file, formatting was averaged over 5 runs after an initial warm-up. Platforms were Windows 10 and ST 3.
| | 5MB | 15MB
|---------------------|-----------|-----------
| [JSON Reindent*](https://github.com/ThomasKliszowski/json_reindent) | 24.2 sec | 72.4 sec
| [JSTool (Notepad++)**](https://github.com/sunjw/jstoolnpp) | 0.87 sec | 2,69 sec
| Fast Format | 0.95 sec | 2.88 sec
*Added timers to the packaged code and numbers obtained this way
**AutoIt script is used to get as accurate numbers as possible.
TODO
----
- Support XML?
- Allow looser JSON parsing (bare keys, etc)?