Replies: 2 comments
-
Standard distribution of luau-analyze currently doesn't register anything related to vectors; the only setup atm is the builtin types/libraries: https://github.com/Roblox/luau/blob/master/CLI/Analyze.cpp#L260 Vectors are supported by the VM but aren't exposed by default, as such analyze doesn't register them by default (the VM support is merely for the type and basic arithmetic operations, but the types can often be augmented by extra methods/properties beyond XYZ, and the construction function can vary for different embedders so there's not a single useful definition we can expose). In an ideal world, you'd be able to simply specify the definition of your Vector3 type via a type definition file, but we aren't there yet. This is tracked in #418 (we have a temporary syntax for definition files but it's not finalized yet, and the files themselves aren't exposed fully). So right now you'd need to have a custom build of luau-analyze unfortunately, that includes the necessary definitions - similar to the snippet you quote, but also you'd need to define the "vector" global. |
Beta Was this translation helpful? Give feedback.
-
You might want to look at how @JohnnyMorganz implimented diagnostics for luau with the luau LSP: https://github.com/JohnnyMorganz/luau-lsp |
Beta Was this translation helpful? Give feedback.
-
Hi! I'm using Luau as an embedded scripting language for my project, and I'm trying to integrate the diagnostics from
luau-analyze
.Right now I'm stuck at trying to annotate variables using the native vector type. I have checked this discussion #385 but I'm having trouble understanding the answer given.
As far as I understand, that answer points at
Vector3
being registered as a type https://github.com/Roblox/luau/blob/master/fuzz/proto.cpp#L101-L115 here. This seems to be something that is happening in the standard distribution ofluau-analyze
, but annotating something like this won't work:Is there something I need to do for a standard binary of
luau-analyze
to understand native vectors? Or is this something that can only be achieved by building my own version of the analyzer?Beta Was this translation helpful? Give feedback.
All reactions