Skip to content

fix: improve data container context hints and LSP completion#184

Open
engalar wants to merge 1 commit intomendixlabs:mainfrom
engalar:fix/pr168-review-feedback
Open

fix: improve data container context hints and LSP completion#184
engalar wants to merge 1 commit intomendixlabs:mainfrom
engalar:fix/pr168-review-feedback

Conversation

@engalar
Copy link
Copy Markdown
Contributor

@engalar engalar commented Apr 10, 2026

Summary

  • Fix extractPageParamNames to use $Name: Type declaration pattern matching instead of full-document $Name scanning, eliminating false positives from $currentObject, body $var references, and comment lines
  • Propagate EntityContext through nested widget tree so data containers without own DataSource inherit parent context (fixes missing context comments for nested DataView via association)
  • Add upward scope scanning in LSP $ completion to show $currentObject with actual entity type and $widgetName selection variables for list containers

Addresses review comments from #168.

Test plan

  • extractPageParamNames — 7 test cases including false positive rejection
  • scanEnclosingDataContainer — 4 test cases (DATAVIEW, DATAGRID, no container, nested)
  • variableCompletionItems — 2 test cases (basic, DataGrid with entity type + selection)
  • outputWidgetMDLV3 — 2 new inherited context tests (DataView, DataGrid column)
  • make build and make test pass

…abs#168 review)

Address 3 review comments from PR mendixlabs#168:

1. extractPageParamNames: switch from full-document $Name scanning to
   $Name: Type declaration pattern matching, eliminating false positives
   from $currentObject references, body $var usage, and comment lines.

2. EntityContext propagation: add parentEntityContext parameter to
   parseRawWidget() so nested containers without own DataSource inherit
   parent context. Propagate through all child-parsing functions.

3. LSP $ completion: add scanEnclosingDataContainer() that scans upward
   from cursor with brace matching to find nearest data container. Shows
   $currentObject with entity type and $widgetName selection variables.
@github-actions
Copy link
Copy Markdown

AI Code Review

Critical Issues

(None found)

Moderate Issues

(None found)

Minor Issues

(None found)

What Looks Good

  • The fix for extractPageParamNames correctly implements the $Name: Type pattern matching to avoid false positives from $currentObject in comments, body variable references, and declaration vs usage confusion
  • Entity context propagation properly handles nested widget trees by passing inherited context through the parsing chain, fixing missing context comments for nested DataViews via associations
  • LSP completion enhancements use upward scope scanning with brace matching to accurately find enclosing data containers and provide context-aware variable suggestions ($currentObject with entity type and $widgetName for selection variables)
  • Test coverage is comprehensive with specific test cases for each improvement area, including false positive rejection and nested container scenarios
  • Changes are focused and cohesive, addressing related improvements to data container context handling without introducing unrelated modifications
  • No new MDL syntax is added, so full-stack consistency requirements (grammar→AST→visitor→executor→LSP→DESCRIBE) don't apply
  • Implementation follows existing code patterns and maintains backward compatibility

Recommendation

Approve the PR. The changes correctly address the identified issues with minimal risk, good test coverage, and adherence to project conventions. The improvements enhance both the accuracy of MDL parsing and the usefulness of LSP completion without violating any design principles.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant