jw3 / example-daffodil-vscode

A VS Code extension for DFDL with Daffodil
Apache License 2.0
2 stars 3 forks source link

Support Daffodil CLI command evaluation #46

Closed jw3 closed 3 years ago

jw3 commented 3 years ago

The extension should support sending Daffodil CLI commands directly to the backend for evaluation.

This provides a bridge functionality for things we will not yet support by may be needed by schema developers.

jw3 commented 3 years ago

@arosien I send info data infoset and the terminal output seems to respond to it, but looks like a variables response...

2021-08-09 22:14:28,660 [io-compute-6] INFO  d.d.d.DAPSession - R> #24 evaluate {"expression":"info data infoset","frameId":8,"context":"repl"} 
2021-08-09 22:14:28,678 [io-compute-1] INFO  d.d.d.DAPSession - <R #24 evaluate failure null 
2021-08-09 22:14:28,685 [io-compute-4] INFO  d.d.d.DAPSession - R> #25 scopes {"frameId":8} 
2021-08-09 22:14:28,687 [io-compute-1] INFO  d.d.d.DAPSession - <R #25 scopes success {"scopes":[{"name":"Parse","variablesReference":43,"expensive":false},{"name":"Schema","variablesReference":44,"expensive":false},{"name":"Data","variablesReference":45,"expensive":false}]} 
2021-08-09 22:14:28,692 [io-compute-6] INFO  d.d.d.DAPSession - R> #26 variables {"variablesReference":43} 
2021-08-09 22:14:28,693 [io-compute-2] INFO  d.d.d.DAPSession - <R #26 variables success {"variables":[{"name":"childIndex","value":"5","variablesReference":0,"namedVariables":0,"indexedVariables":0},{"name":"delimiters","value":"","variablesReference":48,"namedVariables":0,"indexedVariables":0},{"name":"groupIndex","value":"2","variablesReference":0,"namedVariables":0,"indexedVariables":0},{"name":"hidden","value":"false","type":"bool","variablesReference":0,"namedVariables":0,"indexedVariables":0},{"name":"occursIndex","value":"2","variablesReference":0,"namedVariables":0,"indexedVariables":0},{"name":"points of uncertainty","value":"","variablesReference":47,"namedVariables":0,"indexedVariables":0}]} 
arosien commented 3 years ago

The <R #24 evaluate failure null is the response, the other request/response output is for unrelated stuff.

Currently the implementation of the evaluate DAP request looks for variables whose name exactly matches the value of the expression field. It doesn't supply the infoset.

It could supply the infoset if we change the syntax of the expression value to be similar to the legacy "interactive" debugger, where there is the (separate from variables) infoset command.

Variables in the interactive debugger have a different sub-command provided:

Usage: v[ariables] [<name>...]

Display the in-scope state of variables matching <name>'s. If no
names are given, displays the in-scope state of all variables.

The backend tracking of evaluating DFDL expressions is tracked at https://github.com/jw3/example-daffodil-debug/issues/41. Hopefully supporting arbitrary DFDL expressions subsumes an evaluate expression that provides only a variable.

jw3 commented 3 years ago

Currently the implementation of the evaluate DAP request looks for variables whose name exactly matches the value of the expression field.

Ah ok. I took a quick look over in the backend code and figured that's what it said too.

It doesn't supply the infoset.

The point of running the infoset was just to use a command that had output that would be easy to pick out in the debug console.

I was just trying to get a handle on what was provided there.

Will think about this issue some more and comment further.

jw3 commented 3 years ago

This is a proof of concept, using variables, for the MVP.

Additional capability can be added when new requirements are identified. The right approach for this is on an as-needed basis, not a wholesale implementation of everything possible.