@questdb/sql-parser 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/autocomplete/content-assist.d.ts +27 -0
- package/dist/index.cjs +375 -176
- package/dist/index.js +375 -176
- package/dist/parser/parser.d.ts +6 -0
- package/dist/parser/visitor.d.ts +7 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
## 0.1.2 - 2026.02.25
|
|
5
|
+
### Fixed
|
|
6
|
+
- Prioritize tables with mentioned columns in the suggestions [#6](https://github.com/questdb/sql-parser/pull/6)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## 0.1.1 - 2026.02.23
|
|
10
|
+
### Fixed
|
|
11
|
+
- grammar-level table/column classification, join-specific suggestions [#2](https://github.com/questdb/sql-parser/pull/2)
|
|
12
|
+
|
|
13
|
+
|
|
3
14
|
## 0.1.0 - 2026.02.19
|
|
4
15
|
- Initial release
|
|
@@ -33,7 +33,34 @@ export interface ContentAssistResult {
|
|
|
33
33
|
* should resolve this against tablesInScope aliases/names to filter columns.
|
|
34
34
|
*/
|
|
35
35
|
qualifiedTableRef?: string;
|
|
36
|
+
/** Whether the grammar context expects column names (expression/columnRef positions) */
|
|
37
|
+
suggestColumns: boolean;
|
|
38
|
+
/** Whether the grammar context expects table names (tableName positions, or expression context) */
|
|
39
|
+
suggestTables: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Bare column names (lowercase) referenced before the cursor in expression
|
|
42
|
+
* context. Used by the provider to boost tables containing all these columns.
|
|
43
|
+
*/
|
|
44
|
+
referencedColumns: Set<string>;
|
|
36
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Extract bare column names referenced in expression context from a token list.
|
|
48
|
+
*
|
|
49
|
+
* Scans the tokens and collects identifier names that are likely column
|
|
50
|
+
* references, excluding:
|
|
51
|
+
* - Qualified identifiers (followed by a Dot token — table/alias qualifiers)
|
|
52
|
+
* - Middle segments of multi-part names (preceded AND followed by a Dot)
|
|
53
|
+
* - Known table names and aliases (matched against tableAndAliasSet)
|
|
54
|
+
* - Function calls (followed by a left-parenthesis token)
|
|
55
|
+
*
|
|
56
|
+
* @param tokens - Tokens to scan
|
|
57
|
+
* @param tableAndAliasSet - Lowercase table names and aliases already in scope
|
|
58
|
+
* (built from tablesInScope by the caller). Identifiers matching any of these
|
|
59
|
+
* are excluded because they are table/alias references, not column names.
|
|
60
|
+
*
|
|
61
|
+
* Returns a Set of lowercase column names for efficient lookup.
|
|
62
|
+
*/
|
|
63
|
+
export declare function extractReferencedColumns(tokens: IToken[], tableAndAliasSet: Set<string>): Set<string>;
|
|
37
64
|
/**
|
|
38
65
|
* Get content assist suggestions for a SQL string at a given cursor position
|
|
39
66
|
*
|