Skip to content

Commit 9ed9c26

Browse files
committedFeb 7, 2025
feat(inline-hints): show as int257 for Int fields
Fixes #52
1 parent 927582d commit 9ed9c26

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed
 

‎server/src/inlays/collect.ts

+19-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {RecursiveVisitor} from "@server/psi/visitor"
33
import {File} from "@server/psi/File"
44
import {TypeInferer} from "@server/TypeInferer"
55
import {Reference} from "@server/psi/Reference"
6-
import {Fun} from "@server/psi/Decls"
6+
import {Field, Fun} from "@server/psi/Decls"
77
import {CallLike, Expression, VarDeclaration} from "@server/psi/Node"
88
import {MapTy} from "@server/types/BaseTy"
99
import {findInstruction} from "@server/completion/data/types"
@@ -49,6 +49,24 @@ export function collect(
4949
return true
5050
}
5151

52+
if (type === "field" || type === "storage_variable") {
53+
const field = new Field(n, file)
54+
const typeNode = field.typeNode()
55+
if (!typeNode) return true
56+
const type = typeNode.type()
57+
58+
if (type?.name() === "Int" && field.tlbType() === null) {
59+
result.push({
60+
kind: InlayHintKind.Type,
61+
label: ` as int257`,
62+
position: {
63+
line: typeNode.node.endPosition.row,
64+
character: typeNode.node.endPosition.column,
65+
},
66+
})
67+
}
68+
}
69+
5270
if (type === "foreach_statement" && hints.types) {
5371
const expr = n.childForFieldName("map")
5472
if (!expr) return true

0 commit comments

Comments
 (0)