refactor: standard naming (#278)
* refactor: rename flinksql to flink * refactor: rename pgsql to postgresql * refactor: rename trinosql to trino * refactor: replace all default exports with named export * refactor: rename basicParser to basicSQL * refactor: rename basic-parser-types to types * refactor: replace arrow func with plain func
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import MySQL from 'src/parser/mysql';
|
||||
import { CaretPosition, EntityContextType } from 'src/parser/common/basic-parser-types';
|
||||
import { MySQL } from 'src/parser/mysql';
|
||||
import { CaretPosition, EntityContextType } from 'src/parser/common/types';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
path.join(__dirname, 'fixtures', 'multipleStatement.sql'),
|
||||
@ -9,14 +9,14 @@ const syntaxSql = fs.readFileSync(
|
||||
);
|
||||
|
||||
describe('MySQL Multiple Statements Syntax Suggestion', () => {
|
||||
const parser = new MySQL();
|
||||
const mysql = new MySQL();
|
||||
|
||||
test('Select from table ', () => {
|
||||
const pos: CaretPosition = {
|
||||
lineNumber: 1,
|
||||
column: 15,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const suggestion = syntaxes?.find(
|
||||
(syn) => syn.syntaxContextType === EntityContextType.TABLE
|
||||
);
|
||||
@ -30,7 +30,7 @@ describe('MySQL Multiple Statements Syntax Suggestion', () => {
|
||||
lineNumber: 9,
|
||||
column: 17,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const suggestion = syntaxes?.find(
|
||||
(syn) => syn.syntaxContextType === EntityContextType.TABLE_CREATE
|
||||
);
|
||||
@ -44,7 +44,7 @@ describe('MySQL Multiple Statements Syntax Suggestion', () => {
|
||||
lineNumber: 15,
|
||||
column: 13,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const suggestion = syntaxes?.find(
|
||||
(syn) => syn.syntaxContextType === EntityContextType.TABLE
|
||||
);
|
||||
@ -58,7 +58,7 @@ describe('MySQL Multiple Statements Syntax Suggestion', () => {
|
||||
lineNumber: 21,
|
||||
column: 87,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const suggestion = syntaxes?.find(
|
||||
(syn) => syn.syntaxContextType === EntityContextType.TABLE
|
||||
);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import MySQL from 'src/parser/mysql';
|
||||
import { CaretPosition, EntityContextType } from 'src/parser/common/basic-parser-types';
|
||||
import { MySQL } from 'src/parser/mysql';
|
||||
import { CaretPosition, EntityContextType } from 'src/parser/common/types';
|
||||
import { commentOtherLine } from 'test/helper';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
|
@ -1,7 +1,7 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import MySQL from 'src/parser/mysql';
|
||||
import { EntityContextType, CaretPosition } from 'src/parser/common/basic-parser-types';
|
||||
import { MySQL } from 'src/parser/mysql';
|
||||
import { EntityContextType, CaretPosition } from 'src/parser/common/types';
|
||||
import { commentOtherLine } from 'test/helper';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
@ -10,10 +10,10 @@ const syntaxSql = fs.readFileSync(
|
||||
);
|
||||
|
||||
describe('MySQL Syntax Suggestion', () => {
|
||||
const parser = new MySQL();
|
||||
const mysql = new MySQL();
|
||||
|
||||
test('Validate Syntax SQL', () => {
|
||||
expect(parser.validate(syntaxSql).length).not.toBe(0);
|
||||
expect(mysql.validate(syntaxSql).length).not.toBe(0);
|
||||
});
|
||||
|
||||
test('Insert table ', () => {
|
||||
@ -21,7 +21,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 1,
|
||||
column: 18,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -38,7 +38,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 3,
|
||||
column: 18,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -55,7 +55,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 5,
|
||||
column: 17,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -72,7 +72,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 7,
|
||||
column: 26,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -89,7 +89,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 9,
|
||||
column: 28,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -106,7 +106,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 11,
|
||||
column: 15,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -123,7 +123,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 13,
|
||||
column: 20,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -140,7 +140,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 15,
|
||||
column: 27,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -157,7 +157,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 17,
|
||||
column: 19,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -174,7 +174,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 19,
|
||||
column: 26,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -191,7 +191,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 21,
|
||||
column: 39,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -208,7 +208,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 23,
|
||||
column: 17,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -225,7 +225,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 25,
|
||||
column: 39,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -242,7 +242,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 27,
|
||||
column: 48,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -259,7 +259,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 29,
|
||||
column: 22,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -276,7 +276,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 31,
|
||||
column: 41,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -293,7 +293,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 33,
|
||||
column: 24,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -310,7 +310,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 35,
|
||||
column: 29,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -327,7 +327,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 37,
|
||||
column: 8,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -344,7 +344,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 39,
|
||||
column: 13,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -361,7 +361,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 41,
|
||||
column: 8,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -378,7 +378,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 43,
|
||||
column: 13,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -395,7 +395,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 45,
|
||||
column: 32,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -412,7 +412,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 47,
|
||||
column: 39,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -429,7 +429,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 49,
|
||||
column: 37,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -446,7 +446,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 51,
|
||||
column: 31,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -463,7 +463,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 53,
|
||||
column: 27,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -480,7 +480,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 55,
|
||||
column: 43,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -497,7 +497,7 @@ describe('MySQL Syntax Suggestion', () => {
|
||||
lineNumber: 57,
|
||||
column: 24,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
|
@ -1,20 +1,20 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import MySQL from 'src/parser/mysql';
|
||||
import { CaretPosition } from 'src/parser/common/basic-parser-types';
|
||||
import { MySQL } from 'src/parser/mysql';
|
||||
import { CaretPosition } from 'src/parser/common/types';
|
||||
import { commentOtherLine } from 'test/helper';
|
||||
|
||||
const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8');
|
||||
|
||||
describe('MySQL Token Suggestion', () => {
|
||||
const parser = new MySQL();
|
||||
const mysql = new MySQL();
|
||||
|
||||
test('After ALTER', () => {
|
||||
const pos: CaretPosition = {
|
||||
lineNumber: 1,
|
||||
column: 7,
|
||||
};
|
||||
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||
const suggestion = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(tokenSql, pos.lineNumber),
|
||||
pos
|
||||
)?.keywords;
|
||||
@ -45,7 +45,7 @@ describe('MySQL Token Suggestion', () => {
|
||||
lineNumber: 3,
|
||||
column: 8,
|
||||
};
|
||||
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||
const suggestion = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(tokenSql, pos.lineNumber),
|
||||
pos
|
||||
)?.keywords;
|
||||
@ -86,7 +86,7 @@ describe('MySQL Token Suggestion', () => {
|
||||
lineNumber: 5,
|
||||
column: 8,
|
||||
};
|
||||
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||
const suggestion = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(tokenSql, pos.lineNumber),
|
||||
pos
|
||||
)?.keywords;
|
||||
@ -99,7 +99,7 @@ describe('MySQL Token Suggestion', () => {
|
||||
lineNumber: 7,
|
||||
column: 10,
|
||||
};
|
||||
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||
const suggestion = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(tokenSql, pos.lineNumber),
|
||||
pos
|
||||
)?.keywords;
|
||||
@ -123,7 +123,7 @@ describe('MySQL Token Suggestion', () => {
|
||||
lineNumber: 9,
|
||||
column: 6,
|
||||
};
|
||||
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||
const suggestion = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(tokenSql, pos.lineNumber),
|
||||
pos
|
||||
)?.keywords;
|
||||
@ -156,7 +156,7 @@ describe('MySQL Token Suggestion', () => {
|
||||
lineNumber: 11,
|
||||
column: 8,
|
||||
};
|
||||
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||
const suggestion = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(tokenSql, pos.lineNumber),
|
||||
pos
|
||||
)?.keywords;
|
||||
@ -175,7 +175,7 @@ describe('MySQL Token Suggestion', () => {
|
||||
lineNumber: 13,
|
||||
column: 6,
|
||||
};
|
||||
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||
const suggestion = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(tokenSql, pos.lineNumber),
|
||||
pos
|
||||
)?.keywords;
|
||||
@ -188,7 +188,7 @@ describe('MySQL Token Suggestion', () => {
|
||||
lineNumber: 15,
|
||||
column: 6,
|
||||
};
|
||||
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||
const suggestion = mysql.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(tokenSql, pos.lineNumber),
|
||||
pos
|
||||
)?.keywords;
|
||||
|
Reference in New Issue
Block a user