feat(sql): add ClickHouse function completion
This commit is contained in:
1 parent
a83925d6ba
commit
9bc1c1b0fb
16 files changed
+2326
-53
No files matched your search
@@ -20,6 +20,7 @@ import { insertValueHintColumnNames } from "@/lib/sql/insertValueHintColumns";
|
||||
import { formatSqlText, compressSqlText, type SqlFormatDialect } from "@/lib/sql/sqlFormatter";
|
||||
import { enabledSqlParameterSyntaxes, resolveSqlVariableSyntaxToggles } from "@/lib/sql/sqlVariableSyntax";
|
||||
import { blankLineDeletionChanges, replaceSelectedEditorText } from "@/lib/editor/queryEditorTextEdits";
|
||||
import { createSqlSignatureTooltipDom } from "@/lib/editor/sqlSignatureTooltip";
|
||||
import { buildSqlInConditionFromPasteSource, insertTextForSqlInCondition } from "@/lib/sql/sqlInListPaste";
|
||||
import { resolveSqlSingleQuoteKeyAction } from "@/lib/sql/sqlQuoteCaret";
|
||||
import { formatMongoShellText } from "@/lib/mongo/mongoFormatter";
|
||||
@@ -1831,41 +1832,6 @@ function createHoverDom(title: string, detail: string, sqlContent?: string, rows
|
||||
return dom;
|
||||
}
|
||||
|
||||
function createSignatureDom(signature: ReturnType<typeof getSqlFunctionSignatureHelp>) {
|
||||
const dom = document.createElement("div");
|
||||
dom.className = "rounded-md border bg-popover px-3 py-2 text-xs text-popover-foreground shadow-md";
|
||||
if (!signature) return dom;
|
||||
|
||||
const signatureNode = document.createElement("div");
|
||||
signatureNode.className = "font-mono";
|
||||
|
||||
const nameNode = document.createElement("span");
|
||||
nameNode.className = "text-muted-foreground";
|
||||
nameNode.textContent = `${signature.name}(`;
|
||||
signatureNode.appendChild(nameNode);
|
||||
|
||||
signature.parameters.forEach((parameter, index) => {
|
||||
if (index > 0) {
|
||||
const comma = document.createElement("span");
|
||||
comma.className = "text-muted-foreground";
|
||||
comma.textContent = ", ";
|
||||
signatureNode.appendChild(comma);
|
||||
}
|
||||
const parameterNode = document.createElement("span");
|
||||
parameterNode.className = index === signature.activeParameter ? "font-semibold text-foreground" : "text-muted-foreground";
|
||||
parameterNode.textContent = parameter;
|
||||
signatureNode.appendChild(parameterNode);
|
||||
});
|
||||
|
||||
const closeNode = document.createElement("span");
|
||||
closeNode.className = "text-muted-foreground";
|
||||
closeNode.textContent = ")";
|
||||
signatureNode.appendChild(closeNode);
|
||||
dom.appendChild(signatureNode);
|
||||
|
||||
return dom;
|
||||
}
|
||||
|
||||
async function resolveSqlHoverTooltip(currentView: EditorViewType, pos: number) {
|
||||
if (!props.connectionId || props.database == null || contextMenuOpen.value) return null;
|
||||
|
||||
@@ -3733,7 +3699,7 @@ onMounted(async () => {
|
||||
pos: currentState.selection.main.head,
|
||||
above: false,
|
||||
clip: false,
|
||||
create: () => ({ dom: createSignatureDom(signature) }),
|
||||
create: () => ({ dom: createSqlSignatureTooltipDom(signature) }),
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user