Repository navigation
Make variable card binding in the scripting terminal visible and safer - #83
Merged
Merged
Conversation
Placing the cursor on a keyword such as "const" or "function" selected it as a member, which silently rebound the card in the terminal to a member that can never exist. Keywords are now rejected with a dedicated error, and the card keeps its previous binding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
The member a card is bound to was only visible in the card's tooltip, and the member it would be bound to was not visible at all. A label below the editor now shows either. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
Coverage Report for CI Build 39114757050Coverage increased (+1.3%) to 48.646%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions180 previously-covered lines in 6 files lost coverage. Coverage Stats
💛 - Coveralls |
The binding label looked like the inventory label below it, while it is about the card slot. It is now right-aligned next to the card status icon, with the member highlighted, and the not yet bound case shown in italics. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
The player inventory is clear without its label, and dropping it frees its row for the card binding label, which is now centered next to the card slot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
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.
Independent of the terminal UX stack (#77 to #82), based directly on
master-1.21-lts.Changes
Don't bind variable cards to keywords. The card in the terminal is rebound to whatever word is under the cursor. Clicking on
constorfunctionrebound the card to a member that can never exist, while still showing the green check. Keywords are now rejected with a dedicated error (""const" is a keyword, so it can not be bound..."), and the card keeps its previous binding.ILanguageHandler.getReservedWords()(empty by default), implemented for JavaScript.let,static,yieldandawaitare valid names in our scripts, so they stay bindable. A unit test checks the list against GraalJS itself (this caught those words in my first version of the list).testTerminalScriptingKeywordDoesNotRebindCard: bind toabc, selectconst(card staysabc), selectdef(card becomesdef). Verified to fail without the fix.Show which member the variable card is bound to. The bound member was only visible in the card tooltip, and the member a card would get was not visible at all. A label shows
Bound to: <member>when a card is inserted, orBinds to: <member>when the slot is empty and a valid member is selected.Set the card binding label apart from the inventory label. In the first version, the label was drawn left-aligned right above "Inventory", in the same style, so it read like part of the inventory heading. It is now right-aligned against the card status icon and slot, with the member name in blue. The not-yet-bound
Binds to:case is lighter and italic. Long member names are cut off with…; the card tooltip still shows the full name.Drop the inventory label in the scripting terminal. The player inventory is clear without its label. Dropping it frees its row for the binding label, which is now vertically centered on the card slot.
Validation
double, clickingconstchanged it toconst.double(also checked on the server side copy of the card), clickingoffsetrebinds tooffset../gradlew buildand./gradlew runGameTestServer(23 tests) pass.Known limitation
Clicking a function parameter or local variable (for example
xinfunction double(x)) still rebinds the card, since that is a valid name. The label at least makes this visible immediately.🤖 Generated with Claude Code
https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9