Blog
All Blog Posts | Next Post | Previous PostFNC & VCL: The best of both worlds, part 2: Syntax highlighting memos
Tuesday, October 3, 2023
Intro
In today's fast-paced software development world, writing efficient and error-free code is crucial. To aid developers in this endeavor, syntax highlighting memos have become indispensable tools. In this blog article, we will explore two powerful options for syntax highlighting memos: the VCL TAdvMemo and the FNC TTMSFNCMemo. We will delve into their features, architectures, and guide you when to use them in your application development.
Syntax Highlighting Memos Features
Syntax highlighting memos offer a plethora of features that make coding easier and more efficient:
- Language Syntax-based Coloring: These memos colorize code based on the language syntax, making it easier to identify keywords, strings, numbers, comments and more ...
- Code Completion: They provide code completion suggestions as you type, reducing coding errors and speeding up typing code.
- Parameter Hinting: When working with functions or methods, these memos offer parameter hints, making it simpler to use the right arguments.
- Code Folding: Developers can collapse sections of code to focus on specific parts of the codebase.
- Code formatting: memos can automatically apply formatting to code based on code formatting rules.
- Breakpoints and Bookmarks: Easily mark important sections of your code with breakpoints and bookmarks.
VCL TAdvMemo
A first option TMS software offers to add a syntax highlighting memo to your applications is TAdvMemo. The VCL TAdvMemo is a custom control built specifically for the VCL framework. It is based on 100% native Object Pascal code for the Windows operating system and it offers a custom code rendering engine and interaction capabilities via mouse and keyboard with the code. Language specifications and color settings for syntax styles are defined in a separate class known as TAdvCustomMemoStyler. TAdvCustomMemoStyler is the base class from which many derived classes are available with the specific syntax rules settings for the different supported languages.
VCL TAdvMemo Additional Components
In addition to the core TAdvMemo control, there are several additional components that enhance its functionality:
- TDBAdvMemo: A DB-aware version of the memo control designed for database applications.
- TAdv*MemoStyler: Offers syntax highlighting for various programming languages, including Pascal, CSS, HTML, Basic, SQL, C#, Python, Perl, JavaScript, Lua, JSON, XML, INI, PHP, and more.
- TAdvCodeList: Provides a visual code snippet list component.
- TAdvMemoSource: Non-visual component for efficient memory management when editing multiple code files through a single TAdvMemo interface.
- TAdvMemoStylerManager: Manages multiple memo styler instances and invokes the correct syntax styler based on file extension when opening a file.
- TAdvMemoSpellChecker: Includes a spell-checking feature for TAdvMemo.
- TAdvMultiFileMemo: Control offering a full tabbed multi-file editing experience with virtually no code to write.
- TAdvMemoPDFIO: Offers PDF export capabilities for TAdvMemo (next to HTML & RTF export already built-in).
- TAdvMemoToolBar and TAdvMemoRibbonToolBar: Provide customizable toolbars for the memo control.
FNC TTMSFNCMemo
The FNC TTMSFNCMemo is a syntax highlighting memo designed for both VCL Windows applications and cross-platform development via the FireMonkey framework, Lazarus LCL framework or TMS WEB Core web framework. Its architecture is fundamentally different from the VCL TAdvMemo. TTMSFNCMemo is built upon a browser engine in which the JavaScript Monaco library exposes all code eding features. Note that the JavaScript Monaco library is the library that is the heart of the widely popular Microsoft Visual Studio Code IDE. It is a MIT licensed library, so fully safe to use in commercial applications. The number of languages supported by the Monaco library is huge:
plaintext | fsharp | msdax | restructuredtext | wgsl |
abap | freemarker | mysql | ruby | xml |
apex | go | objective-c | rust | yaml |
azcli | graphql | pascal | sb | json |
bat | handlebars | pascaligo | scala | |
bicep | hcl | perl | scheme | |
cameligo | html | pgsql | scss | |
clojure | ini | php | shell | |
coffeescript | java | pla | sol | |
c | javascript | postiats | aes | |
cpp | julia | powerquery | sparql | |
csharp | kotlin | powershell | sql | |
csp | less | proto | st | |
css | lexon | pug | swift | |
cypher | lua | python | systemverilog | |
dart | liquid | qsharp | verilog | |
dockerfile | m3 | r | tcl | |
ecl | markdown | razor | twig | |
elixir | mdx | redis | typescript | |
flow9 | mips | redshift | vb |
This language can be selected via a simple TTMSFNCMemo.Language property. Of course, in TTMSFNCMemnu, all commonly expected syntax highlighting code editor features are available: auto-completion, code-folding, code snippet insertion, bookmarks & breakpoint indicators, ... Uniquely available in TTMSFNCMemo is also the optional code mini-map. This is a rendered overview of the complete code file at the right of the memo for rapid code navigation. Of course, things like block selection, find & replace are all built-in.
Comparison
VCL TAdvMemo | FNC TTMSFNCMemo |
|
|
Webinar
We also held a webinar at TMS WebAcademy on this topic of syntax highlighting memos that you can view here:
Conclusion
The choice between these memos ultimately depends on your specific development needs and target platforms. Both tools excel at enhancing the coding experience and improving productivity. For both solutions, fully functional trial versions are included in TMS VCL UI Pack and TMS FNC UI Pack so you can test all benefits of these solutions without limitations!
Bruno Fierens
Related Blog Posts
-
FNC & VCL: The best of both worlds, part 1: Buttons
-
FNC & VCL: The best of both worlds, part 2: Syntax highlighting memos
-
FNC & VCL: The best of both worlds, part 3: Labels
-
FNC & VCL: The best of both worlds, part 4: Planners & Calendars
-
FNC & VCL: The best of both worlds, part 5: Lists
-
FNC & VCL: The best of both worlds, part 6: Ribbons & Toolbars
-
FNC & VCL: The best of both worlds, part 7: Grids
This blog post has received 1 comment.
All Blog Posts | Next Post | Previous Post
Hindermann Thorsten