Skip to content

fix: #239 correct suggestion word ranges - #486

Open
liuxy0551 wants to merge 1 commit into
DTStack:nextfrom
liuxy0551:fix_239
Open

fix: #239 correct suggestion word ranges#486
liuxy0551 wants to merge 1 commit into
DTStack:nextfrom
liuxy0551:fix_239

Conversation

@liuxy0551

Copy link
Copy Markdown
Collaborator

问题

  1. 表名信息识别存在不准确 #239

getSuggestionAtCaretPosition 生成表名候选时,table.wordRanges 会错误包含表名后的空格、AS 或别名。

修改内容

  • BasicSQL 中统一计算候选词范围
  • 使用后续最近候选的起始位置截断当前候选
  • 过滤空格、注释等非默认 channel token
  • 保留 db. 等未完成限定表名
  • MySQL、Flink、Spark、Hive、PostgreSQL、Trino、Impala、GenericSQL 统一接入
  • 新增跨方言参数化回归测试

验证

  • 新增测试:34/34 通过
  • pnpm run check-types 通过
  • pnpm run prettier-check 通过
  • git diff --check 通过

#239 中提到的运行结果会是:

{
  "syntax": [
    {
      "syntaxContextType": "table",
      "wordRanges": [
        {
          "text": "current_catalog_schema1",
          "line": 1,
          "startIndex": 14,
          "endIndex": 36,
          "startColumn": 15,
          "endColumn": 38
        }
      ]
    }
  ],
  "keywords": ["FORCE", "IGNORE", "USE", "...", "AS", "..."]
}

@liuxy0551
liuxy0551 requested a review from Cythia828 July 29, 2026 09:11
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