Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty string (double-quoted) in attribute argument highlights as character escape #168

Closed
msftrncs opened this issue Apr 28, 2019 · 0 comments · Fixed by #172
Closed

empty string (double-quoted) in attribute argument highlights as character escape #168

msftrncs opened this issue Apr 28, 2019 · 0 comments · Fixed by #172

Comments

@msftrncs
Copy link
Contributor

Surprisingly related to #143, an empty double-quoted string contained in an attribute argument will appear as an escaped double-quote.

image

It will be resolved by the fix for #143, but there are other reasons it is happening.

<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#variable</string>
</dict>
<dict>
<key>include</key>
<string>#variableNoProperty</string>
</dict>
<dict>
<key>include</key>
<string>#hashtable</string>
</dict>
<dict>
<key>include</key>
<string>#scriptblock</string>
</dict>
<dict>
<key>include</key>
<string>#doubleQuotedStringEscapes</string>
</dict>
<dict>
<key>include</key>
<string>#doubleQuotedString</string>
</dict>
<dict>
<key>include</key>
<string>#type</string>
</dict>
<dict>
<key>include</key>
<string>#numericConstant</string>
</dict>
<dict>
<key>include</key>
<string>#doubleQuotedString</string>
</dict>
<dict>
<key>include</key>
<string>$self</string>
</dict>

In the shown code snippet, the #doubleQuotedStringEscapes appears before #doubleQuotedString. However, the fact is that all of these "includes" seem to be made pointless by the last one, $self because they are all also included in $self (except #variableNoProperty, but nothing that's in #variableNoProperty isn't already covered in #variable). Usually including a specific item, and then including $self would be done when something needs to trigger in a different order, but here there seems to be no reason for it. It probably progressively became this way, while trying to get everything to work, and when the last include $self was added, the others were never cleaned up. This is evident in a few other places as well (sometimes in reverse order). Cleaning these up would improve performance of the syntax.

Admittedly this is obscure because there is seldom any use in an empty double-quoted string value for a attribute argument.

msftrncs added a commit to msftrncs/EditorSyntax that referenced this issue Apr 29, 2019
removes all redundant includes from #attribute
TylerLeonhardt pushed a commit that referenced this issue May 8, 2019
removes all redundant includes from #attribute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant