From b9cdc97ef91f475d3f56222c5f3f78c64b0eb13e Mon Sep 17 00:00:00 2001 From: Joe Lencioni Date: Sun, 5 Jan 2014 07:38:47 -0800 Subject: [PATCH 1/4] 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. --- UltiSnips/javascript.snippets | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets index 546e5d4..2dce575 100644 --- a/UltiSnips/javascript.snippets +++ b/UltiSnips/javascript.snippets @@ -79,28 +79,24 @@ endsnippet # Snippets for Console Debug Output -snippet cl "console.log" -console.log(${1:"${2:value}"}); -endsnippet - -snippet cw "console.warn" -console.warn(${1:"${2:value}"}); +snippet ca "console.assert" +console.assert(${1:assertion}, ${2:"${3:message}"}); endsnippet snippet ce "console.error" console.error(${1:"${2:value}"}); endsnippet -snippet ca "console.assert" -console.assert(${1:assertion}, ${2:"${3:message}"}); -endsnippet - snippet cgroup "console.group" console.group("${1:label}"); ${VISUAL}$0 console.groupEnd(); endsnippet +snippet cl "console.log" +console.log(${1:"${2:value}"}); +endsnippet + snippet ctime "console.time" console.time("${1:label}"); ${VISUAL}$0 @@ -115,6 +111,10 @@ snippet ctrace "console.trace" console.trace(); endsnippet +snippet cw "console.warn" +console.warn(${1:"${2:value}"}); +endsnippet + # AMD (Asynchronous Module Definition) snippets snippet def "define an AMD module" From bf0965fb6e0935706f79f379c095f4c5bf957ffb Mon Sep 17 00:00:00 2001 From: Joe Lencioni Date: Sun, 5 Jan 2014 07:35:35 -0800 Subject: [PATCH 2/4] 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 --- UltiSnips/javascript.snippets | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets index 2dce575..e3d7c68 100644 --- a/UltiSnips/javascript.snippets +++ b/UltiSnips/javascript.snippets @@ -83,6 +83,18 @@ snippet ca "console.assert" console.assert(${1:assertion}, ${2:"${3:message}"}); endsnippet +snippet cclear "console.clear" +console.clear(); +endsnippet + +snippet cdir "console.dir" +console.dir(${1:object}); +endsnippet + +snippet cdirx "console.dirxml" +console.dirxml(${1:object}); +endsnippet + snippet ce "console.error" console.error(${1:"${2:value}"}); endsnippet @@ -93,10 +105,30 @@ ${VISUAL}$0 console.groupEnd(); endsnippet +snippet cgroupc "console.groupCollapsed" +console.groupCollapsed("${1:label}"); +${VISUAL}$0 +console.groupEnd(); +endsnippet + +snippet ci "console.info" +console.info(${1:"${2:value}"}); +endsnippet + snippet cl "console.log" console.log(${1:"${2:value}"}); endsnippet +snippet cprof "console.profile" +console.profile("${1:label}"); +${VISUAL}$0 +console.profileEnd(); +endsnippet + +snippet ctable "console.table" +console.table(${1:"${2:value}"}); +endsnippet + snippet ctime "console.time" console.time("${1:label}"); ${VISUAL}$0 From 3c461925b9d40ed7b2a05c5000461a0876b2c489 Mon Sep 17 00:00:00 2001 From: Joe Lencioni Date: Sun, 5 Jan 2014 08:01:00 -0800 Subject: [PATCH 3/4] 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. --- UltiSnips/javascript.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets index e3d7c68..ee97c09 100644 --- a/UltiSnips/javascript.snippets +++ b/UltiSnips/javascript.snippets @@ -135,8 +135,8 @@ ${VISUAL}$0 console.timeEnd("$1"); endsnippet -snippet ctimestamp "console.timestamp" -console.timeStamp("${1:label}") +snippet ctimestamp "console.timeStamp" +console.timeStamp("${1:label}"); endsnippet snippet ctrace "console.trace" From 43a78a8273b734075e70189c68d973d5313a6e26 Mon Sep 17 00:00:00 2001 From: Joe Lencioni Date: Mon, 6 Jan 2014 07:46:16 -0800 Subject: [PATCH 4/4] 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 --- UltiSnips/javascript.snippets | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets index ee97c09..bc530e9 100644 --- a/UltiSnips/javascript.snippets +++ b/UltiSnips/javascript.snippets @@ -79,71 +79,71 @@ endsnippet # Snippets for Console Debug Output -snippet ca "console.assert" +snippet ca "console.assert" b console.assert(${1:assertion}, ${2:"${3:message}"}); endsnippet -snippet cclear "console.clear" +snippet cclear "console.clear" b console.clear(); endsnippet -snippet cdir "console.dir" +snippet cdir "console.dir" b console.dir(${1:object}); endsnippet -snippet cdirx "console.dirxml" +snippet cdirx "console.dirxml" b console.dirxml(${1:object}); endsnippet -snippet ce "console.error" +snippet ce "console.error" b console.error(${1:"${2:value}"}); endsnippet -snippet cgroup "console.group" +snippet cgroup "console.group" b console.group("${1:label}"); ${VISUAL}$0 console.groupEnd(); endsnippet -snippet cgroupc "console.groupCollapsed" +snippet cgroupc "console.groupCollapsed" b console.groupCollapsed("${1:label}"); ${VISUAL}$0 console.groupEnd(); endsnippet -snippet ci "console.info" +snippet ci "console.info" b console.info(${1:"${2:value}"}); endsnippet -snippet cl "console.log" +snippet cl "console.log" b console.log(${1:"${2:value}"}); endsnippet -snippet cprof "console.profile" +snippet cprof "console.profile" b console.profile("${1:label}"); ${VISUAL}$0 console.profileEnd(); endsnippet -snippet ctable "console.table" +snippet ctable "console.table" b console.table(${1:"${2:value}"}); endsnippet -snippet ctime "console.time" +snippet ctime "console.time" b console.time("${1:label}"); ${VISUAL}$0 console.timeEnd("$1"); endsnippet -snippet ctimestamp "console.timeStamp" +snippet ctimestamp "console.timeStamp" b console.timeStamp("${1:label}"); endsnippet -snippet ctrace "console.trace" +snippet ctrace "console.trace" b console.trace(); endsnippet -snippet cw "console.warn" +snippet cw "console.warn" b console.warn(${1:"${2:value}"}); endsnippet