SQL Completion Space Handler (editor/sqlCompletionInsertion.ts)

dbx · apps/desktop/src/lib/editor/sqlCompletionInsertion.ts · typescript · Apache-2.0
dev-tools, ui, database, lang:typescript, tag:editor

Determines if a space should be automatically appended after a SQL completion suggestion. Use this to improve IDE auto-complete UX by preventing unwanted spacing.

// Source: https://github.com/t8y2/dbx | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
export type SqlCompletionItemType = "keyword" | "table" | "column" | "snippet" | "function" | "schema" | "variable" | "sequence" | "property" | "text";

// `;` is deliberately absent: a statement terminator is never glued to the token
// in front of it, and accepting `BETWEEN` before an existing `;` used to insert
// `BETWEEN;`, leaving the user no way to keep typing the operand.
//
// Newlines and statement boundaries should also not suppress the auto-space;
// only an existing space/tab or punctuation should prevent it.
const COMPLETION_SPACE_BLOCKING_CHARACTERS = new Set([",", ":", ")", "]", 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key