Skip to content

Commit 1c768e6

Browse files
authored
fix: error in loading param datatypes documentation (#835)
Fix error in loading param datatypes
1 parent 050acc5 commit 1c768e6

2 files changed

Lines changed: 16 additions & 35 deletions

File tree

server/src/language-service/diagnosticsProvider.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {
3030
SepticObjectInfo,
3131
fromCalcIndexToParamIndex,
3232
SepticCalcParameterInfo,
33-
VALUE,
3433
getCalcParamIndexInfo,
3534
getIndexOfParam,
3635
getValueOfAlgExpr,
@@ -567,7 +566,7 @@ function validateParamType(
567566
refProvider: SepticReferenceProvider,
568567
algPositionTransformer: AlgPositionTransformer
569568
): Diagnostic[] {
570-
if (types[0] === VALUE) {
569+
if (types[0] === "value") {
571570
return validateValueParamType(expr, refProvider, algPositionTransformer);
572571
}
573572
return validateObjectParamType(expr, types, refProvider, algPositionTransformer);
@@ -594,7 +593,7 @@ function validateObjectParamType(
594593
exprLiteral.value.split(".")[0]
595594
);
596595
for (const obj of objects) {
597-
if (obj.isType(...types)) {
596+
if (types.includes(obj.type.toLowerCase())) {
598597
return [];
599598
}
600599
}

server/src/septic/septicMetaInfo.ts

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -249,31 +249,13 @@ function updateDatatypeParams(params: SepticCalcParameterInfo[] | undefined) {
249249
description: param.description,
250250
name: param.name,
251251
direction: param.direction,
252-
datatype: param.datatype.map((type) => {
253-
return datatypeToObjectName(type);
254-
}),
252+
datatype: param.datatype,
255253
};
256254
});
257255
}
258256

259-
const objectNameMap = new Map<string, string>([
260-
["mvr", "Mvr"],
261-
["cvr", "Cvr"],
262-
["dvr", "Dvr"],
263-
["evr", "Evr"],
264-
["tvr", "Tvr"],
265-
["smpcappl", "SmpcAppl"],
266-
]);
267-
268257
export const VALUE = "Value";
269258

270-
function datatypeToObjectName(type: string) {
271-
const objectName = objectNameMap.get(type);
272-
if (!objectName) {
273-
return VALUE;
274-
}
275-
return objectName;
276-
}
277259

278260
function toSymbolKind(name: string) {
279261
const nameLower = name.toLowerCase();
@@ -356,19 +338,19 @@ class SepticObjectDocumentation implements ISepticObjectDocumentation {
356338
continue;
357339
} else {
358340
this.attributes.push({
359-
description: attr.description,
360-
dataType: attr.dataType,
361-
enums: attr.enums,
362-
list: attr.list,
363-
name: attr.name,
364-
tags: attr.tags,
365-
calc: attr.calc,
366-
basename: attr.name,
367-
noCnfg: false,
368-
default: attr.default,
369-
snippet: attr.snippet,
370-
noSnippet: attr.noSnippet,
371-
});
341+
description: attr.description,
342+
dataType: attr.dataType,
343+
enums: attr.enums,
344+
list: attr.list,
345+
name: attr.name,
346+
tags: attr.tags,
347+
calc: attr.calc,
348+
basename: attr.name,
349+
noCnfg: false,
350+
default: attr.default,
351+
snippet: attr.snippet,
352+
noSnippet: attr.noSnippet,
353+
});
372354
}
373355
;
374356
}

0 commit comments

Comments
 (0)