twinBASIC Update: August 20, 2023

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

Support for ChartJS in IDE Tool Windows

Following up from last week, Wayne has continued adding capabilities to the IDE addin extensibility feature.

As of BETA 378, Wayne added a proof-of-concept tool window addin (Sample 11) that integrates a dynamic chart via Chart.js.  Here's a preview:

Wayne also made some quality of life improvements to the add-in development experience, as he described in Discord:

BETA 379:  the tb Addin project templates (Sample 10 / 11) now have a default build path of '${IdePath}\addins${Architecture}'.  This makes it easier to test out addins, since the built DLL will be put directly into the current IDE addins path.  As such, after building the DLL, just hit the compiler restart button to have the IDE load the addin.

ps.  to unload the addin, you can then hold the shift key whilst clicking the compiler restart button.  To further remove the addin use the Clean button (trash icon on the toolbar), which will delete the DLL from the addins folder.

Embed a Monaco Editor in an IDE Tool Window

BETA 381 added yet another sample ToolWindow (Sample 12) that demonstrates how to embed a Monaco editor.  

In the short term, this should allow for creating multiple code editor windows until proper multi-window support gets implemented.  Again, here's Wayne:

Once we've got the filesystem exposed, that at least opens up possibility of creating floating editors for those that like to have multiple editors on their big screens.  At least until proper integrated support for multi editors comes

Changelog Summary from ChatGPT

Here are the most notable changes from the weekly Changelog according to ChatGPT:

  • Improved stability: Addressed freezing issue caused by pasting code, ensuring a smoother IDE experience.
  • Enhanced event handling: Resolved compilation error related to event definitions in classes.
  • Performance boost: Fixed various floating-point code generation issues for improved overall performance.
  • Syntax enhancement: Corrected handling of line-feeds in TLB internal syntax generator.
  • Addin extensibility: Introduced new methods for Project (Save, Close, Build, Clean) to enhance addin capabilities.
  • Intellisense improvements: Further optimized intellisense performance for larger projects.
  • Advanced tool windows: Enabled creation of HTML-based tool windows for a more interactive experience, supporting Chart.js integration.

Discord Chat Summary

* Auto-generated via Claude-2-100k on poe.com

General Channel

Here are some key highlights from the attached Discord conversation about the development of the twinBASIC programming language:

  • twinBASIC is a new BASIC language intended to replace Visual Basic 6. It aims to provide improved OOP support compared to VB6.
  • Recent updates include fixing some parser issues, improving IDE performance, and adding auto-indenting for paste operations. There are still some known copy-paste bugs being worked on.
  • Threading is possible via Win32 APIs but native language support is still planned. Some users have shared example projects using threads.
  • There was discussion around exposing nested UDT types and whether it can mimic C struct definitions. Unclear if it will cause issues long-term.
  • Users are testing integration with Excel/Office via COM add-ins. There are some limitations currently with exposing UDFs to worksheets. The developer is investigating a provided VB6 sample that works.
  • Recent work has gone into porting a C++ math/rendering algorithm over to twinBASIC and debugging differences in division operators and array/matrix handling.

Overall, development seems active with regular updates and discussion around new features, compatibility with VB6 code, and potential future improvements.

IDE Add-ins Channel

Here are some key highlights from the attached Discord conversation about developing add-ins for the twinBASIC IDE:

  • Add-ins run in a separate thread from the IDE and compiler. Toolbars, menus, and events like project load can be customized.
  • New capabilities were added like accessing editor text, saving/closing files, executing IDE commands, and creating floating HTML tool windows.
  • Priorities for add-in features include global find/replace, memory tools, and unit testing. Access to project files and parsing info is desired.
  • HTML tool windows now support charts via Chart.js. Examples show dynamically updating CPU usage.
  • Tool windows can now embed Monaco code editors. Add-ins will be able to create floating code editors.
  • Building add-ins is easier with default output folder. Add/remove add-ins by restarting IDE and holding Shift.
  • Add-ins will be able to inherit IDE styling. Access to color themes is planned.
  • Support for Windows forms in add-ins is low priority. HTML approach is promoted as cross-platform ready.
  • Users are experimenting with add-ins like find/replace, statistics, and planning more features when full IDE access is available.

