Home Download Buy Blog Forum Support

Why is my python syntax ugly?

Why is my python syntax ugly?

Postby pushxtonotdie on Tue Jan 03, 2012 5:12 pm

Hello!

I am learning to write plugins, and Python is not my fluency. This is made more difficult by the odd syntax highlighting behavior I'm seeing, which makes me make frequent whitespace and bracket mistakes.

Here's what it looks like:
https://skitch.com/robotron2086/gisfn/p ... y-wordgame

And looking at other python files, there is no issue (this is from the Default package):
https://skitch.com/robotron2086/gisfh/d ... y-wordgame

Any thoughts as to why this is occuring?

Thanks
pushxtonotdie
 
Posts: 15
Joined: Tue Dec 20, 2011 8:44 pm

Re: Why is my python syntax ugly?

Postby hibbelig on Tue Jan 03, 2012 6:14 pm

Do you have the package BracketHighlighter or SublimeTags or SublimeBrackets installed? If it does, does it help to disable them temporarily?

You can include the following in Packages/User/Global.sublime-settings:

Code: Select all
{
    ...other settings...
    "ignored_packages": ["BracketHighlighter", ...more ignored packages...],
    ...more settings...
}
hibbelig
 
Posts: 77
Joined: Wed Dec 21, 2011 11:24 pm

Re: Why is my python syntax ugly?

Postby vitaLee on Tue Jan 03, 2012 6:21 pm

He has probably installed SublimeLinter.
It essentially is giving you hints on potential errors and guiding you to conform to defined programming styles.
When you move the selector within a selection SublimeLinter displays the hint in the footer of the editor (right next to Line, Column info ).

more info: https://github.com/Kronuz/SublimeLinter
Last edited by vitaLee on Tue Jan 03, 2012 6:26 pm, edited 1 time in total.
vitaLee
 
Posts: 150
Joined: Tue Dec 27, 2011 11:10 pm

Re: Why is my python syntax ugly?

Postby aparajita on Tue Jan 03, 2012 6:26 pm

pushxtonotdie wrote:Any thoughts as to why this is occuring?


SublimeLinter is trying to help you conform to python coding standards. As someone pointed out, if you click on a line that is outlined, the error is shown in the status bar. In this case your problem is that you are using tabs instead of spaces for indentation. Switch to spaces.
aparajita
 
Posts: 177
Joined: Sun Jul 24, 2011 10:42 pm

Re: Why is my python syntax ugly?

Postby facelessuser on Tue Jan 03, 2012 6:36 pm

hibbelig wrote:Do you have the package BracketHighlighter or SublimeTags or SublimeBrackets installed? If it does, does it help to disable them temporarily?

You can include the following in Packages/User/Global.sublime-settings:

Code: Select all
{
    ...other settings...
    "ignored_packages": ["BracketHighlighter", ...more ignored packages...],
    ...more settings...
}


BracketHighlighter has nothing to do with this issue; it only highlights brackets. As stated earlier, this is SublimeLinter marking lines that violate certain PEP8 rules. You need to either conform to the SublimeLinter rules or exclude the rules you do not wish to follow.
facelessuser
 
Posts: 1567
Joined: Tue Apr 05, 2011 7:38 pm

Re: Why is my python syntax ugly?

Postby pushxtonotdie on Tue Jan 03, 2012 6:46 pm

Wow, you are quite correct, it was the linter! I had forgotten I had installed that. Thank you for enlightening me, very cool little prog.
pushxtonotdie
 
Posts: 15
Joined: Tue Dec 20, 2011 8:44 pm

Re: Why is my python syntax ugly?

Postby hibbelig on Wed Jan 04, 2012 11:03 am

facelessuser wrote:BracketHighlighter has nothing to do with this issue; it only highlights brackets.

Yes, sorry. Thanks for setting me straight.
hibbelig
 
Posts: 77
Joined: Wed Dec 21, 2011 11:24 pm

Re: Why is my python syntax ugly?

Postby facelessuser on Wed Jan 04, 2012 4:14 pm

hibbelig wrote:Yes, sorry. Thanks for setting me straight.


No worries :). With the dynamics of multiple plugins, it can be very easy to attribute issues to the wrong plugin.
facelessuser
 
Posts: 1567
Joined: Tue Apr 05, 2011 7:38 pm


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot], mlf and 25 guests