fix: don't flag Vide event handlers as unknown props - #5
Open
WaleedAmer wants to merge 1 commit into
Open
Conversation
Vide passes events as plain table keys (`Activated = function() … end`, `MouseButton1Down = …`). The completion provider already merges `flattenClassEvents` into the prop list for frameworks with `eventsAsProps`, but the unknown-prop diagnostic seeded its known set from `flattenClassProps` alone, so every event handler on a host class was warned about as `Unknown property`. Mirror the completion gate in the diagnostic: when the matched alias belongs to an `eventsAsProps` framework, union the class's events into the known set. React/Roact/Fusion spell events as computed keys, which the entry scanner never yields, so they are unaffected. Closes ericplane#4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4.
Vide passes events as plain table keys (
Activated = function() … end,MouseButton1Down = …).completion.tsalready mergesflattenClassEventsinto the prop list when the alias's framework haseventsAsProps, but the unknown-prop diagnostic indiagnostics.tsseeded itsknownset fromflattenClassPropsalone, so every Vide event handler on a host class was warned about asUnknown property.This mirrors the completion gate in the diagnostic: when
findFrameworkForAlias(call.alias)?.eventsAsPropsis true, union the class's events intoknown. React/Roact/Fusion spell events as computed keys, which the entry scanner never yields, so they're unaffected. Direct instance calls (TextButton({ … })) never reach this block sinceisStringLiteralNameis false for them.Verified with
npm run compile+npm run lint(no new warnings on the touched lines) and by installing the packaged.vsixover a Vide project —Activated/MouseEnter/MouseLeave/MouseButton1Down/MouseButton1Upon acreate "TextButton" { … }no longer warn, while a genuine typo still gets the did-you-mean.🤖 Generated with Claude Code