Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-webide-representation doesn't work for parse instances that were not invoked before #128

Open
generalmimon opened this issue Jun 20, 2021 · 0 comments
Labels

Comments

@generalmimon
Copy link
Member

generalmimon commented Jun 20, 2021

Try this example in the Web IDE:

meta:
  id: webide_repre_inst_pos
seq:
  - id: a
    type: foo
types:
  foo:
    -webide-representation: '{inst_pos:dec}'
    instances:
      inst:
        value: inst_pos
      inst_pos:
        pos: 0
        type: s1

After expanding a, the result looks like this:

Part of the Web IDE screenshot showing the object tree (before adding -webide-parse-mode)

Clearly, the -webide-representation key does not work - it should be a [Foo]: 82 instead of just a [Foo]. For value instances, it does work - try switching to the value instance inst by changing -webide-representation: '{inst_pos:dec}' in the above snippet.

However, I noticed that the instPos is collapsed in the object tree, which means that it uses lazy evaluation and it has not yet been evaluated. So I tried to change -webide-parse-mode to eager - that tells the Web IDE not to wait for user interaction before invoking the instance but invoke it right away:

       inst_pos:
         pos: 0
         type: s1
+        -webide-parse-mode: eager

And indeed, the problem gets fixed as soon as the setting is added:

Part of the Web IDE screenshot showing the object tree (after adding -webide-parse-mode)

So we need to ensure that fields referenced in -webide-representation are invoked if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant