13.9.0 • Published 7 months ago
@gravity-ui/websql-autocomplete v13.9.0
WebSQL autocomplete
A tool that provides autocompletion for various sql dialects.
Autocomplete theory
In order to parse any language, you need a lexer (tokenizer) and a parser (ast builder)
Resources to research:
- The ANTLR Mega Tutorial: https://tomassetti.me/antlr-mega-tutorial/
- Code Completion with ANTLR4-c3: https://tomassetti.me/code-completion-with-antlr4-c3/
How everything works
- ANTLR4 grammar and lexer for different
{dialect}
are defined insrc/autocomplete/databases/{dialect}/grammar
directories. - Actual parsers and lexers for different
{dialect}
are generated intosrc/autocomplete/databases/{dialect}/generated
directories. - Dialect specific code, which is required for the core logic to work, is put in
src/autocomplete/databases/{dialect}/{dialect}-autocomplete.ts
files. - The core logic is inside
src/autocomplete/shared/autocomplete.ts
file. It uses dialect specific helpers to generate autocomplete suggestions based on current cursor position.
How to add a new dialect
- Add new dialect files to src/autocomplete/databases/{$dialect}
- Add new dialect to the
typesVersions
,exports
variables in package.json - Add new dialect to the
databases
array in build.js
Main scripts
npm run generate
- Generate parsers and lexers (Java has to be installed on your system for this to work)npm run test
- Run tests
13.8.0
8 months ago
13.7.1
8 months ago
13.9.0
7 months ago
13.8.1
8 months ago
13.6.0
9 months ago
13.7.0
9 months ago
13.4.0
9 months ago
13.3.1
10 months ago
13.5.0
9 months ago
13.2.0
10 months ago
13.3.0
10 months ago
13.0.0
10 months ago
13.1.0
10 months ago
12.7.0
10 months ago
12.8.0
10 months ago
12.7.1
10 months ago
12.3.0
11 months ago
12.1.2
12 months ago
12.4.0
11 months ago
12.5.0
11 months ago
12.4.1
11 months ago
12.6.0
10 months ago
12.4.2
11 months ago
12.0.0
12 months ago
12.1.0
12 months ago
12.2.0
11 months ago
12.1.1
12 months ago
8.3.0
1 year ago
10.0.0
1 year ago
8.2.0
1 year ago
10.1.0
1 year ago
10.2.0
1 year ago
10.3.0
1 year ago
10.2.1
1 year ago
8.4.0
1 year ago
9.1.1
1 year ago
9.1.0
1 year ago
9.0.0
1 year ago
11.0.0
1 year ago
8.1.0
1 year ago
8.0.2
2 years ago
8.0.1
2 years ago
8.0.0
2 years ago