tm4e icon indicating copy to clipboard operation
tm4e copied to clipboard

quotes and double-quotes surrounding pairs do not work correctly

Open NicoPy opened this issue 2 years ago • 4 comments

I've configured TextMate to support Ada language.

Everything seems to be working correctly except quote and double-quote surrounding pairs highlighting.

When the editing cursor is after the opening quote/double-quote, the matching quote/double-quote is located correctly. image

When the editing cursor is after the closing quote/double-quote, the matching quote/double-quote is not shown at the correct location. image

Brackets work correctly. image image

The language-configuration.json file I use :

{
    "comments": {
        // symbol used for single line comment. Remove this entry if your language does not support line comments
        "lineComment": "-- "
    },
    // symbols used as brackets
    "brackets": [
        ["(", ")"]
    ],
    // symbols that are auto closed when typing
    "autoClosingPairs": [
        ["<<", ">>"],
        ["{", "}"],
        ["[", "]"],
        ["(", ")"],
        ["\"", "\""],
        ["'", "'"]
    ],
    // symbols that can be used to surround a selection
    "surroundingPairs": [
        ["{", "}"],
        ["[", "]"],
        ["(", ")"],
        ["\"", "\""],
        ["'", "'"]
    ]
}

Is this a bug or a bad configuration on my side ?

Eclipse : Version: 2022-09 (4.25.0) Build id: 20220908-1902

Windows 10

NicoPy avatar Nov 26 '22 14:11 NicoPy

I forgot to say that to use a double-quote in strings, the escape character is a double-quote. So, to print --"hello world"--, one have to code it like this : image

With this pattern, the surrounding pairs do not correctly : image

For a single character , there is no escape character (a quote is used directly) : image

The surrounding pairs do not work correctly either in this case : image

NicoPy avatar Nov 26 '22 15:11 NicoPy

Is this issue reproducible with any other the languages provided by the Language Pack? https://github.com/eclipse/tm4e/tree/main/org.eclipse.tm4e.language_pack

sebthom avatar Jun 21 '23 17:06 sebthom

How do I check it with other languages ?

NicoPy avatar Jul 01 '23 15:07 NicoPy

We currently delegate surround handling to org.eclipse.jface.text.source.DefaultCharacterPairMatcher which apparently only handles brackets reliably, i.e. the opening and the closing chars must be different.

With PR https://github.com/eclipse/tm4e/pull/613 I am disabling the broken surround pair handling of quotes until a proper solution is found.

Btw. the native Eclipse Java Editor also currently does not support surround pair handling of quotes.

sebthom avatar Nov 07 '23 03:11 sebthom