I’m really pleased to announce the immediate availability of my Better Code Editor (BCE) Xojo control.
BCE is a free and open source drop-in code editor for desktop Xojo projects. It’s written in 100% native Xojo code and does not depend on any commercial third party plugins. It is fully API 2.0 compliant and therefore requires Xojo 2019r2.1 onwards.
The editor is a subclass of DesktopTextInputCanvas which requires the installation of the free and open source TextInputCanvas plugin from Einhugur Software. I have included this in the BCE GitHub repository.
BCE requires Xojo 2021r3 because it is a subclass of DesktopTextInputCanvas and not TextInputCanvas. I made this choice because I like to stay current with Xojo’s latest release and I don’t want to maintain two branches. I wanted to be able to use BCE on the new DesktopWindow classes introduced in 2021r3. In theory, there is no reason the control won’t work on Xojo versions from 2019r2.1 onwards but you will need to manually change the superclasses of several of the BCE helper classes.
Features
Rich JSON-based theme system to easily style the editor’s appearance and its textual contents
Support for a wide variety of programming languages through formatters written in Xojo
Different cursor styles (vertical bar, block and underscore)
Optional line numbering
Support for displaying invisible characters
Full support for non-ASCII characters such as emoji
Rich tokenisation system allowing for clickable tokens (e.g. URLs in code)
Support for highlighting delimiters around the cursor
Block highlighting with featuring highlighting of unclosed blocks
Hooks for autocompletion with easy-to-style suggestions popup
Support for setting breakpoints, bookmarks and compiler warning/error flags in the gutter
Actively maintained and updated for the new Desktop UI controls introduced in Xojo 2021 release 3
Works on macOS, Windows and Linux
Fast. Able to handle thousands of lines of code without slow down
Support for commenting / uncommenting out individual lines or blocks of code
Customisable undo/redo system
Can count total lines of code (or just lines of source code, excluding comments)
I’ve made two YouTube videos that might be of interest to you:
Introducing BCE. This shows the demo in action and what you can do with the control
BCE - Under The Hood. This video goes into a bit more detail about the architecture of the control.
Requirements
The minimum supported Xojo version is 2021 Release 3 (2021r3).
The BCE control can only be added to a DesktopWindow (introduced in 2021r3). This is not a technical limitation but a resource limitation.
You must use the Text datatype rather than String when interacting with BCE. This is because the native Xojo String datatype doesn’t handle emoji and other extended Unicode characters correctly (see [this Xojo forum thread][text thread]). I appreciate that Text is a deprecated datatype but according to Xojo’s CEO Geoff Perlman, it’s not going anywhere anytime soon.
Please let me know what you think of the control. It represents hundreds of hours of work and I’m very proud of it.
I wish Xojo handled external classes better than it does. I think the empty folders arise when you make a folder in the IDE containing external classes and then save in Xojo Project format. By default, Git doesn’t save folders with no contents.
They are in different repositories because I use them in loads of different projects. If you clone them and then point to them when the project loads, the IDE should stop complaining.
BetterDictionary is in my Xojo-Collections repo. It appears I omitted that from the README. Apologies, I’ve updated it now.
I record myself using the FaceTime camera and ScreenFlow added a filter to remove the background with a recent update. You can easily resize the FaceTime track and position it in the corner.
I might try and make a GitHub release tomorrow if I get a chance m with all the requirements internalised into a binary project to make it easier for people to try.
Cross platform desktop. Works on macOS, Windows and Linux. Developed on a Mac.
This is not a commercial project. Maybe if I’m lucky Xojo will see how much I care about the tool and give me a job
I totally forgot it was thanksgiving when I released this (I’m in the UK). Probably not the best day to launch a new project!
@Björn_Eiríksson: I’ve added a binary project to the repo (src/Legacy Binary Project/) that has all the classes internalised. You should just be able to run the project and it will work.
I don’t want to derail this thread with a rant about the new desktop controls. I wish they hadn’t been introduced but we are where we are. It should be pretty easy for you to get it working on the old Window controls (it was mostly developed in Xojo 2021r2). I think all you’ll need to do is change the super of BCECanvas to TextInputCanvas (instead of DesktopTextInputCanvas and change the super of BCEEditorContainer to be DesktopContainer instead of ContainerControl. You’ll probably also have to rename a couple of Opening events to Open.