The way build systems are defined and invoked is great in Sublime, but I have a feeling that variable substitution is thrown off by underscores.
In my case, I type a code listing in Sublime and then use the build system to apply various transformations to it. One of those, produces an intermediate file with the same base filename (including the file path) but with the last part changed to "$file_path/$file_base_name_something.txt "
.
You can probably see what the problem is here, this throws the substitution off. To see what this string is going to look like, I am using xmessage
as the cmd
. If I leave the _something.txt
exactly adjacent to $file_base_name
(where it should be), $file_base_name
vanishes entirely. If I insert a space, the substitution DOES happen but of course the filename will not be found on disk.
In this case, Sublime seems to be trying to substitute $file_base_name_something
, does not find it (but does not complain either) and simply decides to output “” right there.
The other thing I tried, was to escape the second _
but this still throws substitution off because…well, basically, the substitution is not even visible to Sublime because it happens at the JSON marshaling level
Perhaps Sublime is not trying to substitute file
, file_base_name
` and the rest of the variables as these specific strings but it is trying a more generic regexp that matches parts that are not necessarily variables it can understand (?).
Is there a way to overcome this or does it need special care? If it will need further work, would it be possible to have it complain when something that looks like a variable but is not, is parsed?
All the best