Skip to content

refactor: use new parser for autocompletion#536

Open
emrberk wants to merge 30 commits intomainfrom
refactor/new-parser
Open

refactor: use new parser for autocompletion#536
emrberk wants to merge 30 commits intomainfrom
refactor/new-parser

Conversation

@emrberk
Copy link
Collaborator

@emrberk emrberk commented Feb 13, 2026

No description provided.

@emrberk emrberk marked this pull request as ready for review February 24, 2026 18:27
@emrberk emrberk changed the title refactor: use new parser for autocompletion and query detection refactor: use new parser for autocompletion Feb 24, 2026
Copy link

@RaphDal RaphDal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR!

Comment on lines +111 to +131
function isCursorInComment(text: string, cursorOffset: number): boolean {
let i = 0
const end = Math.min(cursorOffset, text.length)
while (i < end) {
const ch = text[i]
const next = text[i + 1]
// Line comment: -- until end of line
if (ch === "-" && next === "-") {
i += 2
while (i < end && text[i] !== "\n") i++
if (i >= cursorOffset) return true
continue
}
// Block comment: /* until */
if (ch === "/" && next === "*") {
i += 2
while (i < text.length && !(text[i] === "*" && text[i + 1] === "/")) i++
if (i >= cursorOffset) return true
i += 2 // skip */
continue
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double-quoted identifiers like "my--table" or "data/set/" causes false comment detection.
Example: SELECT AdvEngineID FROM "hits--table";

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added the double quote check 👍

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still an issue with the query I provided, only the hits part get underlined in red if the table doesn't exist (maybe it's unrelated to this PR though?)
Also, there is no auto-completion on table names when in double-quotes: SELECT x FROM "hit <- nothing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants