Home Download Buy Blog Forum Support

HTMLAttributes update

HTMLAttributes update

Postby agibsonsw on Sat Sep 22, 2012 6:28 pm

Hello. I made two small changes to my HTMLAttributes, available via PackageControl.

I swapped the order of value and valign so that if I type v and press TAB it produces value="" by default, with the cursor between the quotes. (Having typed the value we can press TAB again to skip out of the quotes :) .)

I've moved deprecated attributes further down in the list, although still in alphabetical order. This means, the more you use the attributes, the less likely deprecated items will be suggested near the top of the completions list.

If anyone has found little niggles please let me know as a slight re-ordering might fix these. Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: HTMLAttributes update

Postby MrMartineau on Wed Oct 03, 2012 10:05 am

This look great, thanks for making it. Is it context aware? By that I mean, it shows a value attr on the <div> element when it shouldn't (http://www.w3.org/TR/html4/struct/global.html#h-7.5.4). I don't mind because I know which attrs to use but I thought I would ask..
@MrMartineau || Setup Sublime Text quickly: Find out all you need at https://github.com/mrmartineau/SublimeTextSetup
MrMartineau
 
Posts: 78
Joined: Thu Jul 28, 2011 8:35 am

Re: HTMLAttributes update

Postby agibsonsw on Wed Oct 03, 2012 11:59 am

Hello @MrMartineau and thank you.

The attributes are not context aware.. currently. I find them very neat and efficient though; if we already know the attributes and where they are applicable, I/we can more or less type a single letter and TAB into, and out of, the quotes for the value.

They could be made context aware: I would create a .py file and read the characters to the left of the cursor until I meet the opening tag <. I would need to organise the attributes into different lists and append these sub-lists until the correct list is available for the current tag.

It would need a bit of planning to make sure the generated list(s) are complete and correct, but it's do-able. All I'm lacking is the impetus (enthusiasm :lol: !). But I've noted your interest. Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: HTMLAttributes update

Postby agibsonsw on Thu Oct 04, 2012 1:07 pm

On reflection I'm not sure that it would be worth trying to make them context-sensitive:

There are 160-ish completions, 20+ of which are deprecated;
30+ are HTML5 and subject to change/re-interpretation;
Where attributes are only applicable to one or two elements, this is noted in the completions' description;
Many of the remaining completions are global (apply to all elements).

The two of most interest are name and value. It would be nice if these were only available in the right context. Then again, if someone is using XML/XHTML or a custom DTD, then it is possible that they should still display. (Although, I don't think they display in XML anyway :) .)
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: HTMLAttributes update

Postby MrMartineau on Tue Oct 09, 2012 10:29 pm

I think you're right. I don't think you need to make it context sensitive. Thanks again for the plugin
@MrMartineau || Setup Sublime Text quickly: Find out all you need at https://github.com/mrmartineau/SublimeTextSetup
MrMartineau
 
Posts: 78
Joined: Thu Jul 28, 2011 8:35 am

Re: HTMLAttributes update

Postby agibsonsw on Tue Oct 09, 2012 10:56 pm

MrMartineau wrote:I think you're right. I don't think you need to make it context sensitive. Thanks again for the plugin

You are welcome; enjoy!
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: HTMLAttributes update

Postby agibsonsw on Sun Jan 13, 2013 9:32 pm

Hello. I've updated my HTMLAttributes plug-in, available via Package Control, as follows:

For the type="" attribute you can just type the letter 'j' to produce "text/javascript" or 'cs' for "text/css" - then Tab past the quotes.

Just some reminders:

The intention is that we only need to type one or two letters and press Tab. For example, type 'i' then Tab should produce id="|", similarly typing 'v' then Tab should produce value="|". Type your value and press Tab once more to continue.

If the wrong attribute appears, such as valign instead of value, then Backspace and type valu, then Tab, or press Ctrl-Space to show the full list. Once you've used the same attribute a few times ST will remember your choice.

If you are less familiar with the names of the various attributes then just use Ctrl-Space to show the list, until they are more familiar to you.

*******
Someone asked me recently whether it is possible for the attributes to appear automatically, in the completions' list. This may be possible by changing some settings, but I don't really see this as the intended usage for my package.

Enjoy! Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: HTMLAttributes update

Postby agibsonsw on Sun Jan 13, 2013 9:43 pm

PS You can type abbreviations such as omv for onmouseover="" (or even ov) but you may initially have to press Tab twice for it to be recognised. Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm


Return to Plugin Announcements

Who is online

Users browsing this forum: Majestic-12 [Bot] and 13 guests