Development
Build the editor, run the checks and exercise the frontend affected by a change. The source stays separate from THC's compiler and runtime.
Build and check
From the repository root:
cabal build all
cabal testNative windows, browser support and POSIX embedded terminals are enabled by default. Installation covers their native dependencies. To omit components, use the same opt-out flags for build and test:
cabal build all -f-window -f-web -f-terminal
cabal test -f-window -f-web -f-terminalThe test suite replays the desktop's pure transitions and checks files using real temporary directories, including encoding, permissions, symlinks and external changes. The suite also covers session handling and live editor context. Optional components add checks for browser transport, rendering assets and embedded terminals. A passing model check and an interactive frontend check establish different things; run the relevant frontend too.
Rendering previews
These previews use the actual Vty rendering output at 80 by 25 without starting an interactive terminal:
cabal run -v0 thc-edit -- --demo --snapshot
cabal run -v0 thc-edit -- --demo --scene menu --snapshot-html > menu.html
cabal run -v0 thc-edit -- --demo --scene help --snapshot-html > help.htmlThe HTML is a static preview. Available scenes are desktop, menu, about, gallery, split, open, tree, help, diff and preferences. Tools > Widget gallery exercises the dialog controls interactively.
Live language-server checks
With a compatible HLS and GHC on PATH:
cabal exec -- ghc -threaded -package thc-edit test/HLSLive.hs -o /tmp/thc-hls-live
/tmp/thc-hls-live
cabal exec -- ghc -threaded -package thc-edit test/EditorLive.hs -o /tmp/thc-editor-live
/tmp/thc-editor-liveThe source also includes native-input, terminal, DAP, browser and remote-session harnesses under test/ and tools/. Their setup depends on the component under test; consult the harness before running it against a live session.
Finding your way around
| Location | Responsibility |
|---|---|
app/Main.hs, src/THC/Edit/App.hs |
Startup, command-line options and effects |
Model.hs, Render.hs, Buffer.hs |
Desktop interaction, drawing and document state |
Files.hs, Reconcile.hs |
File access and external changes |
Tooling.hs, LSP.hs |
HLS integration |
Git.hs, GitOperations.hs |
Review, commits and background Git commands |
Conversation.hs, ACP.hs, AgentFiles.hs, EditorMCP.hs |
Conversations, provider protocol, editor-mediated files and live buffer context |
Terminal.hs, Consoles.hs |
Embedded terminal and process management |
Debugger.hs, DAP.hs |
Debugger interaction and protocol |
Window.hs, Web.hs, BrowserServer.hs |
Native and browser frontends |
Session.hs, Remote.hs, RemoteEndpoint.hs |
Session records, processes and connections |
RemoteTerminal.hs, RemoteWindow.hs, RemoteWeb.hs |
Terminal, native and browser session frontends |
Protocol.hs, Font.hs, cbits/, assets/ |
Display transport, fonts and native support |
The module filenames above are under src/THC/Edit/ unless a directory is shown. Architecture explains how they fit together.
Documentation and attribution
Build the documentation site with Pandoc and the separate Haskell generator:
make docs
make docs-checkThe site is written to build/site. The generator builds independently of the editor and checks local links, fragments and revision-pinned source links. The Documentation workflow rebuilds and publishes every push to main at ekmett.github.io/thc-edit. It can also be started manually from GitHub Actions.
Keep the README useful both on GitHub and as F1 Help. Put detailed workflows in the user guide, and keep design history in design/ and plans/. User documentation should name the action, menu or key needed to perform it.
Bundled font terms and provenance are in assets/fonts. Skylighting and its bundled grammar set are GPL-2 licensed; skylighting-core is BSD-3-Clause. These are editor dependencies. The Turbo Pascal UI museum records the interface reference.