Catalog · How the catalog works
CodeEdit
Code Editor Component For Delphi
- ★ 1 on GitHub
Anyone may press Interesting, signed in or not. It helps others find this project.
README
CodeEdit
Native Delphi/VCL code editor component. No third-party dependencies — just the RTL and VCL.
Released under the MIT License. If you use CodeEdit in your project, attribution is appreciated.
Features
- Owner-drawn editor with gutter, line numbers, and theme-aware painting
(follows the active VCL style, with an
OnResolveThemehook for other skinning systems) - Pluggable syntax highlighting with ten bundled languages and correct multi-line constructs (block comments, template literals, triple-quoted strings)
- Code completion and signature help driven by a provider component
- Code templates on Ctrl+J — per-language snippet expansion with caret placeholder; user templates layer on top of the app's built-in set (JSON persisted, editable in a built-in dialog, overrides by name)
- Find/replace panel with match-case, whole-word, and regex modes; results stay in sync while editing
- Multi-caret editing (Ctrl+D / Ctrl+Shift+L), word navigation, indent/unindent, line commenting
- Breakpoints, execution-line arrow, executable-line dots, and error/warning line markers for debugger hosts — design-time editable, 1-based, edit-tracked
- Undo/redo with typing coalescing that also restores breakpoints,
execution line, and the
Modifiedflag - Word wrap (optionally indenting continuation rows), minimap (with hover preview), styled scrollbars, bracket matching, occurrence highlighting
- Printing:
TCodeEditorPrinterwith syntax colours, line numbers, header/footer macros, word wrap, print dialog and a built-in preview - User settings:
TCodeEditorSettingskeeps an editor's preferences under HKCU and shows an options dialog with live preview and import/export
Documentation
- TCodeEditor reference — properties, methods, events, options, theming, full keyboard table
- Highlighters — bundled languages, token model, writing your own highlighter, the multi-line state contract
- Completion and signature help — provider API and context records
- Code templates — Ctrl+J templates, the provider component, placeholder syntax, and the template editor dialog
- Breakpoints and line markers — the debugger-host surface
- Printing —
TCodeEditorPrinter, options, macros, preview, drawing pages on your own canvas - Settings —
TCodeEditorSettings, the HKCU persistence, the options dialog and import/export
Units
Source\CodeEdit.Editor.pas—TCodeEditorSource\CodeEdit.Completion.pas— completion/signature providers and a keyword providerSource\CodeEdit.Highlighter.pas— token model and highlighters for Delphi, JavaScript, SQL, Tungli, Batch (BAT/CMD), PowerShell, INI, YAML, and PythonSource\CodeEdit.Templates.pas— code template model andTCodeTemplateProviderSource\CodeEdit.TemplateEditorDlg.pas— runtime/design-time template editor dialogSource\CodeEdit.Print.pas—TCodeEditorPrinterand the print previewSource\CodeEdit.Settings.pas—TCodeEditorSettings(HKCU persistence, import/export) andSource\CodeEdit.SettingsDlg.pas— its options dialog formSource\CodeEdit.DevExpressTheme.pas— optional DevExpress skin bridge (add to apps directly; not part of the package)Source\CodeEdit.Register.pas— registers everything on theCodeEditpalette pagePackages\CodeEditVcl.dpk— design-time packageSamples\VclDemo— demo applications (CodeEditDemo,CodeEditDemo2)Samples\DxDemo—CodeEditDemo2with DevExpress skins: skin picker, the skin bridge keeping the editor's colours in step, and the settings dialog's "Follow the DevExpress skin" choice (needs DevExpress VCL)Tests\TestHighlighterState.dpr— console regression test for the multi-line tokenizer state
Quick start
Install Packages\CodeEditVcl.dpk (or just add Source to your library
path), then drop a TCodeEditor and a highlighter on a form:
CodeEditor1.Highlighter := DelphiCodeHighlighter1;
CodeEditor1.Lines.LoadFromFile('Demo.pas');Completion is one event away:
CodeEditor1.CompletionProvider := KeywordCompletionProvider1;
KeywordCompletionProvider1.Keywords.CommaText := 'begin,end,procedure,function';Caret and scroll positions are 0-based; breakpoints, line markers, and
ExecutionLine are 1-based to match the gutter. See the
editor reference for the details.
Host integration in five lines
CodeEditor1.Options.LineCommentPrefix := '--'; // language-specific
CodeEditor1.OnCaretChange := UpdateStatusBar; // 0-based position
CodeEditor1.OnBreakpointsChanged := SyncInterpreter; // 1-based lines
CodeEditor1.ExecutionLine := Interpreter.CurrentLine; // current statement
CodeEditor1.Modified := False; // after savingMost settings are published properties, so form storage systems persist the editor directly.
Roadmap
- Per-breakpoint enabled state and conditions
- Diff-based undo storage and virtualized rendering for very large files
- IME composition-window positioning
- Diagnostics API (squiggles) and symbol navigation hooks
- Possible Delphi 7 compatibility pass (the code currently uses unit namespaces, generics, character helpers, and VCL styles)
Changelog
See CHANGELOG.md.

