Autocomplete question


#1

I have the autocomplete packages installed.

The thing I find annoying is that when one is invoked, the appropriate enhancements are not included.

For example if I have a tag <div> and inside I type cl and invoke “class”, it just types “class” and then I need to type the ="". It would make more sense to invoke a snippet for class like class="$1" (the $1 being cursor position, of course)

Similarly, in CSS/SCSS completing a property name such as font-weight should yield font-weight: $1; or at least add the colon.

Is this something planned, or something I could customize myself?


#2

Aren’t you essentially asking for the autocomplete-snippets package?


#3

I wasn’t aware of this one, thanks.

I just installed it, and it doesn’t seem to work right:

And yes, I removed Emmet and re-started Atom.


#4

Looks like it’s conflicting with the builtin Snippets package too. I think it loads everything the built in package does so you can probably just disable Snippets.


#5

I tried disabling that. Now nothing happens at all. I think I have decided this plugin is bogus.

All I’d really like is the ability for autocompletes to be context-aware in that if I add a “class” to an html tag it should give me the required =""

Without this I see no benefit in the autocomplete as it stands.


#6

personally I type “div.classname” and then I press the tab key, this write the open and close tag and the class field

I don’t know if it would help you

the problem with autocomplete/autocomplete++ is than is a generic package for all the languages and html as you would notice, require an extra knowledge about the contex, maybe would be necessary create a specific autocomplete package for html

I notice than there are not snippet for class field or even id…maybe would be necessary create these if you wish avoid emmet

greetings


#7

Thanks. I noticed that emmet’s autocompletes like the one you list above do not work in PHP files:

but it DOES work in generic html:

However, what my original post was about is that I am looking for THIS:

Can that be done in Atom?


#8

I logged the Emmet not working in PHP: https://github.com/emmetio/emmet-atom/issues/134

I’d still like to see the autocomplete with quotes…


#9

try this…(I’ve not php extension installed)
open your snippets (type Application:open your snippets in the command box)

'.source.php':  //not sure if is source.php or text.php
  'PHP class completition':
    'prefix': 'class'
    'body':
      'class= \"$1\" '   //maybe is not necesary escape the ' " '

maybe yould works…let me know if this help…