DotJoshJohnson / vscode-xml

XML Tools for Visual Studio Code
MIT License
322 stars 86 forks source link

XQuery syntaxic coloration issue #242

Closed ThiBsc closed 5 years ago

ThiBsc commented 5 years ago

Description When I declare a variable with text nodes, if I insert a single quotation mark in the text, the syntaxic coloration is wrong. NB: The bug is not appear in an classic xml document.

Screenshots image

Extension Version XML Tools v2.3.2

VS Code Version VS code 1.29.0

Operating System Windows 10 pro

ThiBsc commented 5 years ago

I found the reason, it's due to the singlequotedString or doublequotedString regex. To give a quick solution, I write this regex in the xquery.tmLanguage file:

<key>singlequotedString</key>
<dict>
    <key>begin</key>
    <string>(?&lt;![-_a-zA-Z0-9:"]&gt;)\s*'(?![a-zA-ZÀ-ÿ\s()"]*&lt;/[-_a-zA-Z0-9:])</string>
    <key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
    <key>name</key>
    <string>punctuation.definition.string.begin.xquery</string>
</dict>
<!-- ... -->

But with this regex, I found that VS code is a little bit slower on big xquery file.