AI Assistant 'Insert at Cursor' does not insert the SQL into the query editor
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 88/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, postgresql
调研方向
从 web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx 中的 NLQ_INSERT_SQL 监听器开始检查,然后查看 CustomEditorView.js 和现有的 replaceSelection 用法。确认“Insert at Cursor”会在光标位置添加返回的 SQL,并且“Replace Query”仍能正常工作;如果有相关的查询编辑器测试,请运行这些测试。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
When the AI Assistant returns a SQL block, clicking "Insert at Cursor" switches to the Query tab but does not insert the SQL. "Replace Query" works correctly.
To Reproduce
- Open a Query Tool with an AI provider configured.
- Ask the AI Assistant for a query.
- Click "Insert at Cursor" on the returned SQL block: the Query tab is focused, but the editor content is unchanged.
Expected behavior
The SQL is inserted at the cursor position in the query editor.
Cause
The NLQ_INSERT_SQL listener at web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx:237-242 calls editor.current?.replaceRange(sql, cursorPos), which is a CodeMirror 5 API. The editor is now a CustomEditorView (CodeMirror 6, web/pgadmin/static/js/components/ReactCodeMirror/CustomEditorView.js), which has no replaceRange method, so the call throws a TypeError and nothing is inserted. The FOCUS_PANEL event is fired separately by NLQChatPanel.jsx, which is why the tab still switches.
Using the existing editor.current?.replaceSelection(sql) (which inserts at the cursor, or replaces any selected text) should fix it.
Desktop
- pgAdmin version: 9.19 (release candidate builds)
- 主要语言
- Python
- 星标
- 3.9k
- 派生
- 914
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 37
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pgadmin-org/pgadmin4 的其他 Issue
-
Bug
难度 2/5 1-3 小时 新手友好度 78/100
pgadmin-org/pgadmin4#10673 ·
维护者通常 1 天内回复
-
Import/Export Data fails for a file name containing a backslash, and creates a stray file named E未关闭Bug
难度 2/5 1-3 小时 新手友好度 82/100
pgadmin-org/pgadmin4#10672 ·
维护者通常 1 天内回复
-
Helm chart: allow setting ingressClassName on the Ingress可能已有人在做 @commarla 于 5 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
pgadmin-org/pgadmin4#10658 ·
维护者通常 1 天内回复
-
Feature
难度 2/5 1-3 小时 新手友好度 78/100
pgadmin-org/pgadmin4#10426 · 3 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Feature
难度 2/5 1-3 小时 新手友好度 68/100
pgadmin-org/pgadmin4#10272 · 5 条评论 ·
维护者通常 1 天内回复
查看 pgadmin-org/pgadmin4 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
btclib-org/btclib-wallet#587 · 1 条评论 ·
维护者通常 1 天内回复
-
documentation
难度 2/5 1-3 小时 新手友好度 68/100
Judgment-Pack/judgment-pack-spec#275 ·
维护者通常 1 天内回复
-
ai-generated
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复
-
documentation good first issue priority: low size: XS
难度 1/5 1-3 小时 新手友好度 92/100
yeongseon/azure-functions-doctor-python#651 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
Changaco/python-libarchive-c#146 ·