I have created an extension for a custom language (ABC) for which I would like to define a custom minimap section header regex.
Since the February 2025 release, custom regex patterns can be defined in the settings and I've tested this for the ABC language and it works, however I have only got it to work when the setting is made in the main Text Editor section: "editor.minimap.markSectionHeaderRegex"
. Which affects all open documents, not just those for the ABC language.
How can I define a custom "editor.minimap.markSectionHeaderRegex"
entry that only affects a document if it is of the correct language type: ABC?
I've tried adding this key to the package.json
in the contributes/configuration/properties
section, however it gets consumed by the system and ignored. In another post I saw a reference to another ID, "editor.minimap.sectionHeaderDetectionRegExp"
this results in a setting being shown for my extension, but it has no effect on the minimap.
I'm looking for a way to get the section header texts to show in the minimap, without all users having to define the regex themselves.
I'm going to guess you can do this with contributes.configurationDefaults
in your extension manifest. Maybe something like this:
"[my-lang-id]": {
"editor.minimap.markSectionHeaderRegex": "...",
}
Another solution (courtesy of the asker, Eric):
const scope: vscode.ConfigurationScope = { languageId: "my-lang-id" }; const inspect = vscode.workspace.getConfiguration("editor", scope).inspect("minimap.markSectionHeaderRegex"); if ( !inspect?.workspaceLanguageValue ) { vscode.workspace.getConfiguration("editor", > scope).update("minimap.markSectionHeaderRegex", "...", vscode.ConfigurationTarget.Workspace, true); }