Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

duplicate snippet placeholders #17

Closed
tphummel opened this issue Mar 3, 2014 · 7 comments
Closed

duplicate snippet placeholders #17

tphummel opened this issue Mar 3, 2014 · 7 comments

Comments

@tphummel
Copy link

tphummel commented Mar 3, 2014

Trying to recreate this snippet in atom. Here is how it looks in textmate 1:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>content</key>
    <string>console.log "$1: ", $1$0</string>
    <key>name</key>
    <string>console.log with label</string>
    <key>scope</key>
    <string>source.coffee</string>
    <key>tabTrigger</key>
    <string>cll</string>
  </dict>
</plist>

Here is how it looks in sublime text 2:

<snippet>
  <content><![CDATA[
console.log "${1}: ", ${1}
]]></content>
  <tabTrigger>cll</tabTrigger>
  <scope>source.coffee</scope>
</snippet>

I tried both of these formats in Atom and had no luck getting two placeholders to mirror the same value as I type.

Here are some of the examples I tried:

'Console log extended':
 'prefix': 'cll'
 'body': 'console.log "${0:hi}: ", ${0:ok}'
'Console log extended':
 'prefix': 'cll'
 'body': 'console.log "${0}: ", ${0}'
'Console log extended':
  'prefix': 'cll'
  'body': 'console.log "$1: ", $1$0'
@kevinsawicki
Copy link
Contributor

I think it needs to be:

'Console log extended':
  'prefix': 'cll'
  'body': 'console.log "$1", $2'

@tphummel
Copy link
Author

tphummel commented Mar 4, 2014

Hey @kevinsawicki. Thanks for the response. So that works as you've written it. And a tab will move me between $1 and $2. But I really want it to be $1 and $1. Where the label and the variable match eachother, and a single tab takes me to the end of the variable name. I can't seem to get that working.

here it is working in sublime:

@kevinsawicki
Copy link
Contributor

Currently Atom snippets do not support multiple cursors of the style shown in your screen capture.

This is something we plan to add support though.

@jonathanwiesel
Copy link

👍 love this too. For example when you declare a class and the constructor must have the same name as the class you'll need to type it only once.

@fakewaffle
Copy link

+1. I think this is a duplicate of #11.

@tjpeden
Copy link

tjpeden commented Mar 10, 2014

+1

@probablycorey
Copy link

Duplicate of #11

cedhuf added a commit to area/language-latex that referenced this issue Jul 11, 2014
Updating some snippets with the use of [placeholder
duplication](atom/snippets#17)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants