Home Download Buy Blog Forum Support

Underline Functions

Underline Functions

Postby meno on Tue Mar 22, 2011 9:18 am

hi
i present my first plugin ever. This is also my first useful python script, so input regarding style and effectiveness is very welcome :)

It underlines all lines with function definitions (based on the selector entity.name.function). for most languages very useful. does not look so great in header files though.

in my opinion, it makes code better readable. this way, functions act more like headlines in an article.

its quite possible that there are performance issues with large files. please let me know if you encounter them.

you can get it at https://github.com/menodev/sublime_exte ... nctions.py

this is how it looks (the line color is the same as the comments)
Image
meno
 
Posts: 9
Joined: Thu Mar 03, 2011 7:27 am

Re: Underline Functions

Postby bizoo on Tue Mar 22, 2011 9:56 am

I just take a quick look at the code and I think there is effectively some performance issues, but as I didn't try it I couldn't say how bad it is.
You didn't make anything wrong cause actually there isn't any proper option to achieve efficiently what you want to do.

The function find_all_function_lines parse every character in the buffer to check the scope_name, so for multi-megabytes files it's a very intensive task.

I already ask for a better way to achieve this in userecho http://sublimetext.userecho.com/feedback/22398-api-enhance-viewget_symbols-to-return-arbitrary-symbol-list/, fell free to vote for this.
The solution is to have a function that return the Regions containing the scope you look for, something like a find_all_scope('entity.name.function') or get_symbols('entity.name.function').
bizoo
 
Posts: 879
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Underline Functions

Postby meno on Tue Mar 22, 2011 1:30 pm

yes thats true. for normal sized files its absolutely fast and i feel no delay because of the script. really big files (which shouldnt happen anyway) will definitely have problems with this plugin.

i tried to find a function like you are suggesting and i did not find it so im going this expensive way. if you know a better way as of now im would be happy to hear it.
i voted your request.
meno
 
Posts: 9
Joined: Thu Mar 03, 2011 7:27 am


Return to Plugin Announcements

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 7 guests