feat(editor): execute single SQL directly without picker

* fix(ui): toast 消息支持换行显示

- 添加 max-w-3xl 限制最大宽度
- 使用 whitespace-pre-wrap 允许自动换行
- 添加 break-words 防止长单词溢出

* feat(editor): 单条 SQL 直接执行

---------

Co-authored-by: t8y2 <1156263951@qq.com>
Co-authored-by: staff <staff@qimaos-MacBook-Pro.local>
This commit is contained in:
authored and GitHub committed 2026-06-22 17:14:36 +08:00
1 parent 628fadf517
commit dac97b83a6
3 files changed
+40 -3

No files matched your search

@@ -17,6 +17,13 @@ export function supportsExecutionTargetPicker(databaseType?: DatabaseType): bool
return !!databaseType && (databaseType === "redis" || !NON_SQL_EXECUTION_TARGET_TYPES.has(databaseType));
}
export function hasMultipleExecutionTargets(sql: string, databaseType?: DatabaseType): boolean {
if (databaseType === "redis") {
return redisExecutableCommandCount(sql) > 1;
}
return splitSqlStatementRanges(sql).length > 1;
}
interface RawStatement {
/** Start offset (inclusive) of whitespace that can still target this statement. */
hitFrom: number;
@@ -825,6 +832,17 @@ function candidateFromRange(range: SqlTextRange, kind: SqlExecutionCandidate["ki
};
}
function redisExecutableCommandCount(sql: string): number {
let count = 0;
for (const line of sql.split(/\r?\n/)) {
const trimmed = line.trim();
if (!trimmed || trimmed.startsWith("#")) continue;
count += 1;
if (count > 1) return count;
}
return count;
}
function redisCommandRangeAtCursor(sql: string, cursorPos: number): SqlTextRange | null {
const pos = clampCursor(sql, cursorPos);
if (isCursorOnBlankLine(sql, pos)) return null;