SublimeText / PackageDev

Tools to ease the creation of snippets, syntax definitions, etc. for Sublime Text.
MIT License
436 stars 83 forks source link

Syntax Test: displaced region highlighting #106

Closed deathaxe closed 7 years ago

deathaxe commented 7 years ago

Hello guys,

I just started a new syntax_test_dtd.dtd file.

screenshot

The highlighted region does obviously not match the current scope.

The reason for this offset is TAB indention ("tab_width": 2) which is enabled by default. Seems there is an str.expandtabs(tab_width) missing somewhere?

I will go on working with "space indention" anyway as tabs won't obviously work with different tab_width values, but maybe you can provide some kind of hint or automatically enable space indention for syntax_test_files?

FichteFoll commented 7 years ago

Do syntax tests even work properly with tabs? Iirc there were some oddities involved that basically require you to use spaces.

keith-hall commented 7 years ago

Spaces only https://github.com/SublimeTextIssues/Core/issues/886

deathaxe commented 7 years ago

Tabs in syntax tests make no sense as all the rules would work with a single tab_width, only. So maybe it is a good idea to provide a syntax_specific_settings file to automatically switch to "indent with spaces"? Just for convenience.

FichteFoll commented 7 years ago

We cannot provide a syntax-specific settings file because we don't know what syntax you are using it with. It could be any. We could override the view-specific setting to indent with spaces on_load, but I don't really want to do that, since I believe it's the user's responsibility to ensure that their tests are working properly. At least not for now.

FichteFoll commented 7 years ago

What we could do is issue a warning somewhere, when we detect that a syntax test file is using tabs for indentation, I guess, and disable our hinting feature and others.

deathaxe commented 7 years ago

disable our hinting feature.

It was actually the one which told me something is wrong. :-)