Home Download Buy Blog Forum Support

Bug?

Bug?

Postby moonlord on Tue Jun 23, 2009 2:48 pm

Hello everyone. For the start i'd like to say that i was impressed when i first started this texteditor. I've tested many editors including, e, intype, notepad++ and i think Sublime its on top of them.
Still, i have one question: i've noticed that there are php snippets but i can't find the php language on the bottom right of the screen (where you specify language for a specific file). Php it's missing from there. Is it a bug?

Keep up the good job.

later edit: Also when i'm between <?php ?> tags i can't use html snippets. why?
moonlord
 
Posts: 7
Joined: Tue Jun 23, 2009 1:44 pm

Re: Bug?

Postby EJ12N on Tue Jun 23, 2009 3:08 pm

moonlord wrote:Hello everyone. For the start i'd like to say that i was impressed when i first started this texteditor. I've tested many editors including, e, intype, notepad++ and i think Sublime its on top of them.


Glad you found heaven! when it comes to text editors lol. Anyways,

moonlord wrote:i've noticed that there are php snippets but i can't find the php language on the bottom right of the screen (where you specify language for a specific file).


Author (Jon) is aware of this "bug", for now just put it in HTML and do your <?php ?>
Other alternative (and this is what I do) install EditPreferences package then press "ctrl+alt+shift+n" it will allow you to select the file type that you want, this one does have "PHP" on it
http://www.sublimetextwiki.com/pages/Ed ... ences.html

moonlord wrote:Also when i'm between <?php ?> tags i can't use html snippets.

Because of the scope.
Snippets in sublime-snippet files just take care of the snippets functionality like what is it that this snippet is supposed to do.
Then you have sublime-keymap files, in here is where keybindings take place, this is where you bind your tab triggers and you define contexts like scope.

NOTE: sublime-snippet files now allows you to define, tab trigger, scope and description within the file, this is new tho but you can see by yourself how they work if you visit some PHP snippets.
Code: Select all
<snippet>
    <content><![CDATA[\$GLOBALS['${1:variable}']${2: = }${3:something}${4:;}$0]]></content>
    <tabTrigger>globals</tabTrigger>
    <scope>source.php</scope>
    <description>$GLOBALS['…']</description>
</snippet>


-----

If you go to the HTML.sublime-keymap file, you will see HTML snippets defined there, example:
Code: Select all
<binding key="a,tab" command="insertSnippet 'Packages/HTML/a.sublime-snippet'">
      <context name="selector" value="text.html - meta.tag - source, meta.scope.between-tag-pair.html"/>
   </binding>

If you see context name="selector" (really selector = scope)
in the value you put the scope the snippet is supposed to work on, if you want your HTML snippets to work for PHP too, just add source.php to the scope (selector) so to make above snippet work we would do

<binding key="a,tab" command="insertSnippet 'Packages/HTML/a.sublime-snippet'">
<context name="selector" value="source.php, text.html - meta.tag - source, meta.scope.between-tag-pair.html"/>
</binding>


You comma separate more than one scope.
You can see the current scope by pressing ctrl+alt+p, it will be shown to you in status bar.
Scopes are very convenient, they allow you to target snippets specifically for pretty much everything you want, like let's say you want to do a snippet that when you are in comments it does something, and you want that same snippets to do something else when you are in strings, well with scopes you can =]
NOTE: scopes (selector) are not limited to snippets only, you can run macros, command or scripts when you are in X scope if you wish to do so.
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: Bug?

Postby moonlord on Tue Jun 23, 2009 4:17 pm

Well, thanks for your time. That was a really complex answer. I appreciate it.

P.S. Now i understand what scopes are for :D
moonlord
 
Posts: 7
Joined: Tue Jun 23, 2009 1:44 pm

Re: Bug?

Postby EJ12N on Tue Jun 23, 2009 8:54 pm

moonlord wrote:Well, thanks for your time. That was a really complex answer. I appreciate it.

P.S. Now i understand what scopes are for :D

Your welcome. :D

Sublime documentation is lacking a little bit but I have heard that is on the oven cooking :)
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: Bug?

Postby moonlord on Wed Jun 24, 2009 7:12 am

Another thing: Unindent (shift+tab) it's not working for me. Indent(tab) it's working.
moonlord
 
Posts: 7
Joined: Tue Jun 23, 2009 1:44 pm

Re: Bug?

Postby moonlord on Wed Jun 24, 2009 7:49 am

Yes, this way it works. It just i was used to click at the end of the line and use shift+tab or select the line with the mouse and press shift+tab
moonlord
 
Posts: 7
Joined: Tue Jun 23, 2009 1:44 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 26 guests