From 7374307631ec957e9fa4151d0e7e3b3740078258 Mon Sep 17 00:00:00 2001 From: Barry Date: Sun, 29 Nov 2020 19:24:19 +0000 Subject: [PATCH] Add hash SQL comments --- src/language/sql.js | 2 +- test/language/sql-test.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/language/sql.js b/src/language/sql.js index b2591ef7..c0c48945 100644 --- a/src/language/sql.js +++ b/src/language/sql.js @@ -19,7 +19,7 @@ Rainbow.extend('sql', [ }, { name: 'comment', - pattern: /--.*$|\/\*[\s\S]*?\*\/|(\/\/)[\s\S]*?$/gm + pattern: /--.*$|#.*$|\/\*[\s\S]*?\*\/|(\/\/)[\s\S]*?$/gm }, { name: 'constant.numeric', diff --git a/test/language/sql-test.js b/test/language/sql-test.js index 6550ccc4..54051bbd 100644 --- a/test/language/sql-test.js +++ b/test/language/sql-test.js @@ -54,4 +54,22 @@ export function testSQL(t) { 'select count(*) from some_table WHERE some_column is not null;' ); + + run( + t, + + language, + + 'comments', + + `/* This + is a + multi-line + comment */ + select count(*) -- This is a one type of single line comment + from some_table # This is another type of single line comment + WHERE some_column is not null;`, + + '/* This\n is a \n multi-line\n comment */\n select count(*) -- This is a one type of single line comment\n from some_table # This is another type of single line comment\n WHERE some_column is not null;' + ); }