Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PyCharm-like open resource dialog to quickly open files #623

Open
GoogleCodeExporter opened this issue Aug 24, 2015 · 5 comments
Open

Comments

@GoogleCodeExporter
Copy link

Currently the only way to quickly open a file in PyScripter is to look for it 
on the project tab and double click it with your mouse. This works well when 
there are not many files, but when your project is big, with many files, it can 
be quite slow and cumbersome. It would be great to have a better alternative 
that scaled better with the number of files in your project.

A good solution would be to replicate PyCharm's "Open Resource" dialog. This is 
a dialog which can be used to look for files whose filename matches some text. 
Using this dialog you can quickly find and open any file on your project.

Many other editors have similar functionality. For example Eclipse has it as 
well (and uses the same keyboard shortcut as PyCharm, Ctrl+Shift+r).

Perhaps the gold standard for this feature is TextMate, which I believe was the 
first one to introduce this type of functionality (Texmate used Ctrl+T as the 
shortcut for this feature, and this was copied by most other editors except 
Eclipse). Examples of editors that copied this feature from TextMate are 
SublimeText and VIM (through several plugins, such as Command-T and 
FuzzyFinderTextMate).

The way this feature usually works is that you type the corresponding keyboard 
shortcut (e.g. Ctrl-T) and you get a modal dialog with an editbox. You can then 
start typing any part of the name of the file that you want to open, and you 
get a list of files matching the text that you typed (usually using glob 
syntax). You can hit ENTER at any time, which opens the topmost file in the 
list of matches. You can also use the up and down arrows to select which file 
to open, followed by ENTER to actually open it.

Some editors take this concept further, and let you also select the line or 
function that you want to go to in the selected file. This is usually done by 
adding "@" after the filename, followed by the line number or the function name 
that you want to go to. For example, typing "myfi@123" (without the quotes) 
would open the file "myfile.py" (assuming there were no other files starting 
with "myfi") and place the cursor on the line 123. Typing "*opener" would show 
a list of the files containing "opener", typing "*opener@_init" and hitting 
enter would open the first file whose name contained "opener" and place the 
cursor at the first function called "_init".

This is definitely the feature I miss the most from PyCharm when I use 
PyScripter, so I hope it can be implemented!

Original issue reported on code.google.com by angel.ez...@gmail.com on 17 Mar 2012 at 8:53

@GoogleCodeExporter
Copy link
Author

Did you know that the Project Explorer supports incremental search.  Just type 
quickly the first few letters of the filename to find the file.  Then 
double-click to open it.

In the forthcoming version, I have changed incremental help so that it matches 
any part of the filename in a case insensitive manner. 

Original comment by pyscripter on 18 Mar 2012 at 3:19

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Thank you for the reply. I knew that you could type something on the project 
explorer and that the focus would move to the corresponding file. What I did 
not know is that it takes into account more than the first letter in the 
filename. I thought it just took you to the first file whose name began with 
the letter that you typed.

In my opinion this is not quite as useful as PyCharm's or Eclipse's open 
resource dialog for many reasons:

1. There is no keyboard shortcut to start the search. That means that you must 
first select the Project Explorer, and then start typing.

2. You don't see what you typed, and you cannot correct it.

3. You don't see all the matches at once. The focus is simply moved to the 
first item matching what you typed. If you have plenty of files with similar 
names in different folders this does not help you at all

4. It is hard to tell what you are looking for. PyScripter seems to reset the 
search string after a little while, so if you wait a little too long the search 
begins again.

5. It does not let you use glob patterns.

6. This does not let you select the line or function that you want to open.

In addition, I personally have the Outline view and the Project Explorer docked 
on top of each other. I generally like to keep the Outline view active most of 
the time. Following your suggestion means that I must first select the Project 
Explorer tab, type, open the file and then select the Outline view again. All 
these are mouse based operations, which IMHO break the flow considerably.

So I'd like to kindly ask you to consider reopening this issue.

If you don't want to create an actual dialog for this feature, I think that 
there are a few things that you can do to improve the way things currently work:

1. Add a "filter editbox" to the Project Explorer, where you can type the 
filename that you are looking for. The filter could be hidden by default, 
although it could be always shown as well.

2. Add a keyboard shortcut (e.g. Ctrl-t) that will activate the project 
explorer panel and show and/or give the focus to the filter box.

3. Whenever something is typed on the Project Explorer filterbox, hide any 
files that do not match the filter contents

4. Add glob support to the filterbox.

5. Add support for selecting the line or function that you want to go to.

6. After hitting ENTER, restore the state of the project explorer. That is, if 
the Project Explorer was not on top or if it was hidden before typing the 
filename search keyboard shortcut, e.g. Ctrl-t, hide it again or return it to 
its original state.

I hope that you can consider at least some of these. As I said, this is the 
main feature that I miss in PyScripter after having used PyCharm for a while. 
It makes working with big projects much easier. It is particularly useful when 
you are exploring someone else's code.

Original comment by angel.ez...@gmail.com on 18 Mar 2012 at 11:07

@GoogleCodeExporter
Copy link
Author

OK, I will keep the issue open.  

Original comment by pyscripter on 18 Mar 2012 at 11:50

  • Changed state: Reopened

@GoogleCodeExporter
Copy link
Author

Thank you. I really appreciate it!

I'm sure this will be a great improvement to PyScripter :-)

Original comment by angel.ez...@gmail.com on 18 Mar 2012 at 1:10

@GoogleCodeExporter
Copy link
Author

Yes, just spent a bit of time searching for this ability and was saddened to 
see it is not incorporated. Any updates on this feature addition?

Original comment by ruddogs...@gmail.com on 19 Aug 2015 at 3:23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant