twinBASIC Update: July 4, 2021

Highlights include support for EXE/DLL embedded resources plus *LOTS* of code writing experience improvements, like rename refactoring, auto-indent, etc.

twinBASIC Update: July 4, 2021

Happy Birthday, America!


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.


Highlights

Support for EXE/DLL embedded resources

Resources can now be embedded in EXEs and DLLs:

As of v0.10.2773, twinBASIC now supports embedding of resource data and files into the generated EXEs and DLLs.   The twinBASIC virtual file system is used to categorize the resources, and so we won't be needing a separate 'resource editor' like we had in VB6.

String tables for localization

You can also create string tables for easier localization (i.e., language translations). Support is currently via raw JSON files, but an editor is forthcoming.

Image source: Wayne Phillips

Code writing experience improvements

There were lots of improvements to the general code-writing experience this week, including:

Paste code as comment

Sometimes you want to paste text as a comment and you don't want the automatic code prettifier to "fix" it for you.  You now have the option to paste as a comment via the right-click context menu or the default hotkey, Ctl + Shift + V.

Rename refactoring support

twinBASIC now supports intelligent renaming of symbols (variable names, procedure names, etc.).  Unlike a traditional find and replace, rename refactoring only changes instances of the actual symbol (not just any arbitrary matching text).  The feature is not yet perfect, so report any edge cases that you find.

To use the function, place the cursor on the symbol to change and press F2.

Image source: Wayne Phillips

Auto-indenting

After pressing enter at the end of the first line of a code block, twinBASIC will indent the following line of code automatically.

Image source: Wayne Phillips

Auto-closing of blocks

When you press enter after the start of a code block, twinBASIC will now automatically close it.  VBA does this for functions and subroutines, but twinBASIC expands the feature to include all code blocks.

Image source: Wayne Phillips

Block-based code folding

Block-based code folding uses semantic information about the language syntax to fold and unfold blocks.  For example, folding a Do While line will hide all the code up through the corresponding closing Loop line.  Prior to this improvement, twinBASIC relied on indentation to perform naive code folding.  This was better than nothing, but block-based code folding is a welcome addition.

Image source: Wayne Phillips

Region support for code folding

As seen in VB.NET:

Image source: Wayne Phillips

Around the Web

Call for code-editing improvement ideas

Many of the highlights this past week had to do with improvements to the code editing experience.  Before moving on to the next stage of the project, Wayne put out a call for any other similar requests:

If you can think of any little things, no matter how small, that would help with your code editing experience with tB, do please open an issue feature request for consideration.

Use this link to open a new issue on the twinBASIC GitHub page.

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.10.3423, 4th July 2021]

[v0.10.3412, 3rd July 2021]

[v0.10.3377, 2nd July 2021]

[v0.10.3334, 2nd July 2021]

[v0.10.3333, 1st July 2021]

  • added: rename refactoring support (press F2). Some edge cases not yet working, e.g. generics/named arguments/default values

[v0.10.3256, 1st July 2021]

[v0.10.3234, 30th June 2021]

[v0.10.3229, 30th June 2021]

[v0.10.3227, 30th June 2021]

[v0.10.3212, 30th June 2021]

[v0.10.2914, 29th June 2021]

[v0.10.2822, 28th June 2021]

All original code samples by Mike Wolfe are licensed under CC BY 4.0