twinBASIC Update: February 27, 2022

On April 23, 2021, I helped Wayne Phillips introduce the world to twinBASIC at the Access DevCon Vienna conference.  I boldly predicted that twinBASIC (along with the Monaco editor) would replace VBA and its outdated development environment by 2025.  With that goal in mind, this weekly update is my attempt to keep the project fresh in the minds of the VBA development community.

Every Sunday, I will be providing updates on the status of the project, linking to new articles discussing twinBASIC, and generally trying to increase engagement with the project.  If you come across items that should be included here, tweet me @NoLongerSet or email me at mike at nolongerset dot com.

Here are some links to get involved with the project:


Highlights

Form Designer Improvements

There were a bunch of developer quality of life improvements made to the twinBASIC form designer this week:

  • Form designer supports [CTRL]-key for multi-select
  • Color picker remembers the 8 most recently used colors in the custom palette
  • SVG image support (requires Inkscape, installed separately)
  • Unsaved changes in form designer are reflected when debugging/building
  • Form designer context menu looks more like a traditional Windows context menu

New options added to the form context menu:

  • "Lock all controls"
  • "Unlock all controls"
  • "Select all"

New options added to the selected control(s) context menu:

  • "Lock controls"
  • "Unlock controls"
  • "Align to grid"

Around the Web

A Third Option for a twinBASIC IDE?

Currently, the only supported IDE for developing in twinBASIC is VSCode.

This approach made it easy for Wayne to focus on building a rock-solid compiler without having to worry about simultaneously building a development environment from scratch.  VSCode has a robust ecosystem of extensions around it.  

However, there are some downsides.  The main issue is that the amount of customization available is limited.  This was less of an issue in the beginning, when GUI design was not a consideration.  The VSCode environment has also been met with criticism from VBx developers that were not already using VSCode for other work, as it's a major departure from the traditional VB6 IDE.

Several months ago, the long-term plans were updated to include a move to Theia, an open-source IDE forked from the VSCode project.  Theia is basically a less-locked-down version of VSCode.  Being a fork, it's generally several months behind VSCode in features, and there are likely VSCode extensions that won't run in Theia. On balance, the tradeoff seems worthwhile.  

Of course, building the actual twinBASIC customizations on top of Theia will take time, too.  Hence, the reason this is a long-term plan.

This week, though, Wayne played around with the idea of building a completely custom IDE using...twinBASIC itself.  

The main editor pane would be a WebView2 container control (coming soon to twinBASIC) that would use the Monaco Editor as the code editor (i.e., the same editor used in VSCode).  I should point out here that VSCode itself is written in Electron, which is basically just a wrapper around a standalone Chromium engine.  In other words, VSCode is using this same approach of building an editor around a web viewer control.

I'll let Wayne explain the benefits of the approach (quoted from the twinBASIC Discord server):

The main benefit of this approach over VS Code is that we get absolute full control over the UI and all the plumbing.  If we want toolbars... easy.  If we want modal dialogs... no problem, etc.   we gain full control over everything from the loading of the projects (e.g. not requiring a separate code-workspace file) right up to the UX.

Here's a quick mockup that Wayne put together:

Fully customized twinBASIC IDE Mockup...written in twinBASIC

One of the downsides is that VSCode extensions would be completely off the table.  On the other hand, custom extensions could be written in twinBASIC itself, rather than JavaScript/TypeScript as is required for VSCode/Theia extensions.  

Again, here's Wayne:

There'd be no chance of using existing extensions.  But... with twinBASIC being the 'host' here, it would offer new opportunities, by allowing creation of  extensions written in twinBASIC (rather than JS/TS).

I'd be interested to hear what extensions people here are using alongside twinBASIC in VS Code.

Shortly after writing up this section, Wayne posted a new discussion over on GitHub confirming that he will be moving in this direction in the near-term, with Theia support still planned at some point in the future (Theia itself is not quite capable enough to support twinBASIC at this time).

Here's the summary from Wayne's announcement:

To summarize, the plan is to now create a new, simple IDE built on cross-platform web-based technologies for our immediate needs. The VS Code extension will continue to be maintained and improved for those that want to use it that way.  The long-term plan is to move to Theia, though we will probably keep the new 'simple' IDE available as it has significantly fewer system requirements.

Changelog

Here are the updates from the past week.  You can also find this information by installing the twinBASIC VS Code extension and clicking on the Changelog tab of the extension page:

[v0.14.36, 24th February 2022]

[v0.14.35, 24th February 2022]

  • improved: form designer also now handles CTRL key for multi-select, the same as VBx [ https://github.com/WaynePhillipsEA/twinbasic/issues/706#issuecomment-1047204224 ]
  • improved: form designer now offers a Lock All Controls/Unlock all controls option in the form context-menu
  • improved: form designer now offers a Select all option in the form context-menu
  • improved: form designer now offers a View code option in the form context-menu
  • improved: form designer context menu now looks more like a traditional Windows context-menu

[v0.14.34, 24th February 2022]

[v0.14.33, 23rd February 2022]

[v0.14.32, 23rd February 2022]

[v0.14.31, 22nd February 2022]

[v0.14.30, 22nd February 2022]

[v0.14.29, 21st February 2022]

  • added: 'Lock controls'/'Unlock controls' option in the context-menu of selected controls in the form designer. State is stored with the form metadata
  • added: 'Align to grid' option in the context-menu of controls in the form designer