Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
java
java
public enum BuiltInStyle {
        DEFAULT(null, null, null, null, null, null, null, null),
        DARK(BOLD_BLUE, WHITE, ITALIC_GREEN, ITALIC_GREEN, BOLD_GREEN, YELLOW, RED, MAGENTA),
        LIGHT(BOLD_RED, WHITE, ITALIC_CYAN, ITALIC_CYAN, BOLD_CYAN, YELLOW, GREEN, MAGENTA);
        private final SyntaxHighlightStyle style;

        BuiltInStyle(
                AttributedStyle keywordStyle,
                AttributedStyle defaultStyle,
                AttributedStyle blockCommentStyle,
                AttributedStyle lineCommentStyle,
                AttributedStyle hintStyle,
                AttributedStyle numberStyle,
                AttributedStyle singleQuotedStyle,
                AttributedStyle sqlIdentifierStyle) {
            style =
                    new SyntaxHighlightStyle(
                            blockCommentStyle,
                            lineCommentStyle,
                            hintStyle,
                            defaultStyle,
                            keywordStyle,
                            numberStyle,
                            singleQuotedStyle,
                            sqlIdentifierStyle);
        }

Completion

There are 2 types of completions: command completion and sql completion.

Currently for sql it is used CalciteAdviser.
Within this improvement the idea is to leave it except first words which are the same as Flink SQL command like "INSERT INTO", "BEGIN STATEMENT SET;" and so on...
For commands it is possible to use jline's org.jline.reader.impl.completer.ArgumentCompleter and org.jline.reader.impl.completer.AggregateCompleter.

The first one allows to build completers for commands consisting of several words e.g.  "BEGIN STATEMENT SET;" and the second one allows to unite them all together.

Cross dialect

Since there are at least 2 dialects in Flink (HIVE and DEFAULT). There could be a builtin dialect enum containing required info.
Taking current dialect it's possible to retrieve required info from that enum about quotes, comments and etc for parsing, highlighting and completion.

...