Skip to content

Commit

Permalink
feat: improve highlight conf (DTStack#122)
Browse files Browse the repository at this point in the history
* feat: some keywords

* feat: highlight brackets for customParams

* feat: highlight keywords for sparksql materialized view
  • Loading branch information
liuxy0551 authored Apr 22, 2024
1 parent ea22ff0 commit 0d14d3d
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/languages/hive/hive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ export const language = <languages.IMonarchLanguage>{
{ include: '@scopes' },
{ include: '@complexDataTypes' },
[/[;,.]/, TokenClassConsts.DELIMITER],
[/[\(\)\[\]]/, '@brackets'],
[/[\(\)\[\]\{\}]/, '@brackets'],
[
/[\w@#$]+/,
{
Expand Down
3 changes: 2 additions & 1 deletion src/languages/impala/impala.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ export const language = <languages.IMonarchLanguage>{
typeKeywords: [
// https://impala.apache.org/docs/build/html/topics/impala_datatypes.html
'ARRAY',
'BINARY',
'BIGINT',
'BOOLEAN',
'CHAR',
Expand All @@ -455,7 +456,7 @@ export const language = <languages.IMonarchLanguage>{
'TIMESTAMP',
'TINYINT',
'VARCHAR',
'Complex'
'COMPLEX'
],
scopeKeywords: ['CASE', 'END', 'WHEN', 'THEN', 'ELSE'],
pseudoColumns: [
Expand Down
2 changes: 1 addition & 1 deletion src/languages/mysql/mysql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ export const language = <languages.IMonarchLanguage>{
{ include: '@scopes' },
{ include: '@complexOperators' },
[/[;,.]/, TokenClassConsts.DELIMITER],
[/[()]/, '@brackets'],
[/[\(\)\[\]\{\}]/, '@brackets'],
[
/[\w@]+/,
{
Expand Down
4 changes: 2 additions & 2 deletions src/languages/pgsql/pgsql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ testTokenization('pgsql', [
{ startIndex: 7, type: postfixTokenClass(TokenClassConsts.WHITE) },
{ startIndex: 8, type: postfixTokenClass(TokenClassConsts.IDENTIFIER) },
{ startIndex: 10, type: postfixTokenClass(TokenClassConsts.WHITE) },
{ startIndex: 11, type: postfixTokenClass(TokenClassConsts.IDENTIFIER) },
{ startIndex: 11, type: postfixTokenClass(TokenClassConsts.TYPE) },
{ startIndex: 14, type: postfixTokenClass(TokenClassConsts.WHITE) },
{ startIndex: 15, type: postfixTokenClass(TokenClassConsts.OPERATOR_SYMBOL) },
{ startIndex: 16, type: postfixTokenClass(TokenClassConsts.WHITE) },
Expand Down Expand Up @@ -399,7 +399,7 @@ testTokenization('pgsql', [
[
{
line: 'int',
tokens: [{ startIndex: 0, type: postfixTokenClass(TokenClassConsts.IDENTIFIER) }]
tokens: [{ startIndex: 0, type: postfixTokenClass(TokenClassConsts.TYPE) }]
}
],

Expand Down
8 changes: 7 additions & 1 deletion src/languages/pgsql/pgsql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,12 @@ export const language = <languages.IMonarchLanguage>{
'CAHR',
'BPCHAR',
'TEXT',
'BYTEA',
'JSON',
'GEOMETRY',
'MAP',
'ARRAY',
'INT',
'TIMESTAMP',
'DATE',
'INTERVAL',
Expand Down Expand Up @@ -975,7 +981,7 @@ export const language = <languages.IMonarchLanguage>{
{ include: '@scopes' },
{ include: '@complexDataTypes' },
[/[;,.]/, TokenClassConsts.DELIMITER],
[/[\(\)\[\]]/, '@brackets'],
[/[\(\)\[\]\{\}]/, '@brackets'],
[
/[\w@#$]+/,
{
Expand Down
10 changes: 9 additions & 1 deletion src/languages/spark/spark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,21 +197,29 @@ export const language = <languages.IMonarchLanguage>{
'COMMENT',
'DATABASE',
'DESC',
'DISABLE',
'ENABLE',
'INDEX',
'LIMIT',
'LOAD',
'MATCHED',
'MATERIALIZED',
'KW_OVER',
'OPTIMIZE',
'OVERWRITE',
'PARTITIONED',
'REFRESH',
'RENAME',
'REWRITE',
'SCHEMA',
'SHOW',
'SKEWED',
'SORTED',
'STORED',
'TBLPROPERTIES',
'USE',
'VIEW'
'VIEW',
'ZORDER'
],
operators: [
// Logical
Expand Down

0 comments on commit 0d14d3d

Please sign in to comment.