Author Topic: List and search local symbols macro  (Read 77353 times)

lambertia

  • Senior Community Member
  • Posts: 382
  • Hero Points: 14
  • I have nothing sufficiently witty to say.
Re: List and search local symbols macro
« Reply #45 on: April 29, 2010, 09:18:45 am »
Hi.

In this particular case above, wouldn't it be more natural to type "write("?

Cheers,
--
Greg.

asandler

  • Senior Community Member
  • Posts: 303
  • Hero Points: 27
Re: List and search local symbols macro
« Reply #46 on: April 29, 2010, 12:33:22 pm »
Two problems with this. First it will only filter out all write_...() functions. But ..._write() will remain. Second, from some reason when I press ( in ols window, it shows $ sign.

@hs2, could it (the later) be because of keyboard layouts (i.e. German layout vs American)?

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: List and search local symbols macro
« Reply #47 on: April 29, 2010, 02:55:33 pm »
Hi Alex,
there is a special char '$' (like the regexp. line ending) to postfix-match the given pattern.
The '(' char is also mapped/guessed to this special char temporarily for 'better' C/C++ support until you continue typing.
Accordingly there is also a prefix-match char '^' ('!' is also auto-mapped to '^' when typing it).
So in your case you could e.g. use 'write$' as pattern or even more strict '^write$'.
Hope it helps,
HS2

PS: I'll have a detailed look at your posting later. Thanks !
« Last Edit: April 29, 2010, 03:01:53 pm by hs2 »

asandler

  • Senior Community Member
  • Posts: 303
  • Hero Points: 27
Re: List and search local symbols macro
« Reply #48 on: April 29, 2010, 07:18:16 pm »
Hi hs2,

I don't know if ^word$ will do the job - need some time to give it a try. In any case thanks for looking into it.

Alex.

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: List and search local symbols macro
« Reply #49 on: April 29, 2010, 08:20:17 pm »
Yep - please try it and tell me if it's ok or rather confusing...
Just for clarification:
(your sample use case)
'write$' would match:
write()
 just_write()

and '^write$' only write()
The additional regex keys as '!', '(' etc. are listed and commented in open_local_symbol.e [line 223]
Good luck, HS2

asandler

  • Senior Community Member
  • Posts: 303
  • Hero Points: 27
Re: List and search local symbols macro
« Reply #50 on: May 03, 2010, 12:36:36 pm »
I gave it a try. Indeed write$ matches .*write(...). However, ^write doesn't match anything. Could this be because write() is a class method? I.e. it tries to match ^write against class_name::write().

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: List and search local symbols macro
« Reply #51 on: May 03, 2010, 03:27:40 pm »
Yes - '^' resp. '$' affect the whole pattern. So a class method 'write' is exactly matched e.g. by ':write$'.
HS2

asandler

  • Senior Community Member
  • Posts: 303
  • Hero Points: 27
Re: List and search local symbols macro
« Reply #52 on: May 03, 2010, 07:36:22 pm »
Alright. This is basically what I was looking for.

I'd still think about adding some special syntax for this particular case. :write$ is a little cryptic if you ask me. Also, as you type the method name, you should know ahead that there are several methods named 'write something'. Otherwise you won't put colon ahead of the method name.

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: List and search local symbols macro
« Reply #53 on: May 03, 2010, 10:02:39 pm »
You're right. It's a bit .. special. OTOH if want an exact match of a C++ class method you might be aware of using the leading colon.. ;)
However, I've added the generic regexp chars time ago to cope with use cases like that just a bit better.
A possible approach could be to add some language specific additional delimiters. Up to now ols is merely language agnostic.
Please keep me informed if you find a better solution.

BTW: When not using 'strict word order' (see context menu>More Options) you could also append ':w' separated by a SPACE to the existing 'write$' pattern to eliminate some more ambiguous matches since the parts of the pattern are ANDed together on filtering.

Thanks for the feedback, HS2
« Last Edit: May 03, 2010, 10:07:18 pm by hs2 »

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: List and search local symbols macro
« Reply #54 on: June 11, 2012, 09:59:15 am »
It seems that there is bug in the SE v17 release which causes a 'deprecated' error when loading 'open_local_symbol.e'. I've already send a problem report.
However, for the time being a patch is required to use it with all supported SE versions.
I've re-uploaded a new version v4.0.8.4 here compatible again with SE >= v12.0.3.

Best regards, HS2

PS: I hope I'll find the time soon to rework the module a bit for better integration into SE (toolwindow, clipboard support, etc.).
But I think this will be based on v17.
« Last Edit: June 11, 2012, 10:01:43 am by hs2 »

dunkers

  • Senior Community Member
  • Posts: 633
  • Hero Points: 28
Re: List and search local symbols macro
« Reply #55 on: June 11, 2012, 08:45:19 pm »
Good job, HS2 :)

MindprisM

  • Senior Community Member
  • Posts: 127
  • Hero Points: 8
Re: List and search local symbols macro
« Reply #56 on: October 26, 2012, 08:55:49 am »
I don't know if this has been done, but I made some enhanced pattern matching for open_local_symbol v4.0.8.1

It takes the symbol names and then creates an abbreviation string for them, capturing logical transitions between case and non-alphas in a particular identifier. This is then integrated into OLS to operate when you enter a single word filter.

See the code documentation in the attached files for further info and integration instructions. @HS2, go ahead and pull this into your codebase if you like, though it probably needs some more testing/scrutiny.


eee

  • Community Member
  • Posts: 33
  • Hero Points: 2
Re: List and search local symbols macro
« Reply #57 on: November 23, 2014, 07:44:21 am »
Does not compile in vs 19 (2014).
Is there a new version anyplace? Perhaps a replacement?

eee

  • Community Member
  • Posts: 33
  • Hero Points: 2
Re: List and search local symbols macro
« Reply #58 on: November 23, 2014, 09:49:18 am »
Looks like 2 problems:
1. Some changes in the autohide api, I dosabled these just to get it to compile
2. looks like tag_get_num_of_context() (in init_tree()) sometimes (many-sometimes) returns 0.
I am not knowledgeable enough in these areas to solve these.
Help would be appreciated.

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: List and search local symbols macro
« Reply #59 on: November 23, 2014, 02:18:58 pm »
@eee: I'm going to take care about it. Hope I get it done soon. I'll also try to integrate the enhancement MindprisM provided.
HS2