Snippet Shortcuts

PHP Tools [?] extends Visual Studio with set of advanced features to work more efficiently with PHP code.

Snippet Shortcuts

Postby Swift-R » April 18th, 2013, 1:54 am

To add the <b> or <br /> tags, for example, in html code or php code inside quotes or heredoc, I used, with my last code editor, the CTRL+B and CTRL+ENTER keys. I wonder if it is also possible with Visual Studio 2012 and PHP Tools. For example, if I select some text and then press CTRL+B it adds <b>selected text</b>. I managed to add a snippet that replaces selected text but haven't yet found a way to assign it to CTRL+B. The only way right now is CTRL+K, then CTRL+B, then select bold and then ENTER.

By the way, this is the current snippet code:

Code: Select all
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
   <CodeSnippet Format="1.0.0">
      <Header>
         <Title>bold</Title>
         <Shortcut>b</Shortcut>
         <Description>Bold Snippet</Description>
         <Author>Miguel Nunes</Author>
         <SnippetTypes>
            <SnippetType>Expansion</SnippetType>
            <SnippetType>SurroundsWith</SnippetType>
         </SnippetTypes>
      </Header>
      <Snippet>
         <Code Language="php">
            <![CDATA[<b>$selected$</b>$end$]]>
         </Code>
      </Snippet>
   </CodeSnippet>
</CodeSnippets>


And one more question. Is code highlighting for HTML inside php heredoc strings planned? For example:

Code: Select all
echo <<<HTML
<!DOCTYPE html>
<html>
<body>
<div id=""></div>
</body>
</html>
HTML;
Swift-R
 
Posts: 7
Joined: April 18th, 2013, 1:44 am

Re: Snippet Shortcuts

Postby Jakub Misek » April 18th, 2013, 10:39 am

Hi,

A can't find a way to assign custom keyboard shortcut to the snippet :/ Maybe an additional extension would handle it, or we can add this feature into PHP Editor in future.

Highlighting in PHP heredoc was not planned, but it is a good idea. We can add an option for this in future update.

Thanks,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Snippet Shortcuts

Postby Swift-R » April 18th, 2013, 5:03 pm

Can't find an extension that does something like this. :(
Looking forward in seeing these features implemented in the future.
Swift-R
 
Posts: 7
Joined: April 18th, 2013, 1:44 am


Return to PHP Tools

Who is online

Users browsing this forum: No registered users and 40 guests

cron

User Control Panel

Login

Who is online

In total there are 40 users online :: 0 registered, 0 hidden and 40 guests (based on users active over the past 5 minutes)
Most users ever online was 399 on April 19th, 2024, 11:49 pm

Users browsing this forum: No registered users and 40 guests