Sublime Forum

AutoFileName (ST2/ST3)

#38

UPDATE

Notable changes:

  • Support for wildcards
  • The cursor position acts as a wildcard
  • Behaves smarter
  • No longer restricted to / to be activated
  • Directories no longer end in / when inserted into the view
  • Settings

    Use project root at root for AutoFileName
    Define a custom project root

0 Likes

#39

I merged all my beta changes to the master branch.

I’ll update the README soon but there have been a lot of changes.

  • Web designers/developers: AutoFileName now inserts width and height attributes for you.
  • Autocompletion will now feel automatic (No more pressing control+space).
  • Working on a project but want to use absolute paths? You can now adjust the plugin to use either the current project’s root or a custom path. Both of these settings can be found by going to Preferences > Package Settings > AutoFileName.

Please let me know if there are any bugs or features requests. (P.S. this has not yet been tested on windows so results could be interesting.)

0 Likes

#40

Hi man,
Thank you for new update, I noticed changes in a way how plugin works and was amazed - it is great! Tested only out-of-box functional on windows, everything works nice and smooth :smile:

0 Likes

#41

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

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!

0 Likes

#42
0 Likes

#43

[quote=“C0D312”]

0 Likes

#44

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

P.S. Check out the backspace key when within a path :smile:

0 Likes

#45

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.

0 Likes

#46

@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.

0 Likes

#47

Alright. I’ve yet to experience the slow_plugin warning

He says from Ivy / SSD land

0 Likes

#48

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.

0 Likes

#49

[quote=“castles_made_of_sand”]>>> Alright. I’ve yet to experience the slow_plugin warning

He says from Ivy / SSD land[/quote]

:smile:

@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.

0 Likes

#50

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.

0 Likes

#51

Yeah, ignore that. I broke the plugin :confused:

0 Likes

#52

Next step to make it really not show “Slow plugin” dialog ever, would be to move the file system access to a separate thread. :smile:

0 Likes

#53

I completely second the secondary thread for file system calls. I use ExpanDrive to hit FTP servers for files; so I don’t have to download them all, and this program kept freezing sublime up while waiting for the FTP to return, so I had to disable it.
Moving this to be nonblocking, and just popping up when it has information would be really nice.

0 Likes

#54

Sublime Text 3 support added. You’ll have to manually switch to the st3 branch.

Important: Python 3 broke AutoFileName’s method for getting image dimensions. I was able to fix this for PNGs and GIFs but have been stumped by JPEGs. Therefore, if anyone understands all this JPEG-mumbojumbo could you please submit a pull request? Thanks.

0 Likes

#55

Added some new features and fixed all the really old Windows bugs. Sorry that it took so long. Also corrected some heinous spelling errors in the readme (possibly added more but who has time to proofread these days?)

Let me know if there are any issues.

0 Likes

#56

That’s called SCSS.

Not entirely standard support.

0 Likes

#57

if you could just fix that please

0 Likes