Sublime Forum

Important documentation addition needed, about variable names

#1

I was working on a syntax, and using variables and variable replacement.

I had made names of the form variable-test-one.

And they weren’t replacing in later sections of the syntax file. eg in the - match section.

I asked on the forum and someone fortuitously remembered that dashes may not work in variables.

And indeed when I replaced the dashes with underscores, the variable replacement worked.

This issue for variable names was not mentioned in the docs as far as I can see.

It would be helpful for that limitation to be noted.

Thanks

0 Likes

#2

I think the documentation does mention this:

Note that any text that doesn’t match {{[A-Za-z0-9_]+}} won’t be considered as a variable, so regexes can still include literal {{ characters, for example.

- isn’t listed in the regex, only letters, numbers and the underscore character.

0 Likes

#3

Ah, yes. You’re quite right. I expect I skimmed past that.

Cheers

0 Likes