{"id":13769885,"url":"https://github.com/Gregoor/tofu","last_synced_at":"2025-05-11T02:33:47.425Z","repository":{"id":46170380,"uuid":"160121525","full_name":"Gregoor/tofu","owner":"Gregoor","description":"Experiment in structural code editing","archived":false,"fork":false,"pushed_at":"2024-03-08T00:52:37.000Z","size":900,"stargazers_count":99,"open_issues_count":15,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-08-03T17:08:52.342Z","etag":null,"topics":["code-editor","projection-editor","structured-editing"],"latest_commit_sha":null,"homepage":"https://marketplace.visualstudio.com/items?itemName=watware.tofu-vscode","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gregoor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":"FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["Gregoor"]}},"created_at":"2018-12-03T02:32:52.000Z","updated_at":"2024-05-15T15:12:24.000Z","dependencies_parsed_at":"2024-08-03T17:02:41.595Z","dependency_job_id":null,"html_url":"https://github.com/Gregoor/tofu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregoor%2Ftofu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregoor%2Ftofu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregoor%2Ftofu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregoor%2Ftofu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gregoor","download_url":"https://codeload.github.com/Gregoor/tofu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225004693,"owners_count":17405659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-editor","projection-editor","structured-editing"],"created_at":"2024-08-03T17:00:32.498Z","updated_at":"2024-11-17T05:31:47.202Z","avatar_url":"https://github.com/Gregoor.png","language":null,"funding_links":["https://github.com/sponsors/Gregoor"],"categories":["TypeScript","Structural code editor projects"],"sub_categories":[],"readme":"# Tofu: [post-stone age coding](https://dflate.io/state-of-tofu)\n\nTofu is an experimental [VSCode](https://code.visualstudio.com/) extension for **structured-yet-fluid** code writing with JavaScript and TypeScript.\n\nIts goal is to provide more semantically meaningful code transformations while also offering escape hatches for direct literal code editing. A secondary goal is to minimize moments of broken syntax.\n\n## Caveats\nGiven my limited resources of time, I sacrifice efficiency at the altar of iterating on the idea. Tofu re-parses the whole file on every edit, using [Babel](http://babel.io/) and formats it with [Prettier](https://prettier.io/) after most actions. This is not incremental, and costly for large files. In the short-term I make it work by not having large file, which I tend to favor anyway.\\\nIn the longer term, I'd love for Tofu to use an incremental parser like [TreeSitter](https://tree-sitter.github.io/tree-sitter/) instead.\n\nIn terms of experience, depending on where you are coming from, this might be a radical change to how you usually code. Forget thinking about code style or managing syntax and slide into the world of literal structural editing.\n\n## Actions\n\nThe **keymap** is designed to be familiar and literal. These are the basic actions which are usable in most contexts:\n\nAction | Key(s)\n--- | ---\n**Cursor** |\nMove | \u003ckbd\u003e←\u003c/kbd\u003e \u003cbr/\u003e \u003ckbd\u003e↑\u003c/kbd\u003e \u003cbr/\u003e \u003ckbd\u003e→\u003c/kbd\u003e \u003cbr/\u003e \u003ckbd\u003e↓\u003c/kbd\u003e\nJump | \u003ckbd\u003e⌥ Alt\u003c/kbd\u003e \u003ckbd\u003e←\u003c/kbd\u003e \u003cbr/\u003e \u003ckbd\u003e⌥ Alt\u003c/kbd\u003e \u003ckbd\u003e→\u003c/kbd\u003e\n**Selection** | \u003ckbd\u003e⇧ Shift\u003c/kbd\u003e +\nExtend  | + \u003ckbd\u003e↑\u003c/kbd\u003e\nShrink | + \u003ckbd\u003e↓\u003c/kbd\u003e\nNeighbors | + \u003ckbd\u003e←\u003c/kbd\u003e \u003cbr/\u003e + \u003ckbd\u003e→\u003c/kbd\u003e\n**Add new line** | \u003ckbd\u003e⏎ Enter\u003c/kbd\u003e (below) \u003cbr/\u003e \u003ckbd\u003e⇧ Shift\u003c/kbd\u003e \u003ckbd\u003e⏎ Enter\u003c/kbd\u003e (above)\n**Wrap**  | \u003ckbd\u003e⌥ Alt\u003c/kbd\u003e \u003ckbd\u003e↓\u003c/kbd\u003e (Select) \u003cbr/\u003e \u003ckbd\u003e(\u003c/kbd\u003e (Parenthesize) \u003cbr/\u003e \u003ckbd\u003e{\u003c/kbd\u003e (Object) \u003cbr/\u003e \u003ckbd\u003e[\u003c/kbd\u003e (Array) \u003cbr/\u003e \u003ckbd\u003e\u003e\u003c/kbd\u003e (Function) \u003cbr/\u003e \u003ckbd\u003e\u003c\u003c/kbd\u003e (JSX)\n**Unwrap**  | \u003ckbd\u003e⌥ Alt\u003c/kbd\u003e \u003ckbd\u003e↑\u003c/kbd\u003e\n**Move Node**  | \u003ckbd\u003e⇧ Shift\u003c/kbd\u003e \u003ckbd\u003e⌥ Alt\u003c/kbd\u003e \u003ckbd\u003e←\u003c/kbd\u003e \u003cbr/\u003e \u003ckbd\u003e⇧ Shift\u003c/kbd\u003e \u003ckbd\u003e⌥ Alt\u003c/kbd\u003e \u003ckbd\u003e→\u003c/kbd\u003e\n**Toggle Tofu (Escape hatch)** | \u003ckbd\u003eEsc\u003c/kbd\u003e\n  \nOn top of this there are around 50 contextual actions (and counting). A few examples:\n- `e` at the end of an `if`-block will add an `else` branch, placing the cursor within the new block\n- `l` at the start of a variable declaration will replace the kind (e.g. `const`) with `let`\n- many are small in nature such as `[` at the end of an expression inserting `[0]` instead to minimize broken syntactical states\n  \nI am sure there are many I have not thought of, so contributions in the forms of [new issues](https://github.com/Gregoor/tofu/issues) describing your expectations and wishes are greatly appreciated.\n  \nThe opposite is also true, Tofu makes assumptions about what the right action is in which context. Please [let me know](https://github.com/Gregoor/tofu/issues) where I have baked in assumptions which do not jive with your style.\n\nI will stop thinking of Tofu as an experiment once I and other users deem it a clear workflow improvement and the project has found a path towards monetary sustainability.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGregoor%2Ftofu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGregoor%2Ftofu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGregoor%2Ftofu/lists"}