Commit Graph

1186 Commits

Author SHA1 Message Date
Holger Rapp
69659023fb Merge pull request #136 from aeruder/master
all.snippets: bbox and box snippet Python 3 compatibility.
2014-02-05 19:24:19 +01:00
Holger Rapp
16c46616ad Be when to map Forward and Backwards Trigger
Only map Forward and Backwards jumping trigger while inside a snippet.
Patch by Marcelo D Montu (mMontu) with fixes by me.
2014-02-05 19:19:16 +01:00
Holger Rapp
ed2a0c517f Fixed remaining tests. 2014-02-05 19:13:34 +01:00
Andrew Ruder
78c390b026 all.snippets: bbox and box snippet Python 3 compatibility
I'm not much of a python pro, but it appears the correct
way to iterate is next(i) instead of i.next().  i.next() has
been renamed to i.__next__() on python3, but next(i) works on both.

Pasted below is the following test script ran through python
2.6, 2.7, and 3.3:
i = iter("1,2".split(","))
next(i)
i.next()
i.__next__()
next(i)

Python 2.6.8 (unknown, Jan 26 2013, 14:35:25)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> i = iter("1,2".split(","))
>>> next(i)
'1'
>>> i.next()
'2'
>>> i.__next__()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'listiterator' object has no attribute '__next__'
>>> next(i)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
StopIteration
>>>

Python 2.7.6 (default, Dec  6 2013, 20:05:37)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> i = iter("1,2".split(","))
>>> next(i)
'1'
>>> i.next()
'2'
>>> i.__next__()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'listiterator' object has no attribute '__next__'
>>> next(i)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
StopIteration
>>>

Python 3.3.3 (default, Jan  2 2014, 19:09:02)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> i = iter("1,2".split(","))
>>> next(i)
'1'
>>> i.next()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'list_iterator' object has no attribute 'next'
>>> i.__next__()
'2'
>>> next(i)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
StopIteration
>>>

Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com>
2014-02-05 11:40:07 -06:00
Holger Rapp
a7de815f47 Started fixing the tests that broke through the remapping change. 2014-02-05 17:45:45 +01:00
Holger Rapp
2cdaac1b1c Merge branch 'master' into mMontu-master 2014-02-05 17:21:33 +01:00
Holger Rapp
4adc048c16 Try hard to retain the unnamed register. Patch by Gernot Höflechner - LFDM. 2014-02-03 18:14:27 +01:00
Holger Rapp
3e03e38dbc Merge branch 'retaining_the_unnamed_register' of git://github.com/LFDM/ultisnips into LFDM-retaining_the_unnamed_register 2014-02-03 18:02:30 +01:00
Holger Rapp
dd3f5ea189 Merge pull request #135 from ivanbrennan/fix-rails-form_for
ruby: Replace 'INLINE' tags with 'EXPR' tags in form_for snippets.
2014-02-03 02:21:39 -08:00
ivanbrennan
9770ff46cd Replace 'INLINE' tags with 'EXPR' tags in form_for snippets.
Changed ERB tag-style from '<% %>' to '<%= %>' to be compatible
with Rails 3 and newer.
2014-02-01 14:19:45 -05:00
LFDM
f26a2ce830 Adds a test for the new feature 2014-02-01 01:43:43 +01:00
LFDM
60f1089d9d Escapes the cached string 2014-01-31 16:55:42 +01:00
LFDM
bf3bfdac9c Adds eventhandler to restore the unnamed register 2014-01-31 16:33:46 +01:00
LFDM
fee8a23d2d Retains the unnamed register during jumps 2014-01-31 16:33:38 +01:00
Holger Rapp
335663d3c1 Merge pull request #132 from vitalk/jsdoc-snippets
javascript: Add snippets to write JSDoc documentation
2014-01-26 22:15:54 -08:00
Holger Rapp
0d37b48feb Merge pull request #131 from slagtermaarten/master
Tex: Added figure, item, Non-indented paragraph and Long parenthesis. Also cleaned up the snippets file.
2014-01-26 21:29:12 -08:00
Maarten Slagter
2fca23830b Added bunch of snippets to tex.snippets 2014-01-25 10:41:03 +01:00
Vital Kudzelka
b11a021397 Add snippet for the @version tag 2014-01-24 14:49:24 +03:00
Vital Kudzelka
9bb0dfb3db Do not use regexp in snippet triggers 2014-01-24 14:38:17 +03:00
Vital Kudzelka
c60814ced8 Fix some visual placeholders 2014-01-24 14:37:02 +03:00
Vital Kudzelka
faa19dff0f Remove comment box in header 2014-01-24 13:40:31 +03:00
Vital Kudzelka
be1577b058 Add snippets to write JSDoc documentation 2014-01-23 11:26:23 +03:00
Holger Rapp
ae611ccf95 Merge pull request #121 from rudfol/master
c: Added eli snippet.
2014-01-16 21:24:32 -08:00
rudfol
3426be5654 added .. else if (eli) .. snippet 2014-01-16 21:44:28 +00:00
rudfol
2b66c77695 Added .. else if (eli) .. snippet 2014-01-16 21:42:55 +00:00
Holger Rapp
beb2b5c7de Merge pull request #129 from lencioni/scss-import
scss: Add @import
2014-01-14 21:44:50 -08:00
Joe Lencioni
9b9235d40f Add @import to scss snippets
Following the local pattern, this snippet is triggered by either `@imp`
or `imp`.
2014-01-14 10:27:09 -08:00
Holger Rapp
8a3f34b561 Merge pull request #127 from nulpunkt/master
PHP: Make construct snippet PSR compliant.
2014-01-12 21:35:00 -08:00
rudfol
d241fb2d1a added 'if else ..' snippet 2014-01-11 20:49:45 +00:00
rudfol
b0f5f6acf0 added 'if else ..' snippet 2014-01-11 20:47:56 +00:00
rudfol
5b3aa799e4 added 'if ..else' snippet 2014-01-11 20:44:11 +00:00
rudfol
eb5f4946ad Dynamic tab solve - added if statem' 2014-01-10 21:49:13 +00:00
rudfol
76327d17c6 Updated space problem- added 'if' 2014-01-10 21:23:46 +00:00
Holger Rapp
7267490ecb Merge pull request #126 from lencioni/scss
SCSS: useful snippets.
2014-01-09 23:03:37 -08:00
Jesper Skovgaard Nielsen
9b02aaf865 Make construct snippet PSR compliant. 2014-01-08 10:14:28 +01:00
Joe Lencioni
ace6150fac Add snippets for scss files
This commit adds a lot of the basic Sass directives used in Sass script.
Documentation can be found at:

  http://sass-lang.com/documentation/file.SASS_REFERENCE.html

I decided to use regular expressions for the triggers, since typing the
`@` may be too cumbersome to require it to always be included, but is
likely happening due to muscle memory too often to leave it out. Regular
expressions give us the flexibility to have it both ways in this case.
2014-01-07 22:47:57 -08:00
Holger Rapp
b5777773ea Merge pull request #123 from lencioni/improve-js-for-snippet
Javascript: Improve JavaScript `for` snippets
2014-01-07 21:37:58 -08:00
Joe Lencioni
2f66a3fc2b Re-order JS for snippets
Now that we have separated the two `for` loop snippet triggers by
changing the one that counts down from "for" to "ford", it feels more
and more like "ford" is a variant of "for" so I am moving it after it in
the file. Also, alphabetical.
2014-01-06 22:24:13 -08:00
Joe Lencioni
23d7ded754 Simplify JS for snippet bodies
As suggested by @SirVer[1], having `Things[i]` be pre-populated in the
body of the `for` loop snippets is not very useful given the merits of
autocompletion. This commit simplifies these bodies by simply using
`${VISUAL}$0`.

[1]: https://github.com/SirVer/ultisnips/pull/123/files#r8686533
2014-01-06 22:24:13 -08:00
Joe Lencioni
983d494752 Add "b" options to JS for and ford snippets
`for` loops usually appear at the beginning of the line. This commit
makes these snippets more context-aware by adding the "b" option that
prevents them from being triggered if they are preceded with something
other than whitespace, as suggested by @SirVer[1].

[1]: https://github.com/SirVer/ultisnips/pull/123/files#r8686514
2014-01-06 22:24:12 -08:00
Joe Lencioni
5c36a8945c Change JS for counting down trigger from for to ford
As suggested by @SirVer[1], this commit changes the trigger of the
JavaScript `for` snippet that counts down from "for" to "ford". Since
"for" is used pretty often, this will prevent people from needing to
select which one they want from the menu each time.

[1]: https://github.com/SirVer/ultisnips/pull/123/files#r8686514
2014-01-06 22:23:24 -08:00
Holger Rapp
1545b8327d Do not use xrange since py3 does not define it. 2014-01-07 07:01:52 +01:00
Joe Lencioni
6fa0644685 Improve descriptions of JS for snippets
More specifically than "faster" and not faster, these snippets count
down and count up, respectively. Adding this information to the
descriptions will help people make the correct decision.
2014-01-06 08:25:18 -08:00
Joe Lencioni
98f88de976 Increase scope of JS for snippet placeholder
The `Things.length` part of the JS `for` snippet previously did not
include the `.length` portion. Using some regex replacement, we can
include this bit in the placeholder while still only using the `Things`
bit inside the `for` loop. This should make the snippet slightly more
pleasant to use.
2014-01-06 08:22:54 -08:00
Joe Lencioni
bd0c576bff Use length caching in JS for snippet
The previous version of this snippet referenced the object's length on
each iteration of the loop. This adds unnecessary overhead, causing the
loop to be slower. While this will not make much of a difference in many
cases, if the for loop was to be used on a large object or in a tight
loop, it would degrade performance.

Perhaps more importantly, if you were to not cache the length of a live
query, such as DOM queries, you would see significant performance
degradation. If nothing else, this adjustment to the snippet sets things
up for success in more scenarios.
2014-01-06 08:20:54 -08:00
Holger Rapp
3b56e24062 Merge pull request #122 from lencioni/add-snippets
javascript: generell improvements by lencioni.
2014-01-06 07:52:57 -08:00
Joe Lencioni
43a78a8273 Add "b" trigger option to JS console snippets
The "b" trigger option will require that the snippet be expanded only if
it is at the "beginning of the line", that is, only whitespace may
precede the tab trigger.

As suggested by @SirVer[1], this commit adds the "b" tab trigger option
to all of the JavaScript console API snippets.

[1]: https://github.com/SirVer/ultisnips/pull/122/files#r8665940
2014-01-06 07:46:16 -08:00
Joe Lencioni
3c461925b9 Improve console.timeStamp snippet
The console.timeStamp method is camelCased, so I made the description
match the contents. Additionally, there was a missing semicolon at the
end of the line that I added.
2014-01-05 08:03:49 -08:00
Joe Lencioni
bf0965fb6e Add missing console API methods to JS snippets
This commit adds snippets for the following console API methods that
were missing:

  - console.clear
  - console.dir
  - console.dirxml
  - console.groupCollapsed
  - console.info
  - console.profile
  - console.table

I left out console.debug and console.exception since they are simply
aliases for console.log and console.error.

Information about the console API can be found at:

  https://developers.google.com/chrome-developer-tools/docs/console-api
  https://developer.mozilla.org/en-US/docs/Web/API/console
2014-01-05 08:03:49 -08:00
Joe Lencioni
b9cdc97ef9 Alphabetize JavaScript console snippets
Ordering these snippets alphabetically based on their descriptions makes
it easier to find what you are looking for and to notice any snippets
that may be missing from the list.
2014-01-05 08:03:49 -08:00