Author Topic: Smart Open finds files from previous projects when it shouldn't  (Read 3507 times)

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Sometimes I have multiple copies of my source code in different directories - due to working with different branches in git.

When I switch SE workspaces from one of these directories to another, and then I look for a file in the "Smart Open", it is finding files in my old workspace (different directory) that I closed and am no longer using. Then I need to be really careful which file I choose. Due to this, I've been fully closing SE and reopening it whenever I switch workspaces.

I created a test project so SlickTeam can reproduce. I uploaded it to support - see sopen_multiproj.tar.gz.

The issue does not happen with a clean config, so my .tar.gz file has many files from my config to aid reproduction.

Here are the steps to reproduce.

0. Apply my SE configuration as included in the .tar.gz file (doesn't seem to reproduce with clean config)
1. Project->Open Workspace choose prj1/myprj.vpw
2. In Smart Open, type "test.cpp" and open the prj1/test.cpp file
3. On line 10, highlight "printFunc()" and press Ctrl+/ to find all references.
4. Project->Open Workspace, choose prj2/myprj.vpw
5. File->Close All to get rid of the test.cpp file from prj1 that is still open
6. Type "test.cpp" into smart open, observe that the test.cpp from ../prj1 is listed there when it should not be! See attached screenshot.

Thanks for taking a look. I'd rather not need to close SE and reopen it whenever I switch workspaces.

I'm using 22.0.2.1 with hotfix 11 on Linux x64.
« Last Edit: July 16, 2018, 02:00:14 PM by rowbearto »

Dennis

  • Senior Community Member
  • Posts: 3955
  • Hero Points: 515
Re: Smart Open finds files from previous projects when it shouldn't
« Reply #1 on: July 16, 2018, 02:21:41 PM »
Right click in the file list for the Smart Open tool window.  Under "Options", uncheck "Show/match files in history".

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: Smart Open finds files from previous projects when it shouldn't
« Reply #2 on: July 16, 2018, 02:28:20 PM »
That is currently unchecked in my smart open, and I still have this issue. You should be able to see that in the configuration that I sent.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: Smart Open finds files from previous projects when it shouldn't
« Reply #3 on: July 16, 2018, 08:04:14 PM »
Reproduced. You do have that option unchecked. Thanks for taking the time to give us a small test case.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: Smart Open finds files from previous projects when it shouldn't
« Reply #4 on: July 16, 2018, 11:03:37 PM »
There are two bugs. First bug is that the smart open options are not being displayed. Second bug has to do with the "Show/match files in current file directory" option. It's on by default (hard to turn off now since the option isn't visible). When the last file is closed, there's a bug where this match list isn't being cleared. Both bugs were trivial to fix.

This will be fixed in the next hotfix build.

Since you're a pretty advanced user, I've attached the latest 22.0.2 version of this macro. I'm not sure if the first problem will just go away if you load this new tbopen.e (it may require a new state file). The more important fix is the second issue.

Thanks again for helping us find this.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: Smart Open finds files from previous projects when it shouldn't
« Reply #5 on: July 17, 2018, 01:39:20 PM »
Thanks for the quick investigation and fix Clark!

I have not applied the latest version of the macro yet. Before applying it though, I do see the "Show/match files in current file directory", see attached screenshot, contrary to what you wrote.

Before applying the fix, I have some questions:

1) To apply it, I open the tbopen.e file in the editor and then do <ESC>load, correct? Does the tbopen.e file need to be in any special directory when I open it?
2) What happens when the official hotfix is available later. When I apply it, it will overwrite the tbopen.e file that I manually loaded from another location?
« Last Edit: July 17, 2018, 01:42:28 PM by rowbearto »

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: Smart Open finds files from previous projects when it shouldn't
« Reply #6 on: July 17, 2018, 02:17:44 PM »
These options are also supposed to be displayed in Tools>Options>File Options>Open.  At least the context menu has them.
« Last Edit: July 18, 2018, 01:30:49 AM by Clark »

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: Smart Open finds files from previous projects when it shouldn't
« Reply #7 on: July 18, 2018, 01:26:35 PM »
Thanks Clark.

What about my other questions:

Before applying the fix, I have some questions:

1) To apply it, I open the tbopen.e file in the editor and then do <ESC>load, correct? Does the tbopen.e file need to be in any special directory when I open it?
2) What happens when the official hotfix is available later. When I apply it, it will overwrite the tbopen.e file that I manually loaded from another location?

Thanks,
Rob

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: Smart Open finds files from previous projects when it shouldn't
« Reply #8 on: July 18, 2018, 11:47:51 PM »
1 you won’t have a problem UNLESS there macro files of the same name that it imports/includes that are the wrong version. Put it in a directory by itself to be sure
2 it will get replaced. No problem

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: Smart Open finds files from previous projects when it shouldn't
« Reply #9 on: July 19, 2018, 01:48:34 PM »
Thanks Clark.

Would it work to put the new tbopen.e file into the installation directory where the original tbopen.e file is - <installdir>/macros/tbopen.e (of course I would keep a backup of the original file there), and then "load" it?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: Smart Open finds files from previous projects when it shouldn't
« Reply #10 on: July 19, 2018, 02:31:32 PM »
Not if you’re on windows. The uninstall won’t remove the file. Other platforms don’t have that problem.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: Smart Open finds files from previous projects when it shouldn't
« Reply #11 on: July 19, 2018, 05:30:17 PM »
I applied the new tbopen.e and it fixed the issue for me on the sample project! Thanks! I also now see "Show/match files in current directory" in the File Open options. I'll let you know if I still any issues on my real project while I use it.

I notice that there are many more items that appear in the smart open context menu that don't appear in Tools->Options->File Options->Open. You mentioned "Show/match files in current directory", but there are others that I see in the context menu that are not in the tool window, such as "Show hidden files", "Show all siblings", "single-click to change directory", "Auto size columns", "Show relative paths" and the "View" sub-menu.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: Smart Open finds files from previous projects when it shouldn't
« Reply #12 on: July 21, 2018, 05:18:08 PM »
The "Show hidden files" option is in the options dialog but with the correct name "Show dot files". We'll have to fix that.

Having the options in the context menu is easier to find. However, it's good when more options are in the Options dialog so they can be exported. I'll see if we get more of these in the Options dialog. The new v23 minimap options have a similar issue. In the case of the minimap, trying to set the options from the options dialog would be quite the pain (when you see how you configure it, you'll see--minimap font is in the options dialog but none of the others). The downside is that these options aren't exported. It would be nice if the options engine supported "hidden" options (options that aren't displayed but get exported/imported).