未验证 提交 79f9a9d9 编写于 作者: M Méril 提交者: GitHub

fix(console): add missing keywords/functions to QuestDBMode (code editor) (#415)

上级 0943fd76
...@@ -29,18 +29,160 @@ const { Mode: SqlMode } = ace.require("ace/mode/sql") as { Mode: unknown } ...@@ -29,18 +29,160 @@ const { Mode: SqlMode } = ace.require("ace/mode/sql") as { Mode: unknown }
const oop = ace.require("ace/lib/oop") as { inherits: (a: any, b: any) => void } const oop = ace.require("ace/lib/oop") as { inherits: (a: any, b: any) => void }
const QuestDBHighlightRules = function (this: HighlightRules) { const QuestDBHighlightRules = function (this: HighlightRules) {
const keywords = const keywords = [
"select|insert|update|delete|from|where|and|or|by|order|limit|as|case|when|else|end|type|left|right|join|on|outer|desc|asc|union|create|table|primary|key|if|foreign|not|references|default|null|inner|cross|natural|database|drop|grant|over|sample|partition|latest|NaN|with|rename|truncate|asof|copy|alter|into|values|index|add|column|then|distinct|show|tables|columns|group" "add",
const builtinConstants = "true|false" "alter",
const builtinFunctions = "and",
"avg|count|first|last|max|min|sum|ucase|lcase|mid|len|round|rank|now|format|coalesce|ifnull|isnull|nvl" "as",
const dataTypes = "asc",
"int|date|string|symbol|float|double|binary|timestamp|long|long256" "asof",
"by",
"cache",
"capacity",
"case",
"column",
"columns",
"copy",
"create",
"cross",
"database",
"default",
"delete",
"desc",
"distinct",
"drop",
"else",
"end",
"foreign",
"from",
"grant",
"group",
"if",
"index",
"inner",
"insert",
"into",
"join",
"key",
"latest",
"left",
"limit",
"nan",
"natural",
"nocache",
"not",
"null",
"on",
"or",
"order",
"outer",
"over",
"partition",
"primary",
"references",
"rename",
"right",
"sample",
"select",
"show",
"splice",
"table",
"tables",
"then",
"truncate",
"type",
"union",
"update",
"values",
"when",
"where",
"with",
]
const builtinConstants = ["false", "true"]
const builtinFunctions = [
"abs",
"all_tables",
"avg",
"coalesce",
"concat",
"count",
"dateadd",
"datediff",
"day",
"day_of_week",
"day_of_week_sunday_first",
"days_in_month",
"first",
"format",
"hour",
"ifnull",
"is_leap_year",
"isnull",
"ksum",
"last",
"lcase",
"len",
"length",
"long_sequence",
"max",
"micros",
"mid",
"millis",
"min",
"minute",
"month",
"now",
"nsum",
"nvl",
"rank",
"rnd_bin",
"rnd_boolean",
"rnd_byte",
"rnd_char",
"rnd_date",
"rnd_double",
"rnd_float",
"rnd_int",
"rnd_long",
"rnd_long256",
"rnd_short",
"rnd_str",
"rnd_symbol",
"rnd_timestamp",
"round",
"round_down",
"round_half_even",
"round_up",
"second",
"sum",
"sysdate",
"systimestamp",
"tables_columns",
"timestamp_sequence",
"to_date",
"to_str",
"to_timestamp",
"ucase",
"year",
]
const dataTypes = [
"binary",
"date",
"double",
"float",
"int",
"long",
"long256",
"short",
"string",
"symbol",
"timestamp",
]
const keywordMapper = this.createKeywordMapper( const keywordMapper = this.createKeywordMapper(
{ {
keyword: [keywords, builtinFunctions, builtinConstants, dataTypes].join( keyword: [keywords, builtinFunctions, builtinConstants, dataTypes]
"|", .map((k) => k.join("|"))
), .join("|"),
}, },
"identifier", "identifier",
true, true,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册