Skip to content

Unexpected highlighting behavior when end is not defined #48654

@mhchem

Description

@mhchem

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions