Home Download Buy Blog Forum Support

AutoFileName (ST2/ST3)

Re: Autocomplete Filenames

Postby pod on Wed May 02, 2012 6:39 pm

Got new plugin idea (idea is based on this plugin), not sure if you will be interested or got time to implement, or if it's even possible.
Anyway: Will it be possible to parse css and find out classnames [and maybe ids], then if you cursor is in following position <div class="|"> plugin will bring list of classnames?

Also noticed that currently your plugin shows autocompletion list even if cursor is inside classname or id. I see that sublime doesn't tell you what kind of attribute you are editing, but maybe it is possible to read current string where cursor is and find out if you are editing 'src' or 'href' (I think only these two recuire filenames autocompletion).

Again, thank you very much for this plugin, really nice work!
pod
 
Posts: 37
Joined: Sun Nov 07, 2010 3:32 am

Re: Autocomplete Filenames

Postby C0D312 on Wed May 02, 2012 8:13 pm

pod wrote:Will it be possible to parse css and find out classnames [and maybe ids], then if you cursor is in following position <div class="|"> plugin will bring list of classnames?
It's definitely possible, and actually pretty simple. This would obviously deserve its own plugin though. I actually made something like this for PHP files but I can't seem to find it. It's posted somewhere on the forum...

Unfortunately, I don't have the time to take on another project, I'm already working on too many. I'm sure someone else will step up though to make it.

pod wrote:Also noticed that currently your plugin shows autocompletion list even if cursor is inside classname or id.

This is intentional. AutoFileName has more uses other than just HTML. It's meant to be as versatile as possible. Though it triggers inside ALL strings, you can simply ignore it and it should not get in the way of your normal completions.

pod wrote:really nice work!

Thanks. I'm glad you like it.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Autocomplete Filenames

Postby FichteFoll on Thu May 10, 2012 3:19 pm

C0D312 wrote:
pod wrote:Will it be possible to parse css and find out classnames [and maybe ids], then if you cursor is in following position <div class="|"> plugin will bring list of classnames?
It's definitely possible, and actually pretty simple. This would obviously deserve its own plugin though. I actually made something like this for PHP files but I can't seem to find it. It's posted somewhere on the forum...

https://github.com/rmaksim/Sublime-Text ... eclaration

Just found that yesterday and as I read this thread it immediately came into my mind.
FichteFoll
 
Posts: 407
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany

Re: AutoFileName: Now with 50% more auto!

Postby C0D312 on Thu Aug 02, 2012 6:28 pm

I haven't really paid much attention to any of my plugins recently and I was bored. So here. Anyway, the plugin is a lot more configurable via settings. I tweaked the behavior so it should feel fluid. I fixed a couple of bugs that have been there for way too long.

Feel free to send me feature requests.

Windows users: feel free to send pull requests since this might be broken for you :?

P.S. Check out the backspace key when within a path :)
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: AutoFileName: Now with 50% more auto!

Postby rchl on Thu Aug 02, 2012 9:32 pm

There is quite easily reproducible crash triggered by the plugin.

Place the caret inside a string and restart Sublime. If both the completions popup and "Slow plugin" dialogs will trigger, Sublime will crash. This is pretty much DOS because it's quite hard to get out of this situation. Have to modify session file.

I know that crash is generally not a plugin's problem and should be reported to jps but plugin should do everything possible to not trigger "slow plugin" dialog.
rchl
 
Posts: 148
Joined: Fri Mar 04, 2011 11:02 pm

Re: AutoFileName: Now with 50% more auto!

Postby C0D312 on Fri Aug 03, 2012 5:00 am

@rchl,

Alright. I've yet to experience the slow_plugin warning, but I think I have a solution to the crash. Pushing a fix to github now. Let me know.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: AutoFileName: Now with 50% more auto!

Postby sublimator on Fri Aug 03, 2012 6:12 am

>>> Alright. I've yet to experience the slow_plugin warning

He says from Ivy / SSD land
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: AutoFileName: Now with 50% more auto!

Postby rchl on Fri Aug 03, 2012 9:01 am

It's really not about the disk speed (I have SSD too). It happens when there are many calls to some very frequently called callbacks which happens on restoring session with many files. And I'm on i7 so CPU is not that slow either.

Thanks for the fixes C0D312, I'll check them out later.
rchl
 
Posts: 148
Joined: Fri Mar 04, 2011 11:02 pm

Re: AutoFileName: Now with 50% more auto!

Postby C0D312 on Fri Aug 03, 2012 1:48 pm

castles_made_of_sand wrote:>>> Alright. I've yet to experience the slow_plugin warning

He says from Ivy / SSD land

:)

@rchl, yeah, it seems the on_modified and on_selection_modified eventlisteners get called while the files load, so it was a quick fix. Hopefully it works.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: AutoFileName: Now with 50% more auto!

Postby pod on Fri Aug 03, 2012 11:14 pm

C0D312 wrote:Windows users: feel free to send pull requests since this might be broken for you :?

Code: Select all
    def on_query_completions(self, view, prefix, locations):
        settings = sublime.load_settings('autofilename.sublime-settings')
        is_proj_rel = settings.get("afn_use_project_root")
        valid_scopes = settings.get("afn_valid_scopes")


Hi, I did change on_query_completions a little and it worked for Windows. Sorry I didn't have much time to check what you are doing there with view.settings(), but if you just need to read settings from autofilename.sublime-settings - why are you not using sublime.load_settings('autofilename.sublime-settings')? There potentially could be other places where you may want to change view.settings() to sublime.load_settings().

Thank you for supporting this plugin, it is really neat.
pod
 
Posts: 37
Joined: Sun Nov 07, 2010 3:32 am

PreviousNext

Return to Plugin Announcements

Who is online

Users browsing this forum: Google [Bot] and 6 guests