https://github.com/roman01la/structed
Structured editing for JavaScript
https://github.com/roman01la/structed
structured-editing syntax-aware
Last synced: 9 months ago
JSON representation
Structured editing for JavaScript
- Host: GitHub
- URL: https://github.com/roman01la/structed
- Owner: roman01la
- Created: 2018-05-29T18:16:06.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-04T10:02:46.000Z (over 7 years ago)
- Last Synced: 2024-12-24T17:37:11.751Z (over 1 year ago)
- Topics: structured-editing, syntax-aware
- Language: JavaScript
- Homepage: https://roman01la.github.io/structed/
- Size: 369 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Structured editing for JavaScript
- Core library `src/index.js`
- Example `index.html`
## Features
- Hierarchical navigation (expand/shrink selection or cursor position)
- Manipulate nodes instead of plain text (copy/cut)
## Editor plugins
- [VS Code](https://github.com/roman01la/vscode-structed)
## Editor integration guide
Structed's core library is a set of functions that walk AST and return location data for selection or cursor position to be set. It can work with any JS-based editor. See how it is used in [VS Code](https://github.com/roman01la/vscode-structed/blob/master/src/index.js) extension.
## How it works
Because JavaScript’s source code is represented as plain text we need to parse it into AST first (structured representation of the code). And then analyze AST, with respect to cursor position in the editor, and compute selection range for AST nodes that should be “in focus” by walking the structure and extracting location data.
## TODO
See [Paredit guide](http://danmidwood.com/content/2014/11/21/animated-paredit.html)
- [x] `forward`
- [x] `backward`
- [ ] `forward-up`
- [ ] `forward-down`
- [ ] `backward-up`
- [ ] `backward-down`
- [ ] `wrap-[round|square|curly|angle]`
- [ ] `forward-delete`
- [ ] `forward-kill-node`
- [ ] `backward-delete`
- [ ] `backward-kill-node`
- [ ] `kill`
- [ ] `forward-slurp`
- [ ] `backward-slurp`
- [ ] `forward-barf`
- [ ] `backward-barf`