-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: cql autocompleter with syntax highlighter #46
Conversation
Hey @danielhe4rt, I've updated the autocomplete function generator and now it seems to work for CQL syntax, but still needs to make the keyspaces autocomplete. |
"USING", | ||
"VALUES", | ||
"VIEW", | ||
"WHERE", | ||
"WITH", | ||
"WRITETIME", | ||
]; | ||
|
||
const functions = [ | ||
"blobAsBigint", | ||
"blobAsBoolean", | ||
"blobAsDecimal", | ||
"blobAsDouble", | ||
"blobAsFloat", | ||
"blobAsInt", | ||
"blobAsText", | ||
"blobAsTimestamp", | ||
"blobAsUUID", | ||
"blobAsVarchar", | ||
"blobAsVarint", | ||
"dateOf", | ||
"now", | ||
"unixTimestampOf", | ||
"uuid", | ||
"timeuuid", | ||
"minTimeuuid", | ||
"maxTimeuuid", | ||
"toDate", | ||
"toTimestamp", | ||
"toUnixTimestamp", | ||
"writetime", | ||
"ttl", | ||
"token", | ||
"bigintAsBlob", | ||
"booleanAsBlob", | ||
"dateAsBlob", | ||
"decimalAsBlob", | ||
"doubleAsBlob", | ||
"floatAsBlob", | ||
"inetAsBlob", | ||
"intAsBlob", | ||
"textAsBlob", | ||
"timestampAsBlob", | ||
"timeuuidAsBlob", | ||
"uuidAsBlob", | ||
"varcharAsBlob", | ||
"varintAsBlob", | ||
]; | ||
|
||
const dataTypes = [ | ||
"ascii", | ||
"bigint", | ||
"blob", | ||
"boolean", | ||
"counter", | ||
"date", | ||
"decimal", | ||
"double", | ||
"float", | ||
"frozen", | ||
"inet", | ||
"int", | ||
"list", | ||
"map", | ||
"set", | ||
"smallint", | ||
"text", | ||
"time", | ||
"timestamp", | ||
"timeuuid", | ||
"tinyint", | ||
"tuple", | ||
"uuid", | ||
"varchar", | ||
"varint", | ||
]; | ||
|
||
const operators = [ | ||
"=", | ||
">", | ||
"<", | ||
">=", | ||
"<=", | ||
"!=", | ||
"+", | ||
"-", | ||
"*", | ||
"/", | ||
"%", | ||
"IN", | ||
"CONTAINS", | ||
"CONTAINS KEY", | ||
"AND", | ||
"OR", | ||
"NOT", | ||
"IS", | ||
"NULL", | ||
"IS NOT NULL", | ||
"IS NULL", | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pq não move essas constantes para um arquivo separado para facilitar a leitura?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yo soy burrito mi cabeça no hablas frontend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point, the file cql-autocompleter.ts
was created to be this abstraction.
I think we can keep these constants in the same file for now, since we don't know how far the scope of the implementation will grow.
See #48
This Pull Requests aims to add Syntax Highlight for 'CQL' and bring Autocompletion for the Editor based on the Keyspace informations (fields, tables, keyspaces etc).
At the CQL Editor you will find these lines and everything must be around it.
Repositories used as reference:
Warning
There is an "compilation error" poppin so far when you try to add any completion. Most of the other projects currently uses Webpack plugin to handle it. I'm not sure how to solve it in NextJS.
Closes #16
Autocompletion and Syntax Highlighting Enhancements:
src/app/(main)/query-runner/_components/cql-autocompleter.ts
: Implemented a comprehensive autocompletion feature for CQL keywords, functions, data types, and operators using themonaco-editor
library.src/app/(main)/query-runner/_components/cql-editor.tsx
: Integrated the CQL autocompletion provider and registered the CQL language with the Monaco editor. Updated the editor configuration to use CQL instead of SQL. [1] [2] [3] [4] [5]src/app/(main)/query-runner/_components/cql-language.ts
: Defined the CQL language configuration and tokenizer for syntax highlighting in the Monaco editor.Minor Adjustments:
src/app/(main)/query-runner/_components/utils.tsx
: Minor formatting adjustment to improve code readability.