Skip to content

Commit

Permalink
feat: support impala (#83)
Browse files Browse the repository at this point in the history
* feat: support impala in languages

* feat: add complexOperators and string_double

* feat: support impala in website

* fix: ICreateData import path

* fix: test error

* fix(impala): remove nonReservedKeywords in keywords

* fix(impala): update review comment
  • Loading branch information
LuckyFBB committed Dec 8, 2023
1 parent 4e7d9d4 commit 16934be
Show file tree
Hide file tree
Showing 10 changed files with 678 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ export enum LanguageIdEnum {
PL = 'plsql',
SPARK = 'sparksql',
SQL = 'sql',
TRINO = 'trinosql'
TRINO = 'trinosql',
IMPALA = 'impalasql'
}
18 changes: 18 additions & 0 deletions src/impalasql/impalaSQLWorker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { worker } from '../fillers/monaco-editor-core';
import ImpalaSQL from 'dt-sql-parser/dist/parser/impala';
import { BaseSQLWorker } from '../baseSQLWorker';
import { ICreateData } from '../_.contribution';

export class ImpalaSQLWorker extends BaseSQLWorker {
protected _ctx: worker.IWorkerContext;
protected parser: ImpalaSQL;
constructor(ctx: worker.IWorkerContext, createData: ICreateData) {
super();
this._ctx = ctx;
this.parser = new ImpalaSQL();
}
}

export function create(ctx: worker.IWorkerContext, createData: ICreateData): ImpalaSQLWorker {
return new ImpalaSQLWorker(ctx, createData);
}
23 changes: 23 additions & 0 deletions src/impalasql/impalasql.contribution.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { loadLanguage, registerLanguage } from '../_.contribution';
import { setupLanguageFeatures } from '../setupLanguageFeatures';
import { LanguageIdEnum } from '../common/constants';

registerLanguage({
id: LanguageIdEnum.IMPALA,
extensions: ['.impalasql'],
aliases: ['impalaSQL', 'impala', 'Impala'],
loader: () => import('./impalasql')
});

loadLanguage(LanguageIdEnum.IMPALA);

setupLanguageFeatures({
languageId: LanguageIdEnum.IMPALA,
completionItems: true,
diagnostics: true
});
Empty file added src/impalasql/impalasql.test.ts
Empty file.
Loading

0 comments on commit 16934be

Please sign in to comment.