CM6 Question: match word and get their range

I want to show some tips when hover every defined function name, so I had to return Diagnostic list in Linter.

The question is:

  1. I can traverse lines, but I don’t know how to get word’s range

  2. Is it right to traverse the lines? I’m worried about performance

Oh, I find RegExpCursor .

Depending on what kind of parser/language you’re using, iterating through the syntax tree might be the most efficient and correct approach for this.

Thanks, I will try syntaxTree