Skip to content

Commit 0179ef4

Browse files
committed
Provide better type information for columns
1 parent 26f77a6 commit 0179ef4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/language/provider.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,17 @@ exports.initialise = async (context) => {
115115
columns.forEach(column => {
116116
const item = new vscode.CompletionItem(column.COLUMN_NAME.toLowerCase(), vscode.CompletionItemKind.Field);
117117
item.insertText = new vscode.SnippetString(column.COLUMN_NAME.toLowerCase());
118-
item.detail = column.DATA_TYPE;
118+
119+
let detail = null, length;
120+
if ([`DECIMAL`, `ZONED`].includes(column.DATA_TYPE)) {
121+
length = column.NUMERIC_PRECISION || null;
122+
detail = `${column.DATA_TYPE}${length ? `(${length}${column.NUMERIC_PRECISION ? `, ${column.NUMERIC_SCALE}` : ``})` : ``}`
123+
} else {
124+
length = column.CHARACTER_MAXIMUM_LENGTH || null;
125+
detail = `${column.DATA_TYPE}${length ? `(${length})` : ``}`
126+
}
127+
128+
item.detail = detail;
119129
item.documentation = new vscode.MarkdownString(`${column.COLUMN_TEXT} (\`${definedAs.db}.${definedAs.table}\`)`);
120130
items.push(item);
121131
});

0 commit comments

Comments
 (0)