fix(editor): allow case conversion inside string literals

This commit is contained in:
Melody Ruch authored and GitHub committed 2026-09-04 16:46:24 +08:00
1 parent 805ddac61c
commit 795cd13f88
2 files changed
+17 -2

No files matched your search

@@ -23,6 +23,14 @@ export function convertSqlSelectionCase(sql: string, range: SqlSelectionRange, m
});
if (protectedTokens.length === 0) return convertCase(sql.slice(from, to), mode);
// A selection fully contained inside one protected token (e.g. the user selected only
// text inside a string literal) carries no risk of collateral damage to surrounding SQL,
// so honor the explicit request instead of silently no-oping it.
const [only] = protectedTokens;
if (protectedTokens.length === 1 && only.span.start <= from && to <= only.span.end) {
return convertCase(sql.slice(from, to), mode);
}
let converted = "";
let cursor = from;
for (const item of protectedTokens) {