Skip to main content
Jon Fritz
Community Expert
Community Expert
November 4, 2016
Question

Bring back the ability to create "wrapping" Snippets

  • November 4, 2016
  • 8 replies
  • 5737 views

CC2017 appears to have inexplicably removed the ability to create Snippets that wrap a selection. Old "wrapping" Snippets work, however new ones can't be created currently in the CC2017 interface.

Please tell me this was accidental and will be repaired in the upcoming dot release.

This topic has been closed for replies.

8 replies

Participant
May 4, 2019

Until the feature is tested and published after this Prerelease, I am using regex replace and the fact that find...replace sets can be saved and loaded as .dwr files. One advantage of this is that I can wrap what was the wrappable snippet around everything on a page at once, or in very rapid succession of either replace or skip, if I make the right regex.

For example, I am going through old pages, replacing non-secure php text in echoes to htmlentities() wrapped text with

Find: ([^(])(\$[A-Za-z_0-9]+?\['.+?'\])

Replacement: $1htmlentities($2, ENT_QUOTES, 'UTF-8')

Which in practice changes <?php echo $result_row['some_field'];?>

to <?php echo htmlentities($result_row['some_field'], ENT_QUOTES, 'UTF-8');?>

If you're interested in how that regex works:

  • notice that the first pair of parentheses encloses anything but an open parenthesis. This means don't match what follows if it is already preceded by an open parenthesis. Why? Because if it my variable is already in parenthesis, it's probably already wrapped in htmlentities().
  • $1 in the replacement means put that non-open-parenthesis character in the replacement, whatever it is. Without this the replacement would drop the character, usually a space between echo and the variable being echoed.
  • The second pair of parentheses encloses a php variable, particularly an array, since it looks for a dollar sign followed by letters, numerals, and/or underscores, followed by a square bracketed, single-quoted something. The something itself is represented by .+? which means any character, ".", one or more, "+", but not including the thing that follows in the regex "?", which in this case is a single quote, "'".  This second set is represented in the replacement by $2, which you can see is placed as the first parameter in the htmlentities() function.
  • Some characters have special meaning in regex, which is why I had to "escape" them with backslashes when I wanted to search for them literally: In this case, brackets and the dollar sign. Brackets are used in their special meaning when I indicate what characters I want to find, A-Z etc. Dollar sign, which here I don't use in its special meaning, means the beginning of a line.

[edit]

Thinking about it a little more, and noticing that the above matched instances of array variables even when not being echoed to client, I realized I should simplify my regex to

Find: echo\s+(\$[A-Za-z_0-9]+?\['.*'\])

Replace: echo htmlentities($1, ENT_QUOTES, 'UTF-8')

Where \s+ matches any non-zero amount of space, tab, form feed, or line feed.

B i r n o u
Legend
May 4, 2019

the second one doesn't include the use of concat in the echo function.. nor the use of multi param in the echo structure

Participant
May 6, 2019

Would you like to try writing one that does what you specify, or are you asking me to try, or are you just warning us that my regex doesn't cover all possibilities?

Inspiring
October 25, 2017

New Adobe Slogan: PAY MORE, GET LESS

I used it every day:

Type 'my text' - hilite it - press shortcut - get: <?php echo 'my text'; ?>

Only people who do not program come to such ideas to remove this function.

Very bad. WE NEED THIS Feature BACK. I need the time savings to among other things the money for your software to earn.

---

A workaround - is to manually copy the snippets from DW2015 to DW2017/18

(as Nancy said: %AppData%\Roaming\Adobe\Dreamweaver CC 2015\[your_lang]\Configuration\Snippets\ )

Since you can not set a keyboard shortcut, you have to insert it with a double-click. This also works with selected text.

Community Manager
April 1, 2019

Hi All,

we are happy to inform you that we are back with the older functionality of Snippet Type radio options for wrap and Insert block options in Snippet dialog, in our latest Prerelease drop 15081.

https://forums.adobeprerelease.com/dwalpha/discussion/399/dreamweaver-build-15081-is-now-available/p1?new=1

Please join the prerelease program and try out the build and let us know your feedback.

Thanks

Dreamweaver Team

Jon Fritz
Community Expert
Jon FritzCommunity ExpertAuthor
Community Expert
April 1, 2019

THANK YOU!!!!!

Participant
May 5, 2017

REMOVING the ability to use snippets with the CHOICE to set it as a SELECTION WRAP or BLOCK INSERT is HORSESHIT...  BRING THAT BACK PLEASE!!!!

Legend
September 22, 2017

BRING THEM BACK!

TEXTMATE AND OTHERS WERE ABLE TO DO THIS WAY BACK IN 1066!

Inspiring
April 14, 2017

Wraparound snippets are not gone. If you select a bit of text and then click on your snippet, it will still work as before. The trouble is that wraparound snippets are no longer editable nor can they be created.

...or, can they?

Here's a workaround.

1. Download DW 2015 and open it.

2. Add and/or Edit your snippets there.

3. Close DW 2015.

4. Open DW 2017.

Your new snippets are now available in DW 2017.

Inspiring
April 13, 2017

I discovered snippets some time in 2014 and figured out the wrap-a-selection snippet feature in 2015, I think. I have dozens of snippets I use every day, some several times an hour.

Not having this feature has reduced my efficiency. I am probably going to roll back to the earlier version, if I can figure out how to do so, until this feature comes back. There's no reason for me to upgrade to a version that has less capability than I am used to.

Jon Fritz
Community Expert
Jon FritzCommunity ExpertAuthor
Community Expert
April 13, 2017

You can actually have 5 different versions of DW versions installed on your computer at the same time, under a single paid subscription, through the CC Desktop App. They won't run at the same time, but that's usually a non-issue. To get older versions, carefully follow the instructions here: How to Find and Install Previous Version of Adobe Apps in CC 2015 | Adobe Customer Care Team

In the future, be sure to click the Advanced Options link at the bottom of the CC installer window so you can turn off the "Remove Older Versions" option, otherwise, on every new "upgrade" you'll lose your older versions and need to reinstall from the CC Desktop App again.

Participant
January 26, 2017

This is one of the many reasons why CC 2017 is actually a giant step backwards in terms of usability. Suddenly discontinuing well established features is arrogant, stupid, and an insult to users! Bring wrappable snippets back at once!!

Participant
January 26, 2017

I notice that legacy wrapping snippets, imported from an earlier version of Dreamweaver, still work as originally intended. So to get a wrapping snippet you can create it in CC 2015 then import into 2017. Thanks Dreamweaver engineering team, nice streamlined workflow! :-(

Z Gibson
Participant
December 6, 2016

Most of my snippets were wraps and I am extremely angry with this decision.  I've been programming with dreamweaver for 12+ years and I have used my snippets the whole time.  Now without keyboard shortcuts and wraps I'm at a loss.  This was a terrible thing for them to do.

Participating Frequently
December 6, 2016

Yeah I even participated in the beta and mentioned it there.  I heard from another user they plan to bring this back - I hope so.  This was one feature that DW definitely did better than other IDE's, now its the same or worse.

Participating Frequently
December 1, 2016

Bump, please do this. This was a big feature that particularly helped refactoring.

What is being requested is the ability to create a snippet which wraps the current selection.  Functioning similar to how highlighting a section and pressing ctrl-1 wraps the selection in a h1 tag, I want to be able to create snippets that do that.