microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.09k stars 28.82k forks source link

[regression] `language-configuration` of embedded language not loading #202938

Open RedCMD opened 8 months ago

RedCMD commented 8 months ago

some optimization/bug is stopping the language-configuration of embedded languages from loading correctly when part of the embedded language is offscreen during file loading

Create a markdown file and paste in the following code

```latex

()

scroll down until you can no longer see ` ```latex `, but still have `()` visible
reload VSCode (open & close etc)

scroll up and notice how the brackets `()` are no longer highlighted
typing a random letter near the latex code will start highlighting the brackets
typing a newline wont, nor will deleting any char

❌![image](https://github.com/microsoft/vscode/assets/33529441/25bb6e33-a633-4dca-885d-6e47968c9ab2)
✅![image](https://github.com/microsoft/vscode/assets/33529441/df6c7d84-f032-45f0-868f-7289954647bd)

seems to also happen when the embedded language is within the visible screen space, but is inside a folded region

this was just showing `"brackets"`, but it also applies to all other settings inside `language-configuration.json`

seems to be only 90% consistent. prob cause of some caching somewhere
VSCode 1.83.1 is fine ✅
some change in-between
VSCode 1.84.0 has the bug ❌
<!--
I noticed this when I was working on an embedded language syntax
notice how the parent grammar (json) has its brackets highlighted, but not the embedded regex
❌![image](https://github.com/microsoft/vscode/assets/33529441/499a502e-1cc8-4a0c-8237-cb139cdb93c5)
✅![image](https://github.com/microsoft/vscode/assets/33529441/06125384-be3b-42ef-90d4-635f21849e60)
-->
RedCMD commented 5 months ago

it seems the viewport position only changes the order in which lines update as you can force the correct (breaking) order without positioning the viewport in any special way

paste this code in a Markdown file

```jsonX
{
    "patterns": [
        {
            "match": "(?x)(?<=((?!)))"
        }
    ]
}

remove the `X` from `jsonX`
notice how none of the brackets have been highlighted 🐛

modify one of the lines inside the codeblock
brackets inside codeblock now highlight ✅

put the `X` back and then remove it again
brackets still work as they should ✅

it seems the update propagation isn't working correctly the first time a language loads
maybe an `await` is missing?

it also happens when a single line takes too long to tokenize
which I come across very often
![image](https://github.com/microsoft/vscode/assets/33529441/671eb0ac-460f-4c32-a393-93972278b617)
vs
![image](https://github.com/microsoft/vscode/assets/33529441/1fb1d887-a07c-40dc-924d-62ce83029304)
RedCMD commented 4 months ago

it's even worse now in the 1.89 release typing a single letter now no longer updates the entire line anymore it seems to update random parts of the line now

only the center 2 )( are highlighted image