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.
Code writing experience improvements
There were lots of improvements to the general code-writing experience this week, including:
- Paste code as comment
- Rename refactoring support
- Auto-indenting
- Auto-closing of blocks
- Block-based code folding
- #Region support for code folding
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.
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.
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.
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.
Region support for code folding
As seen in VB.NET:
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]
- fixed: default member evaluation in argument parenthesis [ https://github.com/WaynePhillipsEA/twinbasic/issues/262 ]
- fixed: removal of space during prettification of calls where the first argument had brackets [ https://github.com/WaynePhillipsEA/twinbasic/issues/239 ]
[v0.10.3412, 3rd July 2021]
- added: 'Paste as comment' option when editing tB code [ https://github.com/WaynePhillipsEA/twinbasic/issues/255#issuecomment-872988259 ]
- fixed: prettifier bug causing endless insertion of additional spaces [ https://github.com/WaynePhillipsEA/twinbasic/issues/255 ]
- fixed: VS code no longer auto-detects wrong indentation size from new legacy BAS/CLS files [ https://github.com/WaynePhillipsEA/twinbasic/discussions/257#discussioncomment-958027 ]
- fixed: rename-refactor now works as expected from API declare definitions and on ByRef parameters [ https://github.com/WaynePhillipsEA/twinbasic/discussions/253#discussioncomment-950234 ]
[v0.10.3377, 2nd July 2021]
- added: preliminary support for legacy .CLS and .BAS files [ https://github.com/WaynePhillipsEA/twinbasic/issues/257 ]
[v0.10.3334, 2nd July 2021]
- fixed: F5 key not starting debugging [ https://github.com/WaynePhillipsEA/twinbasic/issues/254 ]
[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]
- improved: InitCommonControlsEx is no longer called when the 'Is Console Application' project setting is on [ https://github.com/WaynePhillipsEA/twinbasic/issues/247 ]
- added: move to file refactoring option when the component name doesn't match the file name [ https://github.com/WaynePhillipsEA/twinbasic/issues/2 ]
[v0.10.3234, 30th June 2021]
- fixed: generated EXEs now call InitCommonControlsEx at startup automatically [ https://github.com/WaynePhillipsEA/twinbasic/issues/247 ]
[v0.10.3229, 30th June 2021]
- fixed: empty localization string table resource causing issues for ResourceHacker and older versions of Windows [ https://github.com/WaynePhillipsEA/twinbasic/issues/247 ]
[v0.10.3227, 30th June 2021]
- fixed: block-end auto-complete for procedures now adds param parenthesis if missing [ https://github.com/WaynePhillipsEA/twinbasic/issues/248 ]
- fixed: Debug.Assert behaviour in compiled EXE/DLLs [ https://github.com/WaynePhillipsEA/twinbasic/issues/246 ]
[v0.10.3212, 30th June 2021]
- added: #Region support, including fold/unfold all-regions support from VS Code [ https://github.com/WaynePhillipsEA/twinbasic/issues/18 ]
- improved: code-folding is now based on parser AST, rather than indented code [ https://github.com/WaynePhillipsEA/twinbasic/issues/18 ]
- improved: the VS code extension now handles auto-indentation during code editing
- improved: block end auto-complete for components, procedures, types, enums, if, while, do, select, and with blocks
[v0.10.2914, 29th June 2021]
- added: support for LoadResString, and string table resources [ https://github.com/WaynePhillipsEA/twinbasic/discussions/238 ]
- added: 'twinBASIC: Create Resource String Table' VS code command [ https://github.com/WaynePhillipsEA/twinbasic/discussions/238 ]
- fixed: the DLL samples no longer have the visual styles MANIFEST wrongly included [ https://github.com/WaynePhillipsEA/twinbasic/discussions/238#discussioncomment-933361 ]
- fixed: SystemColorConstants and ColorConstants enumeration values were not correct due to internal truncation
[v0.10.2822, 28th June 2021]
- improved: included a Visual Styles manifest file inside the tB debugger. VisualStyles are enabled/disabled in the debugger based on the project manifest file [ https://github.com/WaynePhillipsEA/twinbasic/issues/68#issuecomment-868954794 ]
- improved: tweaked the Visual Styles manifest generated by the VS code extension [ https://github.com/WaynePhillipsEA/twinbasic/discussions/238#discussioncomment-931285 ]
- improved: included the default manifest in all sample projects