Skip to content
jbisfunPublic
forked from zed-industries/zed

About

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

40,894 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ycode

ycode is a fork of Zed that can be scripted in Lua. Its own code is a hook system, crates/lua_hooks. It lets plugins written in Lua intercept and replace any Zed action, add new actions and draw native gpui windows and dock panels. The rest of the editor is upstream Zed with a few small patches.

ycode is part of the jbisfun workspace, which is managed with pull. Most features live in plugins, not in this repo.

Lua hooks

Hook files are ~/.config/zed/hooks/*.lua and *.x.lua, plus one level of extension subdirectories (hooks/<ext>/). .x.lua files use directives modelled on Logos:

%hook editor
- Copy
  %log
  %orig
end
%end
  • %hook ns / - Action: wrap ns::Action (- * wraps the whole namespace). If a hook never calls %orig, the action is swallowed.
  • %new - Name(args): a new action, shown in the command palette.
  • %hookf point: wrap a hook point in the Rust code (e.g. client::authenticate, the automatic sign-in at startup).
  • %ctor, %group/%init, %log.

The Lua API (ycode.*, gpui.*) covers dispatching actions, a settings layer, the KV store, status-bar buttons, workspace folders, spawning processes and native UI elements (gpui.open_window, gpui.register_panel). LuaSocket comes embedded. Plugins are reloaded with ycode: reload hooks and never need a rebuild.

Plugins

Each plugin is its own repo, symlinked into ~/.config/zed/hooks/<name>/:

  • ycode-pull: pull's multi-repo Pull panel, sessions and jobs. It replaces Zed's git panel, which handles only one repo.
  • ycode-hermes: Hermes Agent as the agent, over ACP
  • ycode-idl: panel for the idl CLI
  • ycode-manager: enable/disable plugins
  • ycode-offline: turns off sign-in and the online features

Changes to Zed

Outside crates/lua_hooks, the patches are small and generic:

  • gpui: App::intercept_actions, a single slot that wraps every window and global action dispatch
  • zed: lua_hooks::init runs after all other inits. Startup sign-in goes through the client::authenticate hook point. The Lua C API is exported so require can load C modules.
  • settings: a plugin settings layer (SettingsStore::set_plugin_settings)
  • command palette: %new actions appear in the palette, and actions can be hidden
  • workspace: Lua dock panels (panel_index_for_id)
  • agent_ui: agent::SyncAgentThreads imports an ACP agent's existing sessions

Building

The build is the same as upstream Zed (Linux, macOS, Windows):

cargo build -p zed        # target/debug/zed

License

ycode is licensed like upstream Zed: GPL-3.0-or-later, with Apache-2.0 components where marked. See LICENSE-GPL and LICENSE-APACHE.

About

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages