Author Topic: Find Symbol - Exact  (Read 1099 times)

jporkkahtc

  • Senior Community Member
  • Posts: 1792
  • Hero Points: 175
  • Text
Find Symbol - Exact
« on: June 22, 2017, 11:46:43 pm »
In FindSymbol the default is prefix matching.
So, if I type "max" in SearchFor, it finds tons of stuff from lots of system headers.
If I really only want to find max, as in a function called "max()", or a macro called max, it is a pain.
I can turn on RE matching and type "^max$", but I'm just too lazy - and that makes the matching *much* slower.

I assume that when "Match substring" is off, then the results should be the same as matching with RE and prefixing with ^, right?

Exact matching doesn't even need to have a checkbox, just sort the results differently --- put exact matches first.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2747
  • Hero Points: 420
Re: Find Symbol - Exact
« Reply #1 on: June 23, 2017, 07:58:49 pm »
Try "::max" to restrict the search to instances outside of classes.  Then the exact matches should be at the top of the list (unless you have substring or regex enabled).

jporkkahtc

  • Senior Community Member
  • Posts: 1792
  • Hero Points: 175
  • Text
Re: Find Symbol - Exact
« Reply #2 on: June 23, 2017, 08:36:16 pm »
That doesn't work -- FindSymbol, AFAIK, has never allowed names to include namespace or class names as part of the symbol.

Any string with "::", ".", "/" separators always returns no results.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2747
  • Hero Points: 420
Re: Find Symbol - Exact
« Reply #3 on: June 23, 2017, 09:26:15 pm »
It does if you have "Look in:" set to "<Use Context Tagging(R)>", which uses the current document to determine the scope of the symbol search.

I was also assuming you were in C++.

jporkkahtc

  • Senior Community Member
  • Posts: 1792
  • Hero Points: 175
  • Text
Re: Find Symbol - Exact
« Reply #4 on: June 23, 2017, 09:53:36 pm »
Interesting, I've never been able to make much sense of LookIn: Its really confusing (due to the available options, and the behaviors of those options, lack of documentation, and whatever else its behavior is conditional upon).

While exactly "::max" works as you say, "::" in general does *not* work correctly (or at least not reasonably).

When set to "Use context tagging":
"LocalMaxProfile::max" --> Matches things C:\Program Files/Reference Assemblies/Microsoft/Framework/v3.0/PresentationCore.dll"

"LocalMaxProfile.max" --> Same

"LocalMaxProfile/max" --> Matches global scope things in various *.cpp and *.h files.
                    Change "LocalMaxProfile" to anything non-empty string and the results are the same.


Given that is it "Context tagging", why does it ever match anything that isn't C/C++ when I'm looking up C++ stuff? (My project type is Other C/C++)

Why do I feel confused?

Please try those examples, as well as
    ::max
    /max
    .max
How does this behavior make sense?


Also, why then doesn't it work when LookIn is set to "c/c++"?