Sublime Forum

AutoFileName (ST2/ST3)

#21

Could you provide a sample of the code you are using so I have some context?

0 Likes

#22

http://clip2net.com/clip/m0/1327027674-clip-25kb.png
Here it is.

0 Likes

#23

I reproduced the bug that is described above pod.
if you open the editor and start working, it is like in the screenshot - no files in the auto-completion.
but if you open and reload autоfilename.py (just save without changing anything), then the auto-completion is beginning to show the files.

pod - try to repeat my actions - open the file autоfilename.py and simply save it, and then try again auto-completion

0 Likes

#24

Correct, it worked after reloading plugin. Is there a way to fix that?

0 Likes

#25

I’m working on a fix as we speak. It should be ready soon.

0 Likes

#26

I just released a fix. Windows users, you could test it and make sure it works? I made some changes how it handles paths so I need someone to test on Windows. Thanks.

0 Likes

#27

Just reinstalled from package manager, now it doesn’t work at all. No messages/errors in console as well. Also doesn’t work after reloading.
I’m afraid this report will not help you :smile:

0 Likes

#28

[quote=“pod”]Just reinstalled from package manager, now it doesn’t work at all. No messages/errors in console as well. Also doesn’t work after reloading.
I’m afraid this report will not help you :smile:[/quote]

Hmm… I guess os.path.join is not as smart as the description on the docs said… Could you do me a favor and see if it works when you press \ instead of /?

0 Likes

#29

In linux still starts to work [size=110]only after a restart[/size] the plug-in, as described above.

0 Likes

#30

I’m not really sure what that’s supposed to mean… AutoFileName does all of its work at runtime. So I don’t know how a restart can change anything. Do you mean a restart just after installing it or every time to get it to work?

0 Likes

#31

[quote=“C0D312”]

the plug-in, as described above.

I’m not really sure what that’s supposed to mean… AutoFileName does all of its work at runtime. So I don’t know how a restart can change anything. Do you mean a restart just after installing it or every time to get it to work?[/quote]

omg, I found my problem !
I had another old copy of the autofilename.py in another directory when he was not in the package manager.

now all works fine :smile:

p.s. maybe pod has the same problem.

0 Likes

#32

True-true :smile:

Now the only issue I have is that all items in auto-complete box have backslash ‘’ instead of normal slash ‘/’.
I believe I can fix it by replacing d += os.path.sep with d += ‘/’ correct?

0 Likes

#33

[quote=“pod”]

True-true :smile:

Now the only issue I have is that all items in auto-complete box have backslash ‘’ instead of normal slash ‘/’.
I believe I can fix it by replacing d += os.path.sep with d += ‘/’ correct?[/quote]

I changed this because when I was trying to fix all the windows bugs, I changed all references of ‘/’ to os.path.sep I’ll change it back though.

0 Likes

#34

It would be marvellous if the plugin would somehow use the Sublime Project root as “/”, because it’s often the case that my CSS files are in /css/ and my images are in /images/, and all of my references to files in CSS are absolute paths. So instead of background: url(…/images/bg.png), I use background: url(/images/bg.png). In this context, the plugin is of no use :frowning:

Also, is there some way to have the auto-complete window make suggestions immediately as I type, rather than after a manual invocation with CTRL+SPACE? It was also unable to complete a filename if I began typing one that I knew already. IE: …/images/backg[CTRL+SPACE] yields no suggestions, even though I have a background.png image in there.

Just thought I’d post my feedback! Thanks for making this :smile:

0 Likes

#35

The Sublime Text API doesn’t have much support for working with projects, so this request might be pretty difficult to implement… I’ll look into it but it might be more work then it’s worth.

This is already possible if you add the following to your Settings file (Preferences > Settings - User): [code] “auto_complete_triggers”:

	{
		"characters": "<",
		"selector": "text.html"
	},
	{
		"characters": "/",
		"selector": "text.html, source.css"
	}
][/code] (The '<' part is from your default settings so you don't want to override that.)  Essentially, ST2's autocomplete will activate when you type letters.  This setting gives exceptions, other characters that also trigger the autocompletion popup. As for why ../images/backg[CTRL+SPACE] yields no suggestions, this is because the plugin checks if the previous character is a /.  If the autocomplete is already up though, this is not a problem.  

Hope that helps!

0 Likes

#36

Ah, it does. Thank you!

0 Likes

#37

OMG. Just discovered this plugin and it’s so useful. Thanks!

I do second aaronmw’s request that the plugin somehow work with absolute paths though. It would be great if I could specify the root directory as a user preference.

0 Likes

#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