Expand description
CREATE TABLE sub-phase analyzer.
When the cursor sits inside the parenthesised body of a CREATE TABLE statement we want much narrower completion than the general SQL state machine offers: types when writing a column type, column constraint keywords (NOT NULL / DEFAULT / …) after the type, tables after REFERENCES, and so on. The user explicitly does NOT want all-table-column completion when they are typing a column identifier.
Strategy:
- Locate every
CREATE TABLE [IF NOT EXISTS] <name> (whose body contains the cursor. - From the body-open paren up to the cursor, tokenize and walk an
entry-level state machine that resets on each top-level
,. - Return a
Phasereflecting what the user is about to type.
Functions§
- detect
- Try to classify the cursor’s position inside an enclosing CREATE TABLE body. Returns None when the cursor is not inside one.