Home Download Buy Blog Forum Support

Dev Build 2030

Re: Dev Build 2030

Postby jps on Fri Feb 25, 2011 12:47 pm

The order is $1, $2, $3, ..., $0 - it's a TextMate-ism. Furthermore, if $0 isn't present in the snippet, it'll be implicitly added to the end.
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Dev Build 2030

Postby asmodai on Fri Feb 25, 2011 3:54 pm

Started on a C completions file @ http://bitbucket.org/asmodai/sublimetext
asmodai
 
Posts: 73
Joined: Mon Mar 01, 2010 10:42 am

Re: Dev Build 2030

Postby adzenith on Fri Feb 25, 2011 6:00 pm

jps wrote:next_view / prev_view commands won't update the stack until the modifier keys are released

Awesome! Thanks. :)
adzenith
 
Posts: 1204
Joined: Mon Oct 19, 2009 9:12 pm

Re: Dev Build 2030

Postby vostok4 on Fri Feb 25, 2011 8:18 pm

jps wrote:For example, it'd be nice if the PHP completions included arguments for the functions (via the snippet syntax), and if there was an HTML plugin to complete tag attributes.


Can I ask how exactly would this be best implemented?

For example I see a snippet for require:
Code: Select all
<snippet>
    <content><![CDATA[require '${1:file}';$0]]></content>
    <tabTrigger>req</tabTrigger>
    <scope>source.php</scope>
    <description>require …</description>
</snippet>


All well and done, however how can I get the require snippet to only expand if the auto-completed valued is require()? Because the tabTrigger for all the array_* functions would be the full function, but then to get the benefit of the snippet the user would have to do:
array_w<tab> (expands to array_walk(|))
<backspace> (now array_walk|)
<tab> (now array_walk(|$array, $funcname);)

I can provide the snippets without problem, but is there a way they will be smart about not requiring the <backspace>+<tab> step?

*EDIT*
Here is a PHP.sublime-completions that has been updated from php.net today, omitting Class references (as is in the original file) and with proper argument counts for every function: https://bitbucket.org/vostok4/sublimeph ... ompletions Feel free to include it in ST2 if you like, or if we figure out the snippets I'll provide all that code instead.
vostok4
 
Posts: 25
Joined: Fri Oct 22, 2010 6:09 pm

Re: Dev Build 2030

Postby jps on Fri Feb 25, 2011 11:35 pm

vostok4 wrote:Can I ask how exactly would this be best implemented?


PHP.sublime-completions accepts the full snippet syntax in the contents field, so you can put in "$array_walk(${1:array}, ${0:funcname})", for example.
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Dev Build 2030

Postby skaet on Sat Feb 26, 2011 7:22 am

Thanks for all your hard work jps, this is definitely looking impressive!

Since we're on the subject of snippets etc, is there currently a UI available - or planned to be implemented - for me to view available snippets within a given snippet directory?

i.e. When I'm working inside PHP tags, I'd like a quick reference panel (perhaps located underneath the minimap?) where I can see a preview of PHP snippets and their associated trigger. I can then double click an item to insert, or enter the tab trigger, even right click for a context menu that allows me to edit the snippet contents, change the tab trigger, or remove the snippet completely. Being able to switch between snippet views quickly and painlessly would be nice, even dynamically updating the snippet panel when moving between different code sections within the same file (e.g. PHP <-> HTML / Javascript <-> HTML)
skaet
 
Posts: 93
Joined: Thu Sep 16, 2010 3:37 pm

Re: Dev Build 2030

Postby jps on Sat Feb 26, 2011 8:24 am

While not exactly what you're after, pressing ctrl+space without typing anything (i.e., with only whitespace or punctuation to the left of the cursor) will show a list with of valid snippets at that point.
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Dev Build 2030

Postby firefusion on Sat Feb 26, 2011 8:28 am

skaet wrote:Thanks for all your hard work jps, this is definitely looking impressive!

Since we're on the subject of snippets etc, is there currently a UI available - or planned to be implemented - for me to view available snippets within a given snippet directory?

i.e. When I'm working inside PHP tags, I'd like a quick reference panel (perhaps located underneath the minimap?) where I can see a preview of PHP snippets and their associated trigger. I can then double click an item to insert, or enter the tab trigger, even right click for a context menu that allows me to edit the snippet contents, change the tab trigger, or remove the snippet completely. Being able to switch between snippet views quickly and painlessly would be nice, even dynamically updating the snippet panel when moving between different code sections within the same file (e.g. PHP <-> HTML / Javascript <-> HTML)


I think the zen coding method of pressing F1 to bring up a find panel style list of all possible snippets in the current syntax would be better. Rather than having a panel always on screen.
firefusion
 
Posts: 218
Joined: Fri Oct 16, 2009 7:37 am

Re: Dev Build 2030

Postby adzenith on Sat Feb 26, 2011 9:31 am

jps wrote:While not exactly what you're after, pressing ctrl+space without typing anything (i.e., with only whitespace or punctuation to the left of the cursor) will show a list with of valid snippets at that point.

This snippet window doesn't seem to constrain itself to my screen: the bottom easily gets cut off.
adzenith
 
Posts: 1204
Joined: Mon Oct 19, 2009 9:12 pm

Re: Dev Build 2030

Postby firefusion on Sat Feb 26, 2011 9:56 am

I've made a file for CSS completions based on this properties list http://meiert.com/en/indices/css-properties/. It's just a basic start for all the properties I haven't added variations of each property with completed values. I've commented out the CSS3 elements I don't think any browser supports yet but I could be wrong on a few (voice perhaps). Feel free to include it in Sublime and change or modify it.

Btw, the fuzzy completions are great! It's like zen coding but i can make up the completion snippet based on what makes sense :) Great stuff.
Attachments
CSS-completions.zip
(2.65 KiB) Downloaded 104 times
firefusion
 
Posts: 218
Joined: Fri Oct 16, 2009 7:37 am

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 17 guests