Around the Web

DirectComposition Effects Demo

fafalone is back with another twinBASIC demo project.  

This one is a port of the C++ DirectComposition Effects SDK example.  Among other things, this project highlights the fact that twinBASIC is more closely related to C++ than it is VB.NET.  (I'll be writing more on this topic in a separate article; stay tuned.)

Here's fafalone's summary from the twinBASIC show-and-tell Discord channel:

I started this project a while back but got stuck on some things so took a break, then got distracted by so many other projects. But yesterday I revisited it, and after fixing two of the major bugs pretty quickly, I couldn't resist working the rest out to cross the finish line. The result is a perfect replication of the C++ DirectComposition Effects SDK example, in twinBASIC with x64 compatibility. A couple other interesting things in the project, it's provisioned to have multiple demos, so the effects demo is spun off from a startup form in a new thread, and the startup form displays a log synchronized via a critical section. Also, to follow the SDK example as closely as possible at this initial proof of concept phase, the demo doesn't use a Form, it creates a whole window entirely from scratch using the Windows API, including manual management of the message pump. So it's worth checking out for more than the graphics work, as interesting as that is on it's own.
Project GitHub: https://github.com/fafalone/DirectComposition
Enjoy!

For additional context and information, fafalone posted about this project over at vbforums, too.

Changelog

Here are the updates from the past week.  You can also find this information by visiting the GitHub twinBASIC Releases page.

Releases · WaynePhillipsEA/twinbasic
Contribute to WaynePhillipsEA/twinbasic development by creating an account on GitHub.

WARNING: The following issue is present in BETA builds 202 - 3xx (the latest build as of publication):

  • there are known memory leaks in these versions, so memory usage will be higher than normal

BETA 375

  • fixed: (regression) edge case where pasting code into the IDE could cause a full IDE freeze
  • fixed: having an event definition as the last member of a class could cause a spurious "Unexpected end of procedure" compilation error [ Tecman, private ]
  • fixed: some floating point codegen edge cases [ uiwoow, discord ]
  • fixed: TLB internal syntax generator was not correctly handling line-feeds inside descriptions [ https://github.com//issues/1650 ]
  • added: (addin extensibility) Project.Save method
  • added: (addin extensibility) Project.Close method
  • added: (addin extensibility) Project.Build method
  • added: (addin extensibility) Project.Clean method

BETA 376

  • fixed: parser edge case in handling of Scale special syntax, not allowing comment on same line [ AlienSoft, private ]
  • added: (ide extensibility) Host.ToolWindows collection, allowing for creation of full HTML-based toolwindows (see updated Sample 10)

BETA 377

  • improved: further intellisense performance improvements in large projects [ fafalone, discord ]

BETA 378

  • added: (addin extensibility) support for chartjs (see www.chartjs.org) in ToolWindows (see Sample 11)

BETA 379

  • fixed: better error reporting when ActiveX control on a form/UC can't be matched to a referenced type library [ nextKast, private ]
  • fixed: serialization problem with some VBP imported projects with long text data stored in FRX [ nextKast, private ]
  • added: ${IdePath} environment variable for use in build path string in setting Project: Build Output Path
  • improved: tB addin templates now use ${IdePath}\addins\${Architecture}\ for the default build path

BETA 380

  • fixed: (addin extensibility) some issues marshalling Variants across to javascript, causing Sample 11 to fail when system decimal symbol is not a dot

BETA 381

  • improved: (addin extensibility) ToolWindows now support embedding Monaco editors (see Sample 12)

BETA 382

  • added: (addin extensibility) AddinTimer class
  • improved: (addin extensibility) modified Sample 11 chart demo to use the AddinTimer class rather than raw APIs
  • fixed: some bugs involving copy/paste in the IDE
  • improved: debugger now reports error '[DEBUGGER] error: no startup object is set.' when F5/play is used on a DLL with no startup object