+1

Awesome incremental symbol find

Pau Sanchez 6 years ago 0

The idea is to use something similar to "Go to anything" where you only type some letters that are contained in the symbol you want to go to, and you automatically go to symbols containing those letters in that order, but limiting the search to symbols inside the document (since most languages, if not all, support the same pattern for symbols, and you don't want to search text or anything like that, just references to functions or variables).


Imagine you have a document like this:

void function () {

   doSomething (whatever, "this is a string");

   if (runUltraComplexCheck (var1, var2)) {

      simple_variable = 1;

      doSomethingElse ();

   }

}


Now, the idea is that if you are at the beginning of the document and you run "incremental symbol find" and you press "f" the first word "function" would be selected. If I type "d" then the first "doSomething" would be selected, and so if I run find next, then the "doSomethingElse" symbol would be selected. It should behave as a normal search so find previous and find next would work.


On the other hand, imagine I want to go to "doSomethingElse", then I go to incremental symbol search and type "dse" then automatically doSomethingElse would be selected. In the same scenario, typing "ru" or "rucc" or "run" or "rcheck" would all select "runUltraComplexCheck", which is the only word in that document matching that pattern.


Again, if you type "sv" in incremental symbol search, you would go to "simple_variable".


I think this kind of feature would be as awesome as "Go to Anything", and no other editor has something like this... I guess it can be written using a plugin, but anyway, native would be great.


To sum up the features:

  • incremental symbol find inside current doc
  • a symbol is defined as [_a-zA-Z][_a-zA-Z0-9]+
  • discard searching inside comments
  • discard searching inside text strings
  • be able to use find next / find previous