`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
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
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.
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.
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.
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
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.
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.
Certain non ALGOL-derived languages (notably LISP derivatives) do not
share the alphanumeric + underscore definition of a word character.
Fortunately, each language FileType has its own definition of a word
character, which Vim's regex engine uses when matching against the
boundary classes \< and \>.
We change the word matching routine of 'w' snippets to use Vim's regex
engine instead of a static pattern.