Skip to content
PerryTSPublic

About

PerryCode: an extension-free trim of VS Code (Code - OSS) compiled ahead of time by Perry and run natively on Perry Feather (macOS, iOS, iPadOS)

Resources

Stars

7 stars

Watchers

0 watching

Forks

Repository files navigation

PerryCode

A trimmed, extension-free build of VS Code (Code - OSS 1.148.0) made to be compiled by Perry and run on Perry Feather: one renderer bundle, no extension host, no Node in the renderer, no WebAssembly, no web workers, no code created at run time, and no npm packages at run time.

It is still the real VS Code workbench, in the classic desktop look (Dark Modern, menu bar, flat panes): explorer, tabs and split editors, the Monaco editor with all its built-in editing features, quick open, command palette, Find in Files with replace, the Search Editor, the integrated terminal, settings and keybindings editors, color themes, file icons, snippets, problems and output panels. Folders open through native dialogs, recent folders and the command line, each window on its own folder.

Quick start

npm install          # esbuild + electron, and node-pty for the terminal's host part
npm run build        # dist/ (readable, with source map); npm run build:min for the 8 MB build
                     # --target ios|minimal picks another feature set (features.json)
npm start -- /path/to/folder   # while it runs, another `npm start -- <folder>` opens a new window
npm test             # Perry audit + scripted Electron scenarios
npm run perry:check  # `perry check` over the bundle

npm start runs the bundle in stock Electron 44.5.1 (the same version Feather's Electron oracle uses), which is the reference behaviour for the native build.

What is in dist/

File What
index.html, workbench.js, workbench.css, media/*, extensions/theme-seti/icons/seti.woff The renderer. One ES module, 15 MB readable / 8 MB minified, no other script is ever loaded.
main.cjs Electron main process: windows, application menu, file system bridge, native dialogs, host parts of feature modules. Uses electron (app, BrowserWindow, ipcMain, dialog, Menu, shell) and node fs, path, os.
preload.cjs Installs the host bridge with contextBridge + ipcRenderer.

The renderer talks to the machine only through window.perrycode (contract in src/perrycode/common/host.ts): a promise based file system (stat, readdir, readFile, writeFile, mkdir, delete, rename, copy, watch), the home and user data directories, openExternal and setTitle, and optional capabilities: dialogs (native open/save), windows (new window) and features.<name> (host parts of feature modules). A host leaves out what it cannot do and the workbench degrades: without dialogs it uses its own quick-pick file dialog, without windows a new window is a new browser tab. Without that object the same bundle runs on an in-memory demo workspace (PERRYCODE_NO_HOST=1 npm start), which is the cheapest first target on a new host: it needs no desktop bridge at all.

User data lives in ~/.perrycode (PERRYCODE_USER_DATA overrides it): User/settings.json, User/keybindings.json, User/snippets/ as plain files, and Chromium's profile under host/. UI state (open editors, layout, recent files) is stored in IndexedDB; if IndexedDB is missing the workbench falls back to memory and simply forgets that state.

How it differs from VS Code

Upstream PerryCode Why
Extension host, marketplace, extension management None. Themes, file icons, language definitions and snippets of the code-free built-in extensions are compiled into the bundle and fed to the same extension points (browser/builtinExtensions.ts). Extensions are code loaded at run time.
TextMate grammars on oniguruma (wasm), tree-sitter (wasm) Monarch tokenizer from the editor sources with monaco-editor's grammars, 50 language ids; VS Code color themes are applied through a token-to-scope table (languages/tokenization.ts). No WebAssembly engine; the oniguruma path gives wrong tokens on Perry today.
Web workers started from a Blob of generated source The editor worker and the output link detector run in the UI thread behind the same protocol (browser/inProcessWorkerService.ts). A Blob worker is code that only exists at run time.
ripgrep / search worker Search over the file service, with .gitignore, excludes, cancellation (browser/fileServiceSearch.ts). No child processes, no workers.
Native file dialogs Native dialogs through the host's optional dialogs capability; the workbench's own quick-pick dialog where the host has none (or with files.simpleDialog.enable). A host can start without a dialog API.
Optional npm modules loaded at run time (iconv-lite, jschardet, external diff, xterm.js) Removed, except xterm.js and six of its addons: vendored (src/perrycode/vendor/xterm) and imported statically by the terminal feature. No run time module loading.
Terminal: a pty host process with session persistence/revival and shell integration injection One PTY per terminal in the host, over the node-pty API (Electron: the npm package; Feather: Perry implements it natively). Terminals end with their window; no shell integration, so no command decorations, suggest or quick fixes. Not in the ios target (no processes on iOS). One process; same host code for Electron and Feather.
Keyboard layouts loaded by computed URL Literal imports (the only patch to an upstream file, patches/vscode.patch). Same.
Telemetry, experiments, update checks, accounts, settings sync Not present; the services answer "not available" (browser/nullServices.ts). The renderer makes no network request. Contained.
Chat/agents, notebooks, debug, source control, tasks, testing, remote, webviews, outline, language detection Not included yet. Features come back as feature modules (src/perrycode/features/README.md has the recipe and the plan for git). Each needs an extension host, a process, or wasm.
Modern UI (floating cards, 2026 themes, hamburger menu) on by default Classic defaults: workbench.experimental.modernUI: false, Dark Modern / Light Modern, window.menuBarVisibility: classic, Accounts button hidden (CLASSIC_DEFAULTS in browser/main.ts). All ordinary settings. The familiar desktop VS Code.

Consequences worth knowing:

  • No language intelligence. There is syntax coloring, bracket matching, folding by indentation, word-based completion, snippets, comment toggling and auto-indent, but no IntelliSense, diagnostics, go to definition or formatting: in VS Code all of that comes from extensions.
  • Encodings: UTF-8 (with or without BOM) and UTF-16 only.
  • One folder per window. Opening another folder in the same window reloads it with ?folder=<path>; New Window and "open in new window" ask the host for another window. Multi-root workspaces are not supported.
  • Diffing and search run on the UI thread. Fine for normal files; a very large diff or a search over a huge tree will block input while it runs.
  • Languages VS Code ships without a matching Monarch grammar (for example Makefile, LaTeX, Groovy, diff, log) open with their language mode, brackets and comments, but uncolored.
  • One entry point to a removed feature is still visible and does nothing: "Browse Color Themes in Marketplace".
  • On macOS the workbench draws the title bar (menus, command center) under the window's traffic lights; the native menu only has the application, clipboard and window items, so that no native shortcut takes one the workbench uses (⌘W closes the editor, not the window).

Perry friendliness

npm run perry:audit scans the built bundle and fails on: eval, the Function constructor, string timers, WebAssembly, run time import(), Worker, importScripts, document.write, script element injection, service workers and javascript: URLs. Current result: none. It also lists, for information, the constructs that are legal but worth knowing about on a young runtime: Proxy (6 sites: dependency injection of delayed services, tree sticky scroll, the worker protocol), WeakRef (3), IndexedDB, one Blob URL (file download) and one function-source toString(). It also lists two fetch hits, but those are methods named fetch, not network calls.

npm run perry:check runs perry check on the bundle. With Perry 0.5.1663 the whole bundle parses and lowers with 0 errors in about 22 seconds; the only diagnostics are 23 browser globals that stock Perry does not know and the Feather host provides (document, navigator, KeyboardEvent, MouseEvent, ResizeObserver, MutationObserver, IntersectionObserver, indexedDB, customElements, ClipboardItem, FileReader, OffscreenCanvas, Notification, Audio, Animation, CSS, DOMRect, Node, ErrorEvent, UIEvent, TextUpdateEvent, GPUBufferUsage, GPUTextureUsage).

With Perry 0.5.1663 the desktop target (Search Editor and terminal features) still checks with 0 errors; xterm.js adds five host globals (DOMMatrix, ImageData, Path2D, WheelEvent, window), 28 in all, every one a standard Blink API. The terminal's host part (src/perrycode/features/terminal/main.ts, electron + fs + path + node-pty) passes perry check too.

Status (2026-11-30): Perry compiles PerryCode ahead of time into native code, and it runs on Perry Feather with no JavaScript engine in the app. It runs on macOS, on an iPhone 16 Pro, and on an iPad Pro, where touch and the keyboard work. The native app does not provide the window.perrycode bridge yet, so it runs on the in-memory demo workspace: edits are not written to disk.

Layout

src/perrycode/                 everything written for PerryCode (about 2,400 lines)
  workbench.main.ts            the curated core module list: what is not imported here (or by an
                               enabled feature module) is not in the product
  features/                    feature modules: upstream features brought back one by one, chosen per
                               target in features.json (README.md there: how to add one)
  browser/main.ts              renderer start-up (replaces upstream's web.main.ts)
  browser/*.ts                 host file system, search, in-process workers, built-ins, null services
  languages/                   Monarch grammars (vendored from monaco-editor) and theme bridge
  builtin/                     generated: themes, icon theme, language definitions, snippets
  vendor/xterm/                xterm.js 6.1 beta + addons, ESM builds (MIT), for the terminal
  stubs/vs/**                  37 stand-ins that replace upstream modules of the same path
  electron/                    main (windows, menu), fs, dialogs, preload
  common/host.ts               the host bridge contract
src/vs/                        vendored upstream sources: exactly the files the bundles of all targets use, about 2,100 (MIT)
patches/vscode.patch           the one change made to an upstream file
scripts/                       build, test, audit and maintenance tools
features.json                  feature modules per build target (desktop, ios, minimal)
upstream.lock.json             pinned upstream revisions

Trimming mechanism

Kept upstream code imports small things (a context key, a service id, a class for instanceof) from features that are not wanted, and those imports drag in megabytes. Instead of editing upstream files, a file at src/perrycode/stubs/vs/<path> replaces upstream src/vs/<path> at build time and exports only what kept code uses; a stub that misses a name fails the build. Services behind those ids get explicit "not available" classes in browser/nullServices.ts.

Useful tools while changing the trim:

npm run size                                   # bundle size by source area
node scripts/audit.mjs why contrib/chat/       # shortest import chain into an area
node scripts/boundary.mjs 'contrib/(chat|notebook)/'   # every edge from kept code into an area
node scripts/smoke.mjs --scenario scripts/scenarios/missing.cjs && node scripts/service-usage.mjs
                                               # services that bundled code injects but nobody provides

Updating upstream

src/vs and src/perrycode/builtin are generated from pinned checkouts that are not part of this folder's sources (upstream/ is ignored):

git clone --depth 1 --branch 1.148.0 https://github.com/microsoft/vscode.git upstream/vscode
git clone --depth 1 --branch v0.58.0 --filter=blob:none --sparse https://github.com/microsoft/monaco-editor.git upstream/monaco-editor
git -C upstream/monaco-editor sparse-checkout set src/languages/definitions
git -C upstream/vscode apply ../../patches/vscode.patch
# codicon.ttf comes from the @vscode/codicons package pinned in upstream.lock.json:
#   copy dist/codicon.ttf to upstream/vscode/src/vs/base/browser/ui/codicons/codicon/
npm run gen:builtins      # themes, language definitions, snippets, Monarch grammars
npm run vendor            # link upstream, build every target, copy the files they use into src/vs
npm run vendor -- --link  # or: develop against all of upstream (src/vs becomes a symlink)

After moving to a new VS Code version, update upstream.lock.json, expect a round of missing stub exports (build errors) and missing services (scenarios/missing.cjs), then npm test.

Licenses

VS Code sources (src/vs), the built-in extension data and the Monarch grammars are copyright Microsoft Corporation, MIT licensed (src/vs/LICENSE.txt). Codicons are CC BY 4.0. The Seti file icon font is MIT (jesseweed/seti-ui). PerryCode is not a Microsoft product and does not use the Visual Studio Code name, logo or marketplace.

About

PerryCode: an extension-free trim of VS Code (Code - OSS) compiled ahead of time by Perry and run natively on Perry Feather (macOS, iOS, iPadOS)

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages