but I don't know how to finish it. How can I highlight all the stopWords on running this command?

Also -- how can I make a distinction between checking the entire file and only the part of the file that the user currently sees (so that the command will be run again when the user scrolls to a different portion of the text)?

I understand both of these things are simple for those who know them... hence your tips will be greatly appreciated.

All best,Tench

Last edited by psychomachine on Sun Aug 04, 2013 10:18 am, edited 1 time in total.

The ??? should be filled with a list of regions. Regions can be gathered in a couple different ways. There are a number of methods that return regions (view#line, view#word, etc). If you have the end points, you can manually create a region by calling "sublime.Region(start, end)"

For example, in the console enter the following (ensure that the view has some characters in it). You could also use a small plugin, but it's pretty short and isn't really necessary to demonstrate the usage of add_regions.

1. How can I get individual words (see above) AND their individual offset points (i.e. have my cake and eat it) limited only to the visible region? I need to know individual words because I need to process them, but I need to keep an association between these individual words and the corresponding regions (offset points) so that I can edit them, replace them etc

2. How I can keep executing my command as new regions become visible, i.e. come into view. I was hoping for an event listener to that effect, but I am not finding one.

i have to work with visible regions only because my files are very big and i need to do a lot of stuff with words programmatically (check spelling in different languages, lemmatize, check against different dictionaries, save individual words in different files etc...) so there is no way i can work with the whole file.

i kind of got it to work but it's not pretty. it would be much, much better if find_all would give me the option to search only within a given scope. but i have learned a lot about sublime and python while working on this, it's been actually a lot of fun.

by the way, does anybody have an example of a polling function in a sublime plugin? i am having a hard time pulling one together. i need to check periodically if the values of visible_region have changed (i.e. if there was any and how much scrolling done) and then execute a thread.

if you have something or can point to a link, i'd greatly appreciate it.