sylver-dev / sylver-cli

GNU Affero General Public License v3.0
92 stars 3 forks source link

[REQUEST]: More evaluation in REPL #4

Open jvacek opened 2 months ago

jvacek commented 2 months ago

Is your feature request related to a problem? Please describe. When making queries, it's a bit hard to figure out what is accessible how. As each Metalanguage can do this differently, it would be nice to avoid trips to the docs.

Describe the solution you'd like It would be nice to be able to do some of the following commands in the REPL console:

:print $123.parent # print `$122 [ParentKind path_to_file.xyz:12:3-12:45]`
:print_ast $123.parent # print ast of parent

:print e.children.length # print "4"
:print e.children.length > 2 # print "True"

It could be also nice to have something for discoverability, which could show on the CLI what sort of attributes are accessible for querying.

:print_desc $123 
# Prints the value itself and then the results for:...
# - `kind`
# - `text`
# - `length`
# - `parent`, `children`, `next`/`previous_sibling`
# - Any other fields on the node

Describe alternatives you've considered N/A

Additional context Add any other context or screenshots about the feature request here.

geoffreycopin commented 2 months ago

Thanks for your request!

Release 0.3.4 is out today with the following improvements on the REPL:

An inspection command to list the fields available on a given node will be available shortly.