Author Topic: List current context is showing the wrong context in python file  (Read 522 times)

rowbearto

  • Senior Community Member
  • Posts: 935
  • Hero Points: 43
List current context is showing the wrong context in python file
« on: December 07, 2017, 08:07:15 pm »
I uploaded a file to support.slickedit.com under "list_current_context_wrong", the file name is: nelayout.py

Open nelayout.py in a clean config.

In BigFind, check "List all occurrences", "Match case", "Match whole word" and "List current context"

Search For: "ShelfNum" with all these options, as illustrated in the attached "searchSettings.png"

In the search results (searchResults.png attached file), line 290 is shown as being inside of the "startSim()" python function, when it is really inside of the readFromConfigFile() function.

I am using 22.0.0.9 patched version for memory leak built on October 17, 2017. I am on Linux x64 Centos 7.


rowbearto

  • Senior Community Member
  • Posts: 935
  • Hero Points: 43
Re: List current context is showing the wrong context in python file
« Reply #1 on: December 07, 2017, 08:15:52 pm »
A possibly related issue in this same file:

Go to line 295
BigFind, check: "Match case", "Match whole word", "List all occurences" and "List current Context"
choose "Look in: Current procedure"
search term: "slotTypePattern"
see attached screenshot "searchSettings2.png"

Line 314 should be in the search results, but it is not there.

EDIT: CORRECTION, line 295 should be in the search results, but it is not there. Line 314 is there, but line 295 is missing!

EDIT2: The search results depend on where the cursor is placed on line 295. If cursor is before the "slotTypePattern", then only line 295 shown in search results (and 314 missing). If cursor is after the "slotTypePattern", then only line 314 shown in search results, and line 295 missing.
« Last Edit: December 07, 2017, 08:38:29 pm by rowbearto »

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1137
  • Hero Points: 103
Re: List current context is showing the wrong context in python file
« Reply #2 on: December 07, 2017, 09:22:23 pm »
Thanks for the report and the sample.  The second bug report I can confirm is already fixed in in Hotfix revision 11, there was a bug with List all and <Current Procedure> not working correctly.

The first one is a limitation in context handler for the search results. For line 290, the tagging engine reports the current context as a member variable instantiation for self.ShelfNum, which is correct.  Currently for search results, it only cares if the current context is function/procedure type and and isn't searching for outer contexts.  There are plans to expand current context feature for search results in a later release, but it is going to need a lot more work.  It is very limited at this time. 

Also, there needs to be a visual separator for when a specific function context ends, and the next item is in an unlisted context type (or global context).  In the first example, if you double-click to collapse the -/+ on the NELayout::Slot::startSim() function, you can see that only line 203 is grouped under that context.   There isn't a separator following it for the results on 290, and it looks like they are grouped when they shouldn't be.  That one I should be able to hotfix.

rowbearto

  • Senior Community Member
  • Posts: 935
  • Hero Points: 43
Re: List current context is showing the wrong context in python file
« Reply #3 on: December 07, 2017, 09:44:01 pm »
Thanks.

I just loaded hotfix 11 and the 2nd issue is still there.

Also also click the +/- on startSim, but I see a different result than you (see attached).

« Last Edit: December 07, 2017, 09:46:38 pm by rowbearto »

rowbearto

  • Senior Community Member
  • Posts: 935
  • Hero Points: 43
Re: List current context is showing the wrong context in python file
« Reply #4 on: December 09, 2017, 04:45:41 pm »
Both of these issues are also there with hotfix 13.

rowbearto

  • Senior Community Member
  • Posts: 935
  • Hero Points: 43
Re: List current context is showing the wrong context in python file
« Reply #5 on: January 05, 2018, 03:46:37 pm »
Just checked this in 22.0.1, it appears both problems still there, but first problem changed slightly.

For 1st issue (search on ShelfNum) the context now shows as: "--------:". See attached screenshot. Note that I have different line numbers than my original example as this file has changed since then.

For the 2nd issue (search on slotTypePattern in current procedure), it is still showing only 1 result instead of both, the result shown depends on where the cursor is.

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1137
  • Hero Points: 103
Re: List current context is showing the wrong context in python file
« Reply #6 on: January 05, 2018, 04:13:35 pm »
For the first one is a separator denoting the end of the startSim contest.  It's inserted there because the following context on line 364 is not part of startSim(), and but in an context that isn't currently labeled in Search Results (class/struct/namespace) or global context.  Going to be an issue an until Search Results can handle nested contexts.

I am able to reproduce the second issue.  There is a definitely an issue with generating procedure range, select-proc command is affected and the results definitely do not look right.  Filing a defect on that one, see what we can do with that one.

rowbearto

  • Senior Community Member
  • Posts: 935
  • Hero Points: 43
Re: List current context is showing the wrong context in python file
« Reply #7 on: January 05, 2018, 04:17:54 pm »
Thanks for taking a look Lee.

rowbearto

  • Senior Community Member
  • Posts: 935
  • Hero Points: 43
Re: List current context is showing the wrong context in python file
« Reply #8 on: January 05, 2018, 04:18:53 pm »
Is handling nested contexts going to be fixed in a 22 point release?

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1137
  • Hero Points: 103
Re: List current context is showing the wrong context in python file
« Reply #9 on: January 05, 2018, 09:42:37 pm »
Not likely, more likely a feature for v23.

rowbearto

  • Senior Community Member
  • Posts: 935
  • Hero Points: 43
Re: List current context is showing the wrong context in python file
« Reply #10 on: January 08, 2018, 02:02:57 pm »
OK - well them maybe you can log it as a feature request or bug report so that it won't get lost?