From 88ac78106d4dd0806c1898f0d2b581b2bd814417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 3 Apr 2022 00:55:46 +0200 Subject: [PATCH 1/2] snippet: Use single quotes in JS gjs mandates single quotes for strings, which is the closest we get to a canonical "GNOME JS" style, in particular as it is the base for the style guidelines of gnome-shell and friends. As good as it would be to have an option for the quoting style of string literals, it makes more sense to follow the gjs style for now than using double quotes, so adjust the snippets accordingly. https://gitlab.gnome.org/GNOME/gnome-builder/-/issues/738 --- src/plugins/snippets/snippets/js.snippets | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/snippets/snippets/js.snippets b/src/plugins/snippets/snippets/js.snippets index f9a0885fe..110489730 100644 --- a/src/plugins/snippets/snippets/js.snippets +++ b/src/plugins/snippets/snippets/js.snippets @@ -1,9 +1,9 @@ snippet import - import "${1:./module.js}"; + import '${1:./module.js}'; $0 snippet from - desc import … from - import ${1:{ Module }} from "${2:./module.js}"; + import ${1:{ Module }} from '${2:./module.js}'; $0 snippet imports const ${1:Module} = imports.${2:path}.${$1|decapitalize}; @@ -17,7 +17,7 @@ snippet lang const ${1:Lang} = imports.${$1|decapitalize}; $0 snippet require - const ${1:Module} = require("${2:./}${3:$1|lower}"); + const ${1:Module} = require('${2:./}${3:$1|lower}'); $0 snippet class class ${1:ClassName} { @@ -104,10 +104,10 @@ snippet let snippet var var ${1:variable} = ${2:expression};$0 snippet log - console.log("${1:message}");$0 + console.log('${1:message}');$0 snippet error - console.error("${1:message}");$0 + console.error('${1:message}');$0 snippet info - console.info("${1:message}");$0 + console.info('${1:message}');$0 snippet warn - console.warn("${1:message}");$0 \ No newline at end of file + console.warn('${1:message}');$0 -- GitLab From 3bd9137b6cb24f1935699822283eeab11c5d1167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 3 Apr 2022 01:05:47 +0200 Subject: [PATCH 2/2] snippets: Add 'debug' log snippet for js There is not good reason for omitting debug level logging when we already have snippets for info, warn and error. --- src/plugins/snippets/snippets/js.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/snippets/snippets/js.snippets b/src/plugins/snippets/snippets/js.snippets index 110489730..74f56ab34 100644 --- a/src/plugins/snippets/snippets/js.snippets +++ b/src/plugins/snippets/snippets/js.snippets @@ -105,6 +105,8 @@ snippet var var ${1:variable} = ${2:expression};$0 snippet log console.log('${1:message}');$0 +snippet debug + console.debug('${1:message}');$0 snippet error console.error('${1:message}');$0 snippet info -- GitLab