Sublime Forum

Favorite Files

#29

Not quite out of tricks just yet. I figured out a way to get the project path pretty reliable now. Is it ugly and hackish? Yes and yes. But does it work? Yes.

So I should sometime today have a version of per project favorites that I am okay with turning on. I have a couple of things to shake out, but I think it will work pretty good. Am I still hoping for an API method to give project path? Oh yes; I feel dirty doing what I am doing currently, but I am limited right now on my choices.

Stay tuned.

0 Likes

#30

@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 :smile:

0 Likes

#31

[quote=ā€œvitaLeeā€]@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 :smile:[/quote]

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 :smile: .

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.

0 Likes

#32

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] ______ _ __ _______ __
/ / __ ______ _____() /____ / () / _____
/ /
/ __ `/ | / / __ / / / _/ _ \ / / / / / _ / /
/ __/ / /
/ /| |/ / /
/ / / / / /
/ __/ / __/ / / / ( )
/
/ _
,
/ |/_// //_/_/ // ///___/____/

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.[/code]

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.
0 Likes

#33

Most people have never made the association, but Iā€™m also known as thorn.nyersyd :smile:

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 :wink:

0 Likes

#34

It makes so much more sense now. :smile:

0 Likes

#35

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.

0 Likes

#36

[quote=ā€œfacelessuserā€]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.
    [/quote]

This issue is now fixed.

Version 0.5.1

  • More explicit match for finding project files
0 Likes

#37

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
0 Likes

#38

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.

0 Likes

#39

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.

0 Likes

#40

[quote=ā€œfacelessuserā€]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.[/quote]

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.ā€

0 Likes

#41

[quote=ā€œphillip.koebbeā€]
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.ā€[/quote]

I usually do, but the ā€œPer Projectā€ feature was such a quirky and ridiculous workaround, I wanted to make sure its quirks were not too annoying for people to work with. I might enable it then if you havenā€™t been having any frustration with the refresh method or anything.

0 Likes

#42

Am absolutely loving this plugin, fantastic idea and great implementation. Would it be possible to add a view of the favorite files to the sidebar, similar to the ā€œFOLDERSā€ heading but under something like ā€œFavoriteFilesā€?

0 Likes

#43

Not currently. There is no API handle to do this. It would be cool if we could, but we canā€™t.

0 Likes

#44

Hi,

Thanks a lot for this plugin !

I use Notational Velocity (resoph.com/ on windows) => A live search in favorites files and I delete these two softwareā€¦ :smile:

Link a Group to a directory and refresh group (to add automatically new files to group) will be a great feature too.

0 Likes

#45

[quote=ā€œyesnaultā€]Hi,

Thanks a lot for this plugin !

I use Notational Velocity (resoph.com/ on windows) => A live search in favorites files and I delete these two softwareā€¦ :smile:

Link a Group to a directory and refresh group (to add automatically new files to group) will be a great feature too.[/quote]

So you just want a group to link to a folder and show you all the files? This is pretty doable. You can kind of do this already in another plugin I am working on github.com/facelessuser/FuzzyFileNav.

You can crate bookmarks to folders in the settings file, and then just bring up a bookmark panel. It is still in beta and things are subject to change, and probably will.

0 Likes

#46

Yes, it is almost that but the fuzzy search doesnā€™t search inside a file instantly (it does on two softwares).

It a great plugin too, I hope sublime text to allow modify sidebar for favorites folders in the future.

0 Likes

#47

For your information i created one extension which try solve this, try out and case you can help, help me to improve the extension! :smiley:

github.com/samuelsimoes/Sublime ā€¦ te-Folders

0 Likes

#48

This plugin doesnā€™t work in Sublime 3 :frowning:

0 Likes