Sergey Romanov
Sergey Romanov

Reputation: 3080

VS Code extension, how to make case insensitive?

I am building ST language support for VS Code. In my language-configuration.json file I have

"brackets": [
        ["{", "}"],
        ["[", "]"],
        ["VAR", "END_VAR"]
]

This works fine. When i enter any of those I have indentation inside. But only if var and end_var are capital. Can I somehow indicate that this language in case insensitive and this works in both cases?

The same thing in autoClosingPairs

"autoClosingPairs": [
    {"open": "{", "close": "}"},
    {"open": "[", "close": "]"},
    {"open": "(", "close": ")"},
    {"open": "VAR", "close": "END_VAR", "notIn": ["string"]}
]

It close pair but only if I enter it in upper case.

Or I have to create 2 versions?

"autoClosingPairs": [
    {"open": "var", "close": "end_var", "notIn": ["string"]},
    {"open": "VAR", "close": "END_VAR", "notIn": ["string"]}
]

The same thing insyntaxes\st.tmLanguage.json. For instance I have

{
    "name": "keyword.control.conditional.st",
    "match": "\\b(END_)?(IF|CASE|OF|ELSE|ELSIF|THEN)\\b"
}

This also highlights only if I enter upper case. How to indicate case insensitive.

Upvotes: 4

Views: 2802

Answers (1)

Dan Jelf
Dan Jelf

Reputation: 61

For your tmLanguage.json file, it would look like this:

{
    "name": "keyword.control.conditional.st",
    "match": "(?i)\\b(END_)?(IF|CASE|OF|ELSE|ELSIF|THEN)\\b"
}

I found the answer on this site.

As for the other part, I do not have an answer, might need to just create a new version.

Upvotes: 6

Related Questions