Skip to content
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

fix: update isContainCaret judgment when caret position token is whit… #390

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JackWang032
Copy link
Collaborator

修复 #288

问题产生原因:

空格等hidden-channel类型的 token 会被 antlr4 解析时忽略掉,导致判断语句结束位置时, ctx.stop 关联的 token 不会是空格。

image

解决方法:
从当前 token 位置往前找到第一个非hidden-channel token 作为判断依据, 同时需要排除掉分号情况。例如:

# tb实体中isContainCaret = true
SELECT id FROM tb WHERE  <cursor_pos>

# tb实体中isContainCaret = false
SELECT id FROM tb WHERE   ; <cursor_pos>

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.

1 participant