Find in Files keeps defaulting to Directory

It doesn't seem to remember what I last used, and I typically need it for In Project.

I'm not seeing an option to default to "last used" upon open.

I usually open it using the keyboard shortcut Cmd+Shift+F.

 

8 comments
Comment actions Permalink

Hi there,

A bit more context is needed here.

The thing is: if you invoke the shortcut when focus is in the Project View panel then "Directory" option (and corresponding path) will be pre-selected. But if it's invoked while the focus is in the Editor area then the last used scope/option is selected.

This is how it works for a few years now (works fine for me here on Windows 10; v2021.1.3).

 

0
Comment actions Permalink

OK when I test, that's how it's working; but I'm not in the Project panel anywhere near as often as the file tabs... so I'm not sure how it's changing contexts so often.

Maybe I'm using the Project panel more often than I think, so I'll pay more attention to that. I am learning some of these repos so maybe I'm using the Project panel more often than I'm used to.

0
Comment actions Permalink

I did a few simple experiments here and this is what I can say:

  • If you close Find in Files popup (using Esc) it will bring the focus back where it was at the moment of invocation (assuming you have used keyboard shortcut to call Find in Files and not mouse and main menu as when using a main menu some Scopes will not be available (e.g. Selected Files)). Next time you see such unexpected change -- check where the focus was using the above method.
  • Other tool windows that have references to a specific file may also change to Directory option. For example: Problems toolwindow -- if invoked from "Current File" tab it will change to Directory. If done the same from the Project Error tab it will remain as before.
    At the same time the Find Results toolwindow (the one that shows ALL found results -- when you use "Open in Find Window" button in Find in Files) does not produce such behaviour.
  • If you invoke Find in Path using shortcut while another file-related popup is opened (e.g. use "Navigate | File", enter some file name that is present in a few different folders) then once invoked Find in Files will have Directory option selected (and the path set to the focused file from that popup).

So yes, do your observations and try to spot your patterns.

BTW -- you can quickly focus the Editor from any tool window by pressing Esc (should be the default key in all keymaps). If not -- check  "Editor Actions | Focus Editor" action on Keymap screen.

 

P.S. Originally Find in Files (Find in Path back then) was always using Whole Project scope and not remembering the previous scope. You can check comments in https://youtrack.jetbrains.com/issue/IDEA-87037 for some more info if you wish.

0
Comment actions Permalink

OK so I found in one case, when the focus was last in the Project panel, if I select some text from one of the open files (as in, left-click to the left or right of a character then drag the mouse over text to select it), then open Find in Files using the keyboard shortcut, the selected scope will be Directory.

So selecting text that way in an open file tab will not change the focus to that tab :/ I rarely use Directory scope, and haven't needed it for weeks, so I know I hadn't clicked it previously today.

Meaning most of the time I do that, which is often enough to make a post about it, I'll have to click Project because that's usually the scope I need Find in Files to be in.

I can click into the file first, then highlight text, but that's adding up a lot of steps that are counter-intuitive and should probably be unnecessary.

Any thoughts on that? I think JetBrains can fix that, at least have it behave intuitively.

0
Comment actions Permalink

Any thoughts on that? I think JetBrains can fix that, at least have it behave intuitively.

PhpStorm Issue Tracker is the place where you can report bugs and feature requests.

0
Comment actions Permalink

OK so I found in one case, when the focus was last in the Project panel, if I select some text from one of the open files (as in, left-click to the left or right of a character then drag the mouse over text to select it), then open Find in Files using the keyboard shortcut, the selected scope will be Directory.

I could not reproduce this on my Windows 10.

Could be my set up (i.e. some plugin -- e.g. I'm using custom plugin for Quick Preview instead of the new built-in functionality and it may change things) .. or platform dependant issue.

Can you make some short video/screencast (show Find in Files working OK first (Project scope selected), then reproduce the issue). Maybe I'm doing it wrong + will help JetBrains folks reproducing it as well.

0
Comment actions Permalink

I discovered that Find in Files (using the keyboard shortcut) will also default to Directory if I was just using the Find or Replace box (at the top of the file tab) even while last editing code in the file and not having clicked anything in the Project panel for a while. So, that's really irritating, because I use Find and Replace a lot.

 

0
Comment actions Permalink

Vadiru, it must be this one: https://youtrack.jetbrains.com/issue/IDEA-270761
Please check how it goes in 2021.2 EAP #5 once we release it today.
https://blog.jetbrains.com/phpstorm/
https://www.jetbrains.com/phpstorm/nextversion/

Update: Sorry, the fix is actually already available, our EAP #5 took place a week ago.

1

Please sign in to leave a comment.