Skip to content

Commit d479d06

Browse files
authored
Merge pull request #134 from halcyon-tech/ca/column_precision
add column precision to content assist
2 parents 0fa7e1e + 6f86700 commit d479d06

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/language/providers/completionProvider.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,30 @@ function isEnabled() {
7272
function getParmAttributes(parm: SQLParm): string {
7373
const lines: string[] = [
7474
`Column: ${parm.PARAMETER_NAME}`,
75-
`Type: ${parm.DATA_TYPE}`,
75+
`Type: ${prepareParamType(parm)}`,
7676
`HAS_DEFAULT: ${parm.DEFAULT || `-`}`,
7777
`IS_NULLABLE: ${parm.IS_NULLABLE}`,
7878
];
7979
return lines.join(`\n `);
8080
}
8181

82+
function prepareParamType(param: TableColumn | SQLParm): string {
83+
if (param.CHARACTER_MAXIMUM_LENGTH) {
84+
return `${param.DATA_TYPE}(${param.CHARACTER_MAXIMUM_LENGTH})`;
85+
}
86+
87+
if (param.NUMERIC_PRECISION !== null && param.NUMERIC_SCALE !== null) {
88+
return `${param.DATA_TYPE}(${param.NUMERIC_PRECISION}, ${param.NUMERIC_SCALE})`;
89+
}
90+
91+
return `${param.DATA_TYPE}`;
92+
}
93+
94+
8295
function getColumnAttributes(column: TableColumn): string {
8396
const lines: string[] = [
8497
`Column: ${column.COLUMN_NAME}`,
85-
`Type: ${column.DATA_TYPE}`,
98+
`Type: ${prepareParamType(column)}`,
8699
`HAS_DEFAULT: ${column.HAS_DEFAULT}`,
87100
`IS_IDENTITY: ${column.IS_IDENTITY}`,
88101
`IS_NULLABLE: ${column.IS_NULLABLE}`,

0 commit comments

Comments
 (0)