microsoft / microsoft/vscode

Minimap renders huge section-header text over LaTeX files for prose lines starting with the word region

Open
#331,193 2 comments 0 reactions 1 assignee Claimed by @hediet View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Type: Bug

- Does this issue occur when all extensions are disabled?: Yes (caused by the built-in `latex` extension)
- VS Code Version: reproduced on current `main` (1.135.0-dev) and on stable
- OS Version: Windows 11 Pro 10.0.26200 (not OS-specific)

### Steps to Reproduce

1. Create a file `bug.tex` with this content (plain prose, no region markers intended):

```
region the encoder fails to cover rather, nothing any linear head can
read separates them.
```

2. Look at the minimap: everything after the word `region` is rendered as a **large section header overlaid on the minimap** (screenshot below). A bogus folding range also appears in the gutter.

Any line starting with the bare word `region` triggers it — e.g. `region france` as below:

Image

### Cause

The built-in LaTeX language configuration ([`extensions/latex/latex-language-configuration.json`](https://github.com/microsoft/vscode/blob/main/extensions/latex/latex-language-configuration.json)) defines folding markers with an **optional** `%` comment character:

```json
"start": "^\\s*%?\\s*(region|\\\\begingroup)\\b",
"end": "^\\s*%?\\s*(endregion|\\\\endgroup)\\b"
```

So any prose line starting with `region` is treated as a folding region start, and since `editor.minimap.showRegionSectionHeaders` is on by default, the rest of the line is rendered as a section header in the minimap. Region headers are not required to be inside comments (`shouldBeInComments: false` in `findSectionHeaders.ts`), so nothing filters it out.

This affects the `latex` (`.tex`, `.ltx`, `.ctx`) and `tex` (`.sty`, `.cls`, `.bbx`, `.cbx`) languages, which share this configuration. I audited all other built-in language configurations: every other folding marker requires an actual comment/directive token (`//`, `#`, `--`, `

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.