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

Unexpected highlighting behavior when end is not defined #66

Closed
aeschli opened this issue May 2, 2018 · 2 comments
Closed

Unexpected highlighting behavior when end is not defined #66

aeschli opened this issue May 2, 2018 · 2 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@aeschli
Copy link
Contributor

aeschli commented May 2, 2018

From @mhchem on April 25, 2018 9:20

With this simplified .tmLanguage file, the whole document should be formatted a comment (because I use a begin without and end).

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>scopeName</key>
        <string>text.test</string>

        <key>patterns</key>
        <array>
            <dict>
                <key>begin</key><string>^.</string>
                <key>name</key><string>comment</string>
            </dict>
            
            <dict>
                <key>begin</key><string>.</string>
                <key>name</key><string>invalid</string>
            </dict>
        </array>
    </dict>
</plist>

This works fine unless the document contains the word undefined.

image

I guess this is a "end is undefined" issue where undefined is taken literally.

The issue can be avoided by setting end to a never-matching regexp (like <key>end</key><string>^\b$</string>). And maybe that could be put into the highlighting code: if undefined, use ^\b$ instead of the string undefined.

Copied from original issue: microsoft/vscode#48654

@aeschli aeschli self-assigned this May 2, 2018
@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label May 3, 2018
@alexdima
Copy link
Member

alexdima commented May 3, 2018

I think we never ran into this because a grammar with a begin statement and a missing end statement is illegal... So our resolution could be to throw the entire rule out.

@mhchem
Copy link

mhchem commented May 4, 2018

It's your decision. All I can say is that I read the documentation differently. (My understanding of "If there is no match for the end pattern, the end of the document is used." was that I can leave out the end to achieve a match till the end of the document.)

@alexdima alexdima assigned alexdima and unassigned aeschli Jul 12, 2019
david-driscoll pushed a commit to OmniSharp/vscode-textmate that referenced this issue Oct 7, 2019
Ensure that comments are allowed after try, finally, catch, and exception filters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

3 participants