SublimeText / PackageDev

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

TAB don't work dialog displayed with spaces as indention #144

Closed deathaxe closed 7 years ago

deathaxe commented 7 years ago

I just tried to play around with https://github.com/sublimehq/Packages/pull/1126 when I found PackageDev complaining about using TABS for indention doesn't work again and again, each time I click into the view.

screenshot

The fact is: The file uses 4 spaces for indention. Even a call to "Convert tabs to spaces" does not help.

ryboe commented 7 years ago

With this setting, you can see tabs and spaces:

"draw_white_space": "all"

It can help you find any tabs that might've snuck in.

FichteFoll commented 7 years ago

The code internally only checks for the "translate_tabs_to_spaces" setting, iirc. Can you check what the value of that is in your scenario?

deathaxe commented 7 years ago

With this setting, you can see tabs and spaces:

Everyone knows that. 😉

Can you check what the value of that is in your scenario?

My global value in Preferences is true

Query view setting from console also shows true

>>> view.settings().get("translate_tabs_to_spaces")
True

Seems to be an temporary effect. To check that, I added some debug messages to the SyntaxTestHighlighterListener's methods.

With one view open, which contains the syntax_test_git_tag, I closed and restarted ST. It contains the following output without error message. Everything seems ok.

is_applicatable(settings_id : 6) : translate_tabs_to_spaces True
__init__(view_id: 14, settings_id : 6) : translate_tabs_to_spaces True
is_applicatable(settings_id : 6) : translate_tabs_to_spaces True
is_applicatable(settings_id : 6) : translate_tabs_to_spaces True
is_applicatable(settings_id : 6) : translate_tabs_to_spaces True
is_applicatable(settings_id : 6) : translate_tabs_to_spaces True
is_applicatable(settings_id : 6) : translate_tabs_to_spaces True
is_applicatable(settings_id : 6) : translate_tabs_to_spaces True
is_applicatable(settings_id : 6) : translate_tabs_to_spaces True

If I now click into the console, the error dialog is displayed and the following lines are added to console.

is_applicatable(settings_id : 6) : translate_tabs_to_spaces False
__del__(view_id: 14, settings_id : 6) : translate_tabs_to_spaces False
is_applicatable(settings_id : 6) : translate_tabs_to_spaces False
error: Syntax tests do not work properly with tabs as indentation.

You MUST use spaces!
is_applicatable(settings_id : 6) : translate_tabs_to_spaces False
is_applicatable(settings_id : 6) : translate_tabs_to_spaces True
__init__(view_id: 14, settings_id : 6) : translate_tabs_to_spaces True
is_applicatable(settings_id : 6) : translate_tabs_to_spaces True
is_applicatable(settings_id : 6) : translate_tabs_to_spaces True
is_applicatable(settings_id : 6) : translate_tabs_to_spaces True
is_applicatable(settings_id : 6) : translate_tabs_to_spaces True
is_applicatable(settings_id : 6) : translate_tabs_to_spaces True

Seems something is temporarily changing the translate_tabs_to_spaces setting, which causes the ViewEventListener to be deleted.

... wait ... 🤔 ... 🤔 ... sounds known ...

I guess I found the culprit! It's TabNukerNuker. This bastard modifies this setting temporarily causing the EventListener object to be destroyed as it is no longer valid.

The error disappeared as soon as I disabled it.

As ST crashed everything and destroyed my whole preferences during the last update, I did not disable all obsolete packages, yet.