Home Download Buy Blog Forum Support

Favorite Files

Re: Favorite Files

Postby facelessuser on Sun Mar 25, 2012 7:23 pm

vitaLee wrote:@facelessuser i haven't tried this plugin yet but 'project specific favorites' feature reminded me i thought some weeks ago that similar feature would be useful in RegReplace. in a way to avoid polluting menu with replace commands specific to some projects.
i know it's not the right place to mention this idea but anyway im dropping it :)


Maybe in the future. I would have to think about how to do it. You can not have project specific commands. But if you had maybe one command that could read a list of some command, you could do it, but that would take some refactoring.

In all honesty I probably should have had Favorite Files under the development section. I released a real simple version, and I thought I was done, but @phillip.koebbe had different ideas :) .

Even now I am still going back and forth on whether to store the settings in the project file, or create a separate file in the same folder as the project file. I just started thinking that people may be version controlling their project file and might not want their favorites stored in it. Had I known I was going to add all of these I would have held off on a release thread.

I will consider RegReplace in the future for project stuff, but I don't imagine jumping straight into it.
facelessuser
 
Posts: 1570
Joined: Tue Apr 05, 2011 7:38 pm

Re: Favorite Files

Postby facelessuser on Sun Mar 25, 2012 9:51 pm

Okay, this is it.

I decided to store settings in the same directory as the project settings, but not in the project settings file. This is because people might be version controlling their project file, and I don't want to put stuff in it they don't like.

I added some code to perform a session refresh so I can find project files. So, if I can't find a project file, I will refresh the session and try 1 more time. If the window does have a project file, I can then find it. You might see a tab pop up and disappear when performing the refresh. This is only needed on newly opened projects when no file has been saved since opening the project.

Basically, I am opening a dummy file, performing a save, and then I close it to refresh the session. If there are no views open, I will not close the dummy file so your window will not automatically close. It will look like this:

Code: Select all
        ______                       _ __          _______ __         
       / ____/___ __   ______  _____(_) /____     / ____(_) /__  _____
      / /_  / __ `/ | / / __ \/ ___/ / __/ _ \   / /_  / / / _ \/ ___/
     / __/ / /_/ /| |/ / /_/ / /  / / /_/  __/  / __/ / / /  __(__  )
    /_/    \__,_/ |___/\____/_/  /_/\__/\___/  /_/   /_/_/\___/____/ 

Attemping to refresh session...

This view is used to refresh your session in order to find the project file if it exists.
To prevent the window from closing, this view will remain open if only one view remains.


That is it. By doing this ridiculous little task, I am able to update the Auto Save Session.sublime_session file, and then can find where the project file is and store the favorites file with it.

Per project favorites must be toggled on in a project, so by default, you are using the global list. When you want to see project specific favs, you use the "Favorite Files: Toggle Per Project" command. This now will load per project files instead of global. You can toggle back and forth.

If/when Jon adds some method to get the project file path, this will no longer be needed, but until then this is what I plan on doing.

Try it out and let me know if you like it. Let me know if you have any suggestions. Right now, this is what I am planning to submit to Package Control (assuming there are no bugs).

Version 0.5.0
- Abandon storing favs in project settings file, but store the settings in a file in the same directory as project settings.
- Force refresh of session if project cannot be found and try to locate project again.
facelessuser
 
Posts: 1570
Joined: Tue Apr 05, 2011 7:38 pm

Re: Favorite Files

Postby phillip.koebbe on Mon Mar 26, 2012 12:18 am

facelessuser wrote:In all honesty I probably should have had Favorite Files under the development section. I released a real simple version, and I thought I was done, but @phillip.koebbe had different ideas :) .


Most people have never made the association, but I'm also known as thorn.nyersyd :)

This is great news! I'll be trying out the project-specific stuff tomorrow. Thanks again for all the work. Though, I do wonder if you have a real job or if you exist just to write ST2 plugins ;)
-- 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 Mon Mar 26, 2012 2:03 am

phillip.koebbe wrote:Most people have never made the association, but I'm also known as thorn.nyersyd :)

It makes so much more sense now. :)
facelessuser
 
Posts: 1570
Joined: Tue Apr 05, 2011 7:38 pm

Re: Favorite Files

Postby facelessuser on Mon Mar 26, 2012 4:35 pm

Known bugs:
1. Windows returns "." instead of "" for no project, this makes Favorite Files think it has a project. I will fix this later today.
2. Renamed projects will try and store settings in the old settings. I will probably tweak toggling to verify if the project favorite file exists, and if not create it, and then catch missing project fav files for all other actions and maybe try and get the new project name.

Edit: Update bug explanation.
facelessuser
 
Posts: 1570
Joined: Tue Apr 05, 2011 7:38 pm

Re: Favorite Files

Postby facelessuser on Mon Mar 26, 2012 8:15 pm

facelessuser wrote:Known bugs:
1. Windows returns "." instead of "" for no project, this makes Favorite Files think it has a project. I will fix this later today.


This issue is now fixed.

Version 0.5.1
- More explicit match for finding project files
facelessuser
 
Posts: 1570
Joined: Tue Apr 05, 2011 7:38 pm

Re: Favorite Files

Postby facelessuser on Tue Mar 27, 2012 12:35 am

This should really do it this time. Man this per project stuff has been a headache. I sure hope we get some method to get the project file path in the future.

Version 0.5.2
- Rework logic to catch renamed projects
- Strip tabs from session which can break the parsing
facelessuser
 
Posts: 1570
Joined: Tue Apr 05, 2011 7:38 pm

Re: Favorite Files

Postby facelessuser on Tue Mar 27, 2012 2:27 pm

Version 0.5.3
- Catch project rename when when opening or removing items from list (will only catch after a file has been saved).

I plan on submitting this to package control by the end of the week. @phillip.koebbe, if you have any outstanding issues, please let me know; actually, give me whatever feedback you can so I know if this solution is acceptable. I think this covers all scenarios now, but I want to know how useable the solution is from other people before I decide to leave per project on by default.

I am now catching project renames when opening favorite files or removing them. This catch is only triggered after a file has been saved, I have purposely opted not to refresh during file open commands etc, because I think it would be too annoying. I only refresh when toggling between global to per project. If you rename a project and have saved a file, Favorite Files will alert you that it thinks the project name has changed, and it will revert to the global list. Toggling back to per project will create a list for the new project name.
facelessuser
 
Posts: 1570
Joined: Tue Apr 05, 2011 7:38 pm

Re: Favorite Files

Postby facelessuser on Thu Mar 29, 2012 2:27 pm

Feedback has disappeared for this, so I have decided to disable the "Per Project Favorites" setting until I get some good feedback on this feature. It is still there, but you have to enable it via the settings file if you want to try it out.

Version 0.6.0
- Disable "Per Project Favorites" by default
- Update documentation
- Prep for official release

I will be requesting inclusion into Package Control soon.
facelessuser
 
Posts: 1570
Joined: Tue Apr 05, 2011 7:38 pm

Re: Favorite Files

Postby phillip.koebbe on Thu Mar 29, 2012 5:37 pm

facelessuser wrote:Feedback has disappeared for this, so I have decided to disable the "Per Project Favorites" setting until I get some good feedback on this feature. It is still there, but you have to enable it via the settings file if you want to try it out.

Version 0.6.0
- Disable "Per Project Favorites" by default
- Update documentation
- Prep for official release

I will be requesting inclusion into Package Control soon.


Sorry, been kind of busy the past few days. I've been using it, and it seems to work fine. I'm not using it as extensively as I will at other times due to the nature of my work. When I add new pieces of functionality, as I'm currently doing, I don't need it quite as much.

Again, I appreciate your work on this. If I run into anything, I'll certainly let you know. I guess you could almost go by the adage, "No news is good news."
-- 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

PreviousNext

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 13 guests