Closed RedCMD closed 4 months ago
Good catch, thank you.
I don't recommend putting the string contents in a capture group and using "captures" as that incurs a medium performance hit in VSCode TextMate
How do you know that? I've been looking for resources on TextMate best practices for a while, but there isn't much content in this area.
but there isn't much content in this area.
heres some links I've used:
How do you know that?
Through my own personal testing https://github.com/microsoft/vscode-textmate/issues/167
I was confused as to why some rules were causing more lag than others for seemingly no reason
turned out simply just using a "patterns"
array inside "captures"
was causing the lag
I suspect its doing an inefficient string copy?
you wont see the performance difference much until you try tokenizing 5000+ character lines or 10,000+ line files
EDIT: Using "name"
inside "captures"
is fine
Holy shit, you're the tmLanguage.json
syntax extension guy! That's an excellent tool, thank you for building it!
\
Fantastic, thank you! Those are going in my list right away.
I was already planning to do some performance testing soon[0], so this is really useful stuff.
[0] I'm building a code formatter for GDScript using the tm grammar and vscode-textmate
Godot version
NA
VS Code version
1.84.2
Godot Tools VS Code extension version
1.3.1
System information
Windows 11
Issue description
"patterns"
does not work with"match"
escape characters will not get tokenized did you mean to usebegin
/end
instead?https://github.com/godotengine/godot-vscode-plugin/blob/f65033c6260e9eb5256d2c02a51a036c88d2ceb9/syntaxes/GDResource.tmLanguage.json#L201-L214
I don't recommend putting the string contents in a capture group and using
"patterns"
inside"captures"
as that incurs a medium performance hit in VSCode TextMate EDIT:"name"
inside"captures"
is fineIf Godot shouldn't support escape characters inside a string then the
"patterns"
array can be safely removedSteps to reproduce
Create a string with escape characters inside it
\\
[ "string\\bar" ]