Packages: [batch] Trailing space on syntax text

Created on 3 Aug 2017  路  5Comments  路  Source: sublimehq/Packages

File: Packages\Batch File\syntax_test_batch_file.bat
441: 
442: ::                        | this is a deliberate trailing space
443: set /p today=enter a date: 
...
448: ::                         ^ - meta.prompt.set.dosbatch

While saving the file adding new tests, my Sublime Text trimmed the lines, and I find out this test failing if the trailing white space is removed. Any syntax tests should depend on trailing spaces, is this by design why?

image

Most helpful comment

But that was ages ago @rwols ! ;)

I have the idea that I wanted meta.prompt.set to only apply to the text after the equals, but forgot that the meta_scope will apply to the matched text on set... also, IIRC there is some odd behavior with meta_content_scope that it doesn't always cover whitespace when one would expect it to, hence the deliberate trailing whitespace... IDK, it doesn't seem important now ;) feel free to get rid of it and the corresponding test assertion in your PR @evandrocoan if nobody else can see a good reason for it being there :)

All 5 comments

ST's default preferences include "trim_automatic_white_space": true - obviously there is no way to have syntax specific preferences for syntax tests, but you could write a plugin / update PackageDev to set "trim_automatic_white_space": false on the view if it is a syntax test view.

I think @keith-hall should be able to clarify why he wrote it like this: bff92cd3dce9 ;)
And yes, having this as a feature of PackageDev would be very nice.

But that was ages ago @rwols ! ;)

I have the idea that I wanted meta.prompt.set to only apply to the text after the equals, but forgot that the meta_scope will apply to the matched text on set... also, IIRC there is some odd behavior with meta_content_scope that it doesn't always cover whitespace when one would expect it to, hence the deliberate trailing whitespace... IDK, it doesn't seem important now ;) feel free to get rid of it and the corresponding test assertion in your PR @evandrocoan if nobody else can see a good reason for it being there :)

I'm opposed to setting "trim_automatic_white_space": false to syntax test files in PackageDev because it would be very annoying to me when writing test files. Remember that most content of a test file is actual source code that you want to test against, so it feels a lot like writing code, and I don't want to bother with having to remove trailing whitespace when doing that.

If people need trailing spaces in (any of) their files, they should take care of handling the corresponding setting themselves, imo.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iamntz picture iamntz  路  4Comments

jcberquist picture jcberquist  路  4Comments

idleberg picture idleberg  路  4Comments

caub picture caub  路  3Comments

n-kort picture n-kort  路  3Comments