Hi.
I am having a hard time figuring out highlighting regions and all that. I have read the API documentation and looked at many plugins, but I still don’t understand something very simple.
Let’s say I have a set containing certain strings.
stopWords = 'word1', 'word2', 'word3']
I would like to run a sublime command that will highlight all the words that are in this set.
Now the context in which I am working looks like this:
class HighlightStopWordsCommand(sublime_plugin.TextCommand):
def __init__(self, view):
self.view = view
stopWords = 'word1', 'word2', 'word3']
self.view.add_regions("inset", ???, "comment")
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