MCPcopy Index your code
hub / github.com/deepnote/deepnote / getSqlBlockLabel

Function getSqlBlockLabel

packages/cli/src/utils/block-label.ts:101–121  ·  view source on GitHub ↗

* Get label for a SQL block - show first meaningful line.

(content: string)

Source from the content-addressed store, hash-verified

99 * Get label for a SQL block - show first meaningful line.
100 */
101function getSqlBlockLabel(content: string): string {
102 const lines = content.split('\n')
103
104 for (const line of lines) {
105 const trimmed = line.trim()
106 // Skip SQL comments
107 if (trimmed.startsWith('--')) {
108 // Use comment as label if it's descriptive
109 const comment = trimmed.slice(2).trim()
110 if (comment) {
111 return truncate(`-- ${comment}`, MAX_LABEL_LENGTH)
112 }
113 continue
114 }
115 if (trimmed) {
116 return truncate(trimmed, MAX_LABEL_LENGTH)
117 }
118 }
119
120 return 'sql (empty)'
121}
122
123/**
124 * Get label for a markdown block - show first line.

Callers 1

getBlockLabelFunction · 0.85

Calls 1

truncateFunction · 0.85

Tested by

no test coverage detected