Home Download Buy Blog Forum Support

Favorite Files

Favorite Files

Postby facelessuser on Tue Mar 20, 2012 3:46 am

I saw a post earlier today asking about a way to access favorite files that are not found in projects, and I thought that it would be a fairly easy plugin to write.

So here it is: https://github.com/facelessuser/FavoriteFiles

You can add and remove files via the command palette. And you can access your files via a quicklist with a command.

It keeps a json file in your User folder with all of your favorite files.

I just put it together, so let me know if you find any bugs or if you have any suggestions.
facelessuser
 
Posts: 1565
Joined: Tue Apr 05, 2011 7:38 pm

Re: Favorite Files

Postby phillip.koebbe on Tue Mar 20, 2012 11:40 am

facelessuser wrote:I saw a post earlier today asking about a way to access favorite files that are not found in projects, and I thought that it would be a fairly easy plugin to write.

So here it is: https://github.com/facelessuser/FavoriteFiles

You can add and remove files via the command palette. And you can access your files via a quicklist with a command.

It keeps a json file in your User folder with all of your favorite files.

I just put it together, so let me know if you find any bugs or if you have any suggestions.


I *told* you you'd find something else to do :lol:

The funny thing is, I was just thinking about this myself, *yesterday*. Though, in my imaginary world, I would be able to name groups of related files. For example, one of the projects I work on is a PHP application that uses Smarty for templating. While this particular application doesn't use any kind of framework, I have been trying to bend it to my will over the past few years, applying what I've learned about structure from other projects (Rails and such). I tend to have a PHP file that is something like a controller, another one that is something like a model, a JavaScript file, a CSS file, and the related Smarty templates. I have these collections for each functional area of the application. I was thinking it would be nice to be able to gather these files together in some settings file under a common name and be able to open them all at once, almost like subprojects but not quite.

I'll take a look (when I have time) at what you started and see if it might get me part of the way there.
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Favorite Files

Postby facelessuser on Tue Mar 20, 2012 1:45 pm

phillip.koebbe wrote:I *told* you you'd find something else to do :lol:


I didn't mean to...it just sounded like a good idea :D.

phillip.koebbe wrote:I was thinking it would be nice to be able to gather these files together in some settings file under a common name and be able to open them all at once, almost like subprojects but not quite.


So you would treat the group as one entry, and when selected open all the files under the group? Would this be an optional thing? What I mean is that a group could be opened all at once or each file individually on demand or always opened as a group?

Doesn't sound like it would be too difficult thing to add.
I would probably opt to have it work either way. Allow the creation of groups for organization (probably only one level deep, but if people really want I could make it many levels deep), but also have an "Open Favorite Group" command that would only display groups.

I also plan to add a command that can search your favorite list and remove files no longer available.

I will probably also make the reloading of the favorites file more robust. It really doesn't reload if someone modifies the favorites file by hand (it just does it after so long), but I probably should allow that because people will do it anyways.

I'll keep playing with it before I submit it to Package Control. Good idea though, I will try to get it in there sometime soon.
facelessuser
 
Posts: 1565
Joined: Tue Apr 05, 2011 7:38 pm

Re: Favorite Files

Postby phillip.koebbe on Tue Mar 20, 2012 2:37 pm

facelessuser wrote:
phillip.koebbe wrote:I *told* you you'd find something else to do :lol:


I didn't mean to...it just sounded like a good idea :D.


That's the thing about programmers: reduced to the lowest level, we are just problem solvers, and when we encounter a problem that we think needs to be solved, not much can stop us ... except someone else solving the problem first, in an acceptable way of course ;)

facelessuser wrote:
phillip.koebbe wrote:I was thinking it would be nice to be able to gather these files together in some settings file under a common name and be able to open them all at once, almost like subprojects but not quite.


So you would treat the group as one entry, and when selected open all the files under the group? Would this be an optional thing? What I mean is that a group could be opened all at once or each file individually on demand or always opened as a group?


Yes, I was thinking of something pretty straightforward, like all open files in the active group can be saved under some label. I wouldn't want it too complicated, or I wouldn't use it.

facelessuser wrote:Doesn't sound like it would be too difficult thing to add.
I would probably opt to have it work either way. Allow the creation of groups for organization (probably only one level deep, but if people really want I could make it many levels deep), but also have an "Open Favorite Group" command that would only display groups.


Yes, definitely allow it work for saving individual files or groups. I will use both, a lot.

I'm not exactly sure what you mean by "many levels", but, speaking solely for myself, I can't currently think of how multiple levels of favorites would be helpful. I can see individual files and groups of files. Unless you mean something like "all payment processing files" and then further refined as "all paypal files". If that's what you mean, I can see someone potentially using that, but that person could just open the specific files and create another saved favorite group. No need to make the plugin more complicated than it needs to be.

facelessuser wrote:I also plan to add a command that can search your favorite list and remove files no longer available.


Good ideas. A keystroke sensitive live search like the Go Tos would be nice.

facelessuser wrote:I will probably also make the reloading of the favorites file more robust. It really doesn't reload if someone modifies the favorites file by hand (it just does it after so long), but I probably should allow that because people will do it anyways.

I'll keep playing with it before I submit it to Package Control. Good idea though, I will try to get it in there sometime soon.


Let me know if you want a beta tester.
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Favorite Files

Postby facelessuser on Tue Mar 20, 2012 4:19 pm

phillip.koebbe wrote:Yes, I was thinking of something pretty straightforward, like all open files in the active group can be saved under some label. I wouldn't want it too complicated, or I wouldn't use it.


Cool, I can do that.

phillip.koebbe wrote:Yes, definitely allow it work for saving individual files or groups. I will use both, a lot.


Great!

phillip.koebbe wrote:Good ideas. A keystroke sensitive live search like the Go Tos would be nice.


Because I am using the quick panel, you should automatically get the fuzzy search stuff.

phillip.koebbe wrote:Let me know if you want a beta tester.

A tester would be great. I'll let you know when I get all of the above items in.
facelessuser
 
Posts: 1565
Joined: Tue Apr 05, 2011 7:38 pm

Re: Favorite Files

Postby facelessuser on Tue Mar 20, 2012 7:55 pm

Some updates:

The biggest thing is I made FavoriteFiles more forgiving of people mucking around with the file list. It will now accept C style comments like other settings files, but it will also be forgiving of those pesky trailing commas. It now will also auto-reload only if the file list has been modified. There was also an issue where if you canceled the quick lists (open file or remove favorite) it would not actually cancel.

I will try to play around with groups tonight.
facelessuser
 
Posts: 1565
Joined: Tue Apr 05, 2011 7:38 pm

Re: Favorite Files

Postby phillip.koebbe on Tue Mar 20, 2012 8:40 pm

More forgiving is good. Really good.

Um, I just thought of something I'd really, really like to be able to do, and since you are always saying, 'Oh, that should be easy' ...

I'd like to save favorites by project. Yes, I know that the original intent was to save favorites that aren't part of a project, but let me explain my thinking here. I work on one project that is sports-related and I would like to have favorite groups for seasons, leagues, teams, coaches, etc. I work on another project that has nothing to do with any of those things, and being the Type A personality that I am, I don't want to see them when they are not applicable.

Doable?

On an ever-so-slightly-related note, I'd also like to have command line history that is directory-dependent. I've done some searching around and experimenting, but haven't found anything that works. If you (or anyone else) come across something that works, puh-lease let me know.
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Favorite Files

Postby facelessuser on Tue Mar 20, 2012 9:15 pm

phillip.koebbe wrote:More forgiving is good. Really good.


Be strict on output, but easy on input ;). Seems to be the best way to do things.

phillip.koebbe wrote:I'd like to save favorites by project. Yes, I know that the original intent was to save favorites that aren't part of a project, but let me explain my thinking here. I work on one project that is sports-related and I would like to have favorite groups for seasons, leagues, teams, coaches, etc. I work on another project that has nothing to do with any of those things, and being the Type A personality that I am, I don't want to see them when they are not applicable.

Doable?


Doable...yes. The problem is how would I approach it. I will tell you how I would like to approach it if I did this (this would happen after I get the basics all finished). By default, a project would have no favorites or support for favorites, but if you enabled favorites for that project, I would store the favorites file in the root of the project. Then when you request a favorite, you would first be presented with a menu asking if you want to see Global or Project favorites, and the appropriate list would be displayed depending on your answer.

phillip.koebbe wrote:On an ever-so-slightly-related note, I'd also like to have command line history that is directory-dependent. I've done some searching around and experimenting, but haven't found anything that works. If you (or anyone else) come across something that works, puh-lease let me know.


I'll let you know if I come across something that works, but I don't know when/if I would get around to looking into something like that.
facelessuser
 
Posts: 1565
Joined: Tue Apr 05, 2011 7:38 pm

Re: Favorite Files

Postby facelessuser on Tue Mar 20, 2012 10:50 pm

Groups is going to require a re-factoring of the code...sigh. The current format for saving favorites is getting trashed.

I think I am going to remove requiring the user to give an alias for favorite files. If you want to add a bunch of files to a group in one shot, needing aliases is just not going to work. I will manage them internally. When you open your list in the quick panel. Each file will be listed like so. Or something like this. I am going to have to play around to see the best way to show these.

Code: Select all
file_name
full/path/to/file


Groups will probably be listed something like:

Code: Select all
Group: name
7 files


A simple project slowly getting more complicated. Oh well, it is for the better :) .

I then plan on having two commands for opening files. (this might also get reduced to one command that then gives you the option to open the entire group when you select the group)
-Open File
-Open Group

I then plan on having two set commands. (this might also get reduced to one command that then gives you the option)
-Add File
-Add All Open Files

The open commad(s) will just open a menu and with three options (probably No Group first):
-Create Group
-Add to Group
-No Group

All required user interaction will be quick panel driven except for entering the group name. Hopefully this will all work out well.
facelessuser
 
Posts: 1565
Joined: Tue Apr 05, 2011 7:38 pm

Re: Favorite Files

Postby facelessuser on Wed Mar 21, 2012 3:15 am

Groups is in.

Version 0.2.0
- File list now reloads on modification only
- File list is forgiving if modified by hand
- Fix issues with canceling quick list
- Added groups
- favorite_files.json renamed to favorite_files_list.json (new format)

If you were using this already you can delete favorite_files.json from User. The new file is favorite_files_list.json. Had to change the format to support groups.

You can now add the current file, all files in a window group, or all files in a window. You can add the files to the global favorite list, an existing favorite group, or a new favorite group. You can open a file from a group or a file from the global list, or you can open all files in a favorite group.

And that is all I am doing tonight.

Please give it a test and let me know how it works. Let me know about bugs or suggestions.
facelessuser
 
Posts: 1565
Joined: Tue Apr 05, 2011 7:38 pm

Next

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 9 guests