Skip to content
4 changes: 4 additions & 0 deletions WIP.Build.md
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,10 @@ those `counts.mjs` defines, and most of the prose is still hand-written.
the page *is* the list. It reads the index alone, so an entry added only to the
by-package section above it is still a half-edit that nothing reports.

`samples` counts the rows of the table under `## The samples` in
`IDE/Starting/Samples.md`, the same shape: a row starts with the sample's number in
bold. A sample added to the IDE and not to that table is not counted.

`defaultPackages` and `builtInPackages` exist because `packages` alone cannot
express both sentences the site writes: all the packages, and the ones the IDE
ships but a project references on demand, for which "built-in" is reserved. A
Expand Down
2 changes: 1 addition & 1 deletion WIP.IDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ children. Second person ("you") is allowed here, as in tutorials.
| 6 | Running and debugging | `/tB/IDE/Debugging` + children | Menu/Debug's run-time error walkthrough and Debugger Options, Menu/Run, Debug Console, Variables, Watches, Call Stack, Memory, `Features/Compiler-IDE/Debugging` |
| 7 | Building | `/tB/IDE/Building` | Toolbar's Build configuration, Menu/File's Build and Clean, Package Publishing, links to LLVM and Project-Types |
| 8 | Customising the IDE | `/tB/IDE/Customising/` + children | IDE Options (all of them), themes and custom `.theme` files, panel layouts, keyboard shortcuts, language (from Menu/Window and Menu/Tools) |
| 9 | Add-ins | `/tB/IDE/AddIns/` | AddIns/* (no community add-in is listed yet) |
| 9 | Add-ins | `/tB/IDE/AddIns/` | AddIns/* (the community add-ins are listed from their authors' READMEs and release pages, and the Discord-only ones from their show-and-tell threads in the Wisdom harvest, each linked by its thread: they are published as DLLs, and none is downloaded or run here. sokinkeso plans to replace his with a commercial suite, KESO-DevToolz: update the table when it is out. Left out: fafalone's CodeStatAddin, unfinished by his word, and EJ's tb-claude, whose repository is gone) |
| 10 | When something goes wrong | `/tB/IDE/Troubleshooting/` + children | Status Bar's service states, Restart the compiler, TRACE mode, error reporting |

**Part B, Reference.** Written impersonally. One page per menu, plus the Toolbar, the Status Bar
Expand Down
20 changes: 20 additions & 0 deletions builder/counts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,25 @@ function countEnumerations(pages) {
return n;
}

// The sample projects the IDE ships, counted off the table under `## The samples`
// in IDE/Starting/Samples.md, which has a row for each: the page is the list, as
// for countEnumerations, and has the same exposure to a change of its formatting.
// A row starts with the sample's number in bold: `| **1a.** WebView2 Examples |`.
function countSamples(pages) {
const page = pages.find((p) => p.srcRel === "IDE/Starting/Samples.md");
if (!page) return 0;
const lines = proseLines(page.rawContent);
const start = lines.findIndex((l) => l !== null && /^## The samples\s*$/.test(l));
if (start === -1) return 0;
let n = 0;
for (const l of lines.slice(start + 1)) {
if (l === null) continue;
if (/^#{1,6} /.test(l)) break;
if (/^\| \*\*\d+[a-z]?\.\*\* /.test(l)) n++;
}
return n;
}

/**
* Derive every named count from build state.
*
Expand Down Expand Up @@ -220,6 +239,7 @@ export function deriveCounts(state, extra) {
builtInPackages: countPackages(pages, "Reference/Built-In/"),
attributeAnchors: countAttributeAnchors(pages),
enumerations: countEnumerations(pages),
samples: countSamples(pages),
// Whole-page stubs emitted for every `redirect_from:` entry. Passed in
// because it comes from deriveRedirects rather than from discover.
redirectStubs: extra.redirectStubs,
Expand Down
1 change: 1 addition & 0 deletions docs/Documentation/Authoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ renders as the current figure. The names are derived on every build:
| `builtInPackages` | of those, the ones under `Reference/Built-In/` |
| `attributeAnchors` | pinned heading ids in `Reference/Attributes.md` |
| `enumerations` | entries in the alphabetical index of `Reference/Enumerations.md` |
| `samples` | rows of the table of sample projects in `IDE/Starting/Samples.md` |
| `redirectStubs` | whole-page stubs emitted for `redirect_from:` entries |

The package names are separate because the words for them collide. The
Expand Down
2 changes: 1 addition & 1 deletion docs/Documentation/Extending.md
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ A count name is a number the build works out and substitutes into prose, so a se

**A name must be a derivation over build state, never a stored constant.** A registry holding `pages: 908` only moves the stale figure from a page a contributor reads into a module nobody opens. A number that cannot be derived gets no name and stays a digit.

Two shapes qualify. Most names count things `discover` already found: pages under a prefix, static files, packages. `attributeAnchors` and `enumerations` scan one page's `rawContent` for the pattern that makes an entry. That is legitimate because the page *is* the list, but changing that page's list formatting moves the number. Both scan only the lines outside code, which `proseLines` in `counts.mjs` gives them, so an example of the pattern in a fence is not counted; a new scan should do the same.
Two shapes qualify. Most names count things `discover` already found: pages under a prefix, static files, packages. `attributeAnchors`, `enumerations` and `samples` each scan one page's `rawContent` for the pattern that makes an entry. That is legitimate because the page *is* the list, but changing that page's list formatting moves the number. Each scans only the lines outside code, which `proseLines` in `counts.mjs` gives them, so an example of the pattern in a fence is not counted; a new scan should do the same.

1. **Add the entry.** A function beside the others in
[`counts.mjs`](https://github.com/twinbasic/documentation/blob/main/builder/counts.mjs),
Expand Down
2 changes: 1 addition & 1 deletion docs/Documentation/Pipeline-Stages.md
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ For **renderer rules**, order inverts. Both image plugins capture the current `m
| Symbol | Signature | Description |
|---|---|---|
| `PLACEHOLDER_RE` | `RegExp` | Matches a `{{tbdocs:<name>}}` or `{{tbdocs:<name>:<argument>}}` placeholder and captures the name and the argument. Used by the `substitute` helper that `countPlugin` calls, and by `findCountRefs` to locate placeholders in a page's raw markdown. |
| `deriveCounts` | `(state, extra) → Record<string, number>` | Derives every named count from build state: page, static-file, reference-page and documentation-page totals, folder-style reference indexes and how many of them have a permalink ending in a slash, packages (total, default, built-in), attribute anchors, enumerations, and `extra.redirectStubs`. Called by `markdownInit` to build `state.site.counts`, whose keys are the names a page may use. |
| `deriveCounts` | `(state, extra) → Record<string, number>` | Derives every named count from build state: page, static-file, reference-page and documentation-page totals, folder-style reference indexes and how many of them have a permalink ending in a slash, packages (total, default, built-in), attribute anchors, enumerations, sample projects, and `extra.redirectStubs`. Called by `markdownInit` to build `state.site.counts`, whose keys are the names a page may use. |
| `countPlugin` | `(md, ctx) → void` | A markdown-it plugin, the last one `createMarkdownIt` applies. Substitutes each `{{tbdocs:<name>}}` placeholder in prose and image alt text with the value `ctx.counts` holds under that name, and leaves an unknown name as written; code spans and fences are untouched. Its core rule is pushed last, so it runs after `replacements`. Does nothing when `ctx.counts` is absent. |
| `findCountRefs` | `(rawContent, md) → { name, arg, line }[]` | Finds every `{{tbdocs:...}}` reference outside code in a page's raw source. Code is what `maskCode` from `lib/markdown.mjs` hides with the site's markdown-it instance `md`, as the pre-render rewrites do: every line of a fence (`blockRegions`), and the code spans of any other line (`splitCodeSpans`). Only the lines that hold a placeholder are cut into spans, since a placeholder cannot span lines. `line` is 1-based in `rawContent`. Called by `checkPlaceholders` for each page. |
| `checkPlaceholders` | `(pages, counts, downloads, md) → { problems, sizes, packedArgs, late }` | `validateCountNames` for all placeholders: also refuses a `size` whose path the build does not publish or cannot size before the page renders (`downloads.refused`, which names the help add-in's project, stylesheets and SVGs), a `size` without a path, an argument on a name that takes none, and either download placeholder when `downloads` is `null`. `sizes` holds the bytes of each file named, which is all the workers are sent. A `size` that names a file in `downloads.packed` is accepted without a size: `packedArgs` maps its argument to the file's path, and `late` names each page that states such a size or lists the test projects. |
Expand Down
29 changes: 28 additions & 1 deletion docs/IDE/AddIns/Community/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,33 @@ Community add-ins are the ones that twinBASIC users write and share, as distinct
> [!WARNING]
> An add-in is a compiled DLL that runs inside the IDE, with your rights. Treat it as you would any program that you have not written yourself.

No add-in is listed here yet. To share one, add it to this page: [Authoring](../../../Documentation/Development/Authoring) describes how to change a page of this documentation.
The add-ins below are listed as their authors describe them. Each is published as compiled DLLs. [Add Ins](./) says where the DLLs go. The **Builds** column says which of the two architecture folders the add-in has a DLL for: an add-in with a 32-bit build only does not load while the project's build target is win64.

## Add-ins by sokinkeso

These add-ins are written by [sokinkeso](https://github.com/sokinkeso), and each has a repository of its own on GitHub. The DLLs are in a zip file on the **Releases** page of the repository.

| Add-in | What it does | Latest release | Builds |
|---|---|---|---|
| [AutoSave](https://github.com/sokinkeso/AutoSaveAddin) | Saves the project at an interval that you choose, in seconds or minutes, and only when the project has changed. It can ask before each save, and can save before the project runs. A toolbar button turns it on and off, and a double-click on the button opens its settings. | 3.1.5.0, July 2025 | 32-bit and 64-bit |
| [CopyPasteEx](https://github.com/sokinkeso/CopyPasteEx-Addin-for-twinBASIC) | Copies files of the Project Explorer from one twinBASIC IDE and pastes them into another, through the clipboard. It asks before it overwrites a file. It does not copy folders, hidden items, packages or references. | 0.9.4, May 2025 | 32-bit |
| [External Tools](https://github.com/sokinkeso/ExternalTools-Addin-for-twinBasic) | Starts other programs from a panel in the IDE: a hex editor, a console window, a version control tool. Each tool has a name, a path, parameters and a working directory, and can run as administrator. | 1.2.0.0, April 2024 | 32-bit and 64-bit |
| [MsgBox Builder](https://github.com/sokinkeso/MsgBox-Builder-Addin-for-twinBasic) | Writes a `MsgBox` call from a dialog in which you choose the title, the message, the icon, the buttons and the default button. It can also write the `Select Case` or `If` block that handles the answer. It shows a preview and copies the code to the clipboard. | 1.1.6, April 2025 | 32-bit and 64-bit |
| [String Converter](https://github.com/sokinkeso/String-Converter-Addin-for-twinBasic) | Finds the string literals in the code and replaces each with a concatenation of `ChrW$` calls, so that the text cannot be found in the built file with a hex editor. It also converts such an expression back to a literal. | 2.2.0.0, April 2024 | 32-bit and 64-bit |
| [TabOrder](https://github.com/sokinkeso/TabOrder-Addin-for-twinBASIC) | Sets the tab order of the controls on a form or a user control. You move the controls up and down in a list, click them on the form in the order you want, or let the add-in order them by position. | 0.9.54, May 2025 | not stated |
| [Usercontrol Builder](https://github.com/sokinkeso/Usercontrol-Builder-for-TwinBASIC) | A wizard that writes the properties, methods and events of a user control, after the ActiveX Control Interface Wizard of VB6. You choose the members, map them to members of the controls inside the user control, and the wizard inserts the code at the top of the user control's source. | 3.2.0.2, April 2024 | 32-bit and 64-bit |

## Add-ins posted on Discord

These add-ins are published only as attachments to a thread in the **show-and-tell** channel of the [twinBASIC Discord server](https://discord.gg/UaW9GgKKuE). Each link opens the thread, which needs a Discord account that has joined the server.

| Add-in | Author | What it does | Posted | Builds |
|---|---|---|---|---|
| [BeautifiedCode](https://discord.com/channels/927638153546829845/1414250283852107856) | Frank-S. | Indents the code, and has a colour picker that writes a colour value into the code. The author calls it early work, after the VB6 add-in MZ-Tools. The thread also has the add-in's project. | September 2025 | 32-bit; the author says that the 64-bit DLL does not work |
| [Comments](https://discord.com/channels/927638153546829845/1202747679361343679) | sokinkeso | Adds a **Comment** and an **Uncomment** button to the toolbar. **Comment** makes each selected line a comment, and with <kbd>Ctrl</kbd> held it makes one comment of the whole selection, which may be part of a line. **Uncomment** removes the comment that the caret is in. | February 2024 | 32-bit and 64-bit |
| [tbSplitScreen](https://discord.com/channels/927638153546829845/1522162642700206146) | woeoio2 | Shows the active file a second time, read-only, in a tool window beside the editor. It can follow the editor as you change to another file. Its highlighting is that of VB6, so it does not colour a `/* */` comment. | 1.0.1, July 2026 | not stated |
| [VB6 to twinBASIC clipboard](https://discord.com/channels/927638153546829845/1333920083914788946) | sokinkeso | Converts the controls that you copy from a form in the VB6 IDE, so that you can paste them on a twinBASIC form without importing the VB6 project. The author calls it experimental. | 0.2.17.0, January 2025 | 32-bit |

To share an add-in, add it to this page: [Authoring](../../../Documentation/Development/Authoring) describes how to change a page of this documentation.

To write one, start from Sample 10, the card **twinBASIC IDE Addin** in the **Samples** section of the **New / Open Project** dialog. See [Samples](../Starting/Samples) and the [tbIDE package](../../Packages/tbIDE/).
2 changes: 1 addition & 1 deletion docs/IDE/Starting/New-Project.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ A path that holds a `#` is shown cut in two, as a name with a sub-text: `C:\dev\

## Samples

The **Samples** section holds the 26 sample projects that ship with the IDE. A sample opens as a new, unsaved project through [New Project Options](#new-project-options), like a template. [Samples](Samples) says what each one is.
The **Samples** section holds the {{tbdocs:samples}} sample projects that ship with the IDE. A sample opens as a new, unsaved project through [New Project Options](#new-project-options), like a template. [Samples](Samples) says what each one is.

## Import from folder

Expand Down
2 changes: 1 addition & 1 deletion docs/IDE/Starting/Samples.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ index:

# Samples

The IDE ships with 26 sample projects, in the **Samples** section of the [**New / Open Project**](New-Project) dialog. This page says how a sample opens, what each one shows, and what it needs before it runs.
The IDE ships with {{tbdocs:samples}} sample projects, in the **Samples** section of the [**New / Open Project**](New-Project) dialog. This page says how a sample opens, what each one shows, and what it needs before it runs.

![The New / Open Project dialog on its Samples section: two columns of sample cards named without their numbers, the first, Reports (Experimental), selected, then HelloWorld, WebView2 Examples, Chromium Embedded Framework Examples, GetIPAddresses and MyCodeLibrary.](../Images/New_Project_Samples.png){:width="970" height="728"}

Expand Down
2 changes: 1 addition & 1 deletion docs/IDE/Starting/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This chapter follows the IDE from the moment it starts to a project that is open
- [**New Project**](New-Project) --- the **New / Open Project** dialog: its sections, its search and keys, what each template makes, the **New Project Options** box, and the recent lists.
- [**Opening projects**](Opening-Projects) --- the ways to open a project, one project at a time, the file association, what happens as a project loads, and what to do when one will not open.
- [**Importing a VB6 project**](Importing-VB6) --- the routes for a `.vbp` file, what the importer converts and what it leaves, and its log.
- [**Samples**](Samples) --- the 26 sample projects: what each is, and where the documentation uses it.
- [**Samples**](Samples) --- the {{tbdocs:samples}} sample projects: what each is, and where the documentation uses it.

## From a double-click to a project

Expand Down
Loading