Skip to content

Commit

Permalink
feat: trino autocomplete (#245)
Browse files Browse the repository at this point in the history
* feat: add basic trino autocomplete

* feat: fix tests, improve autocomplete

* feat: remove pull_request_template.md

* chore: remove headers

* fix: fix tests

* fix: remove excess tokens file
  • Loading branch information
NikitaShkaruba authored Nov 21, 2024
1 parent dbe5502 commit d37ba50
Show file tree
Hide file tree
Showing 44 changed files with 39,472 additions and 2 deletions.
1 change: 0 additions & 1 deletion .github/pull_request_template.md

This file was deleted.

7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@
"generate:clickhouse": "rimraf src/autocomplete/databases/clickhouse/generated && antlr4ng -Dlanguage=TypeScript -o src/autocomplete/databases/clickhouse/generated/ -visitor -no-listener -Xexact-output-dir src/autocomplete/databases/clickhouse/grammar/ClickHouseLexer.g4 src/autocomplete/databases/clickhouse/grammar/ClickHouseParser.g4 && bash scripts/patch-generated.sh clickhouse",
"generate:yql": "rimraf src/autocomplete/databases/yql/generated && antlr4ng -Dlanguage=TypeScript -o src/autocomplete/databases/yql/generated/ -visitor -no-listener -Xexact-output-dir src/autocomplete/databases/yql/grammar/YQL.g4 && bash scripts/patch-generated.sh yql",
"generate:redis": "rimraf src/autocomplete/databases/redis/generated && antlr4ng -Dlanguage=TypeScript -o src/autocomplete/databases/redis/generated/ -visitor -no-listener -Xexact-output-dir src/autocomplete/databases/redis/grammar/RedisLexer.g4 src/autocomplete/databases/redis/grammar/RedisParser.g4 && bash scripts/patch-generated.sh redis",
"generate:trino": "rimraf src/autocomplete/databases/trino/generated && antlr4ng -Dlanguage=TypeScript -o src/autocomplete/databases/trino/generated/ -visitor -no-listener -Xexact-output-dir src/autocomplete/databases/trino/grammar/TrinoLexer.g4 src/autocomplete/databases/trino/grammar/TrinoParser.g4 && bash scripts/patch-generated.sh trino",
"test": "node --experimental-vm-modules ./node_modules/.bin/jest --verbose src --testPathIgnorePatterns tests/generated/.+",
"test:mysql": "node --experimental-vm-modules ./node_modules/.bin/jest --verbose src --testPathIgnorePatterns tests/generated/.+ --rootDir src/autocomplete/databases/mysql/tests",
"test:postgresql": "node --experimental-vm-modules ./node_modules/.bin/jest --verbose src --testPathIgnorePatterns tests/generated/.+ --rootDir src/autocomplete/databases/postgresql/tests",
"test:clickhouse": "node --experimental-vm-modules ./node_modules/.bin/jest --verbose src --testPathIgnorePatterns tests/generated/.+ --rootDir src/autocomplete/databases/clickhouse/tests",
"test:yql": "node --experimental-vm-modules ./node_modules/.bin/jest --verbose src --testPathIgnorePatterns tests/generated/.+ --rootDir src/autocomplete/databases/yql/tests",
"test:redis": "node --experimental-vm-modules ./node_modules/.bin/jest --verbose src --testPathIgnorePatterns tests/generated/.+ --rootDir src/autocomplete/databases/redis/tests",
"test:trino": "node --experimental-vm-modules ./node_modules/.bin/jest --verbose src --testPathIgnorePatterns tests/generated/.+ --rootDir src/autocomplete/databases/trino/tests",
"build": "rimraf dist && node build.js && tsc -p tsconfig.build.json --declarationDir dist/types",
"prepublishOnly": "npm run build"
},
Expand Down
5 changes: 4 additions & 1 deletion scripts/patch-generated.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DIALECT=$1

# Check that dialect is correct
if [ "$DIALECT" != "mysql" ] && [ "$DIALECT" != "postgresql" ] && [ "$DIALECT" != "clickhouse" ] && [ "$DIALECT" != "yql" ] && [ "$DIALECT" != "redis" ]
if [ "$DIALECT" != "mysql" ] && [ "$DIALECT" != "postgresql" ] && [ "$DIALECT" != "clickhouse" ] && [ "$DIALECT" != "yql" ] && [ "$DIALECT" != "redis" ] && [ "$DIALECT" != "trino" ]
then
echo "dialect '$DIALECT' is not supported"
exit 0
Expand All @@ -20,6 +20,9 @@ then
elif [ "$DIALECT" == "redis" ]
then
FILE_PREFIX=src/autocomplete/databases/$DIALECT/generated/Redis
elif [ "$DIALECT" == "trino" ]
then
FILE_PREFIX=src/autocomplete/databases/$DIALECT/generated/Trino
else
FILE_PREFIX=src/autocomplete/databases/$DIALECT/generated/ClickHouse
fi
Expand Down
Loading

0 comments on commit d37ba50

Please sign in to comment.