Description
I'm making Syntax Highlight for the microScript language for microStudio. Not a Semantic Highlight. The syntax of this language is similar to Lua/Pascal. The end of the code block / indent level is indicated by the keyword "end".
The "Language Configuration Guide" says:
"appendText. A string that will be appended after the new line and after the indentation."
In theory, AppendText should add string after the "indent" stage. But it doesn't work as described with indentOutdent.
Therefore, I wanted to make an automatic increase in the indent level, and an automatic insertion of the "end" keyword at the end of the block. But there is a problem with "onEnterRules" + "indentOutdent" + "AppendText". It doesn't work as expected.
Here is an example. That's my rule.:
"onEnterRules": [
{
"beforeText": "\s*(?:if|elsif|else|while|for)\s*.*",
"action": {
"indent": "indentOutdent",
"appendText": "end"
}
}
]
Here is an example of a situation where it should work:
Here's what should happen when you press the "Enter" button:
- Press “Enter”.
- The indentOutdent is executed.
- The carriage moves to the next line below.
- On this next line, the indent level should increase.
- And on the second line, the indent level should decrease again.
- And that's where appendText should work.
- At the end of this second line, the keyword “end” should be inserted.
But for some reason, when pressing "Enter", this rule works like this:
For some reason, when using "onEnterRules" + "indentOutdent" + "AppendText", after pressing "Enter":
- The carriage moves to a new line.
- But on a new line, either the indent level is inserted and immediately replaced by the "end" keyword.
Or the indent level is not inserted at all, but the "end" keyword is simply inserted instead. - And at the end, the second line is inserted with the original, unincreased indentation level. Without the keyword “end” at the end.
I found this bug only for the rule (“indent”: “indentOutdent”). The rule (“indent”: “indent”) does not have this bug. For the rule (“indent”: “indent”), the indent level is simply incremented on a new line. And after that, the string is added.
Here's an example of how (“indent”: “indent”) + “AppendText” works:
Quite a few languages use this approach to designate “code blocks” / “indent levels”. Automatic insertion of such constructions as keyword “end” of a code block, in such languages, unexpectedly and surprisingly increase coding comfort. So I would like this wonderful mechanism to work without such embarrassing surprises.
p.s.: I don't get it, I'm not allowed to delete bug_report_template? What? This strange prohibition is very confusing.
p.p.s.: Ahhh, bug_report_template is hidden in the final message. It's clear now.
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.98.2
- OS Version: Windows_NT x64 10.0.19045