Introducing Better Code Editor (BCE)

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:

  1. Introducing BCE. This shows the demo in action and what you can do with the control
  2. BCE - Under The Hood. This video goes into a bit more detail about the architecture of the control.

Requirements

  1. The minimum supported Xojo version is 2021 Release 3 (2021r3).
  2. The BCE control can only be added to a DesktopWindow (introduced in 2021r3). This is not a technical limitation but a resource limitation.
  3. You must install Björn Eiríksson’s free open source TextInputCanvas Xojo plugin (Einhugur Software - Open source projects).
  4. 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.

4 Likes

Some classes are missing:


And then I got an error:

Did you read the README in the repository? You need additional components:

What version of Xojo are you using? You need to use Xojo 2021 Release 3.

1 Like

Of course, I did not read the readme. When I open a project I don’t want to download other stuff. Let alone 4 projects.

Seriously how rude can one get.

3 Likes

then why even try open source projects?

@Garry has obviously put a lot of effort into this. so I would think you could manage to spare som time to download the needed stuff, and at least read the README…

2 Likes

That’s a cultural difference between at least Java Developüers which all days downloading some libs for Code from third parties and working with it. All the readies have to be known while there are some important informations inside. For example how to setup the Code for using a Lib. Xojo Customers are used to get full set of working Software Parts which they have nothing to do except install once. So they have their Xojo and their Adonis (a few where they pay much money for) and then they are working with it.

I know no Java Developer which is doing it like that. But…what shall I say, there is the Xojo world which is different. As far as I know from my every days work C and C++ and even C# are not better, PHP also not, Python also not. But Xojo has this Idea that once installed never download anything else beside the IDE and the Adonns. I had many discussions exactly around this Idea of Software writing and the impossibility to do it in the Java World. It was not really helping.

I download code and then I want to use the code. The same happened on the other forum.

It has not to do with the Forum Beatrix. It has to do with the willing of. You do not want to. It’s okay. But not okay in my eyes is to download and not to read even the readme file. The author has done a good Job and wanted to give it to the community. That makes it really simple: possibly you could accept that especially while it is so that even the enormous knowledge you have will not let you know what’s inside of the Readme. That isn’t a customers tool, it is a programmers tool. And I really deeply believe that this says also that I can await that a programmer reads the readme.

1 Like

Even had I read the Readme I still expect all code needed to run a project IN the project. I read the requirements which stated to install the TextInputCanvas.

It’s okay. I don’t expect developers to be user friendly when they want others to use their projects.

That’s not the point beatrix. I understand that you want it to run after download. On the other side it is a non commercial project though…

I’ve tried my best @beatrixwillius. I did make two YouTube videos explaining it and wrote a lengthy README.

I have added a binary project to the repository (src/Legacy Binary Project). I won’t be updating the binary project moving forwards but you should just be able to run that without worrying about the dependencies.

That is a very generous response to Beatrix. It is probably fair to say that there may be a cultural element in her desire to have something work out of the box and not have a need to RTFM. The good thing about this forum is that people can say what they think, and not be overly judged for it. I haven’t instaleld the BCE yet, but found the two videos well presented and easy to follow. Great work on your part, and the editor looks very impressive.

2 Likes

Great work, Garry! I’m glad you’re getting use out of the TextInputCanvas and FTC.

1 Like

That is pretty impressive - thank you for sharing!

1 Like