Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

You MUST use spaces! error: Syntax tests do not work properly with tabs as indentation. #177

Closed
evandrocoan opened this issue Dec 20, 2017 · 4 comments
Labels
Milestone

Comments

@evandrocoan
Copy link

evandrocoan commented Dec 20, 2017

So, I press Ctrl+P and start typing a file I would like to open, then BAM! You do not even let me complete type the file name gotolasteditenhanced.

image

I would happen to accidentally hit a syntax file which uses tabs as indentation:

File: Data/Packages/PackageDev/plugins_/syntaxtest_dev.py
29: def _show_tab_warning():
30:     sublime.error_message("Syntax tests do not work properly with tabs as indentation."
31:                           "\n\nYou MUST use spaces!")
32: 

Your warning seem too aggressive popping up on a error message dialog. Also, very frustrating while using the Ctrl+P/Go To Anything... feature.

Why not just using print on the user console, perhaps also a sublime.status_message instead of sublime.error_message or sublime.message_dialog?

evandrocoan added a commit to evandroforks/PackageDev that referenced this issue Dec 20, 2017
tests do not work properly with tabs as indentation.
@FichteFoll
Copy link
Member

FichteFoll commented Dec 20, 2017

Well, I specifically wanted this to get in the way of user experience so the user can fix their faulty indentation settings for syntax test files, so a print message on the console is a no-go.

There is no easy way for me to find out whether a view has been opened transiently from the Go To Anything panel and delay the message until it was really opened. I guess I could try to see whether on_activated messages can do any good for me, although it would require me to rework the logic around this "feature" quite a bit.

Edit: I know it's not really your syntax test file, but if it annoys enough people, someone might actually submit a PR to fix that. For the record, the current file does indeed use tabs for indentation, although in a way that it works. It's not recommended regardless and should be changed because of how fragile this can turn out to be if you end up with mixed indentation between code and test lines.

@FichteFoll
Copy link
Member

Would be a lot easier if I could just check whether a quick panel is visible :/

Suggestions welcome, otherwise I'm inclined to not fix this (and rather fix sublimehq/Packages#1361 instead).

@evandrocoan
Copy link
Author

I think we check whether there is a quick panel open, if it is with focused. If not, we could wait Sublime Text allow to check whether the quick panel is open.

@FichteFoll
Copy link
Member

I think we check whether there is a quick panel open

I just mentioned that we can't, though, unless you know of some very hacky way that I'm not sure I'd want to rely on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants