diff --git a/src/parser/common/types.ts b/src/parser/common/types.ts index 853673ce..20330305 100644 --- a/src/parser/common/types.ts +++ b/src/parser/common/types.ts @@ -44,6 +44,10 @@ export enum EntityContextType { COLUMN = 'column', /** column name that will be created */ COLUMN_CREATE = 'columnCreate', + /** table property key when creating table*/ + TABLE_PROPERTY_KEY = 'tablePropertyKey', + /** table property value when creating table*/ + TABLE_PROPERTY_VALUE = 'tablePropertyValue', } /** diff --git a/src/parser/flink/index.ts b/src/parser/flink/index.ts index eb727986..138666d2 100644 --- a/src/parser/flink/index.ts +++ b/src/parser/flink/index.ts @@ -31,6 +31,8 @@ export class FlinkSQL extends BasicSQL { 'JARS', ]); }); + + test('Create Statement table properties', () => { + const scenarios = [ + { + caretPosition: { + lineNumber: 9, + column: 45, + }, + entityContextType: EntityContextType.TABLE_PROPERTY_KEY, + }, + { + caretPosition: { + lineNumber: 9, + column: 55, + }, + entityContextType: EntityContextType.TABLE_PROPERTY_VALUE, + }, + ]; + + scenarios.forEach((scenario) => { + const suggestion = flink.getSuggestionAtCaretPosition( + commentOtherLine(tokenSql, scenario.caretPosition.lineNumber), + scenario.caretPosition + )?.syntax; + + expect(suggestion[0].syntaxContextType).toBe(scenario.entityContextType); + }); + }); });