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

Add support for including GDScript symbols from source #61

Open
NathanLovato opened this issue Oct 4, 2024 · 0 comments · May be fixed by #60
Open

Add support for including GDScript symbols from source #61

NathanLovato opened this issue Oct 4, 2024 · 0 comments · May be fixed by #60
Labels
enhancement New feature or request

Comments

@NathanLovato
Copy link
Contributor

NathanLovato commented Oct 4, 2024

This task is about adding a symbol attribute to include components and quickly parsing and extracting the content corresponding to specific symbols in GDScript files. As we make more advanced learning material, we need to include entire functions or classes more and more. This attribute will help us quickly extract the relevant content from the source files.

It should work like this:

  • A minimal parser parses definitions and stores the corresponding content in tokens.
  • When we encounter a symbol attribute in the MDX file, we parse the corresponding GDScript file, check if that symbol exists, and include it in the output.

Currently, we can include anchors, which use comment pairs in the source files. We will use both attributes, but now only one of the two attributes should be used in a given Include component.

Requirements:

  • Parse symbol attributes in Include components.
  • Error if both symbol and anchor attributes are used in the same Include component.
  • Parse and cache a parsed GDScript as a token tree when we encounter a new file.
    • Create a table of symbols and their corresponding content.
  • Update documentation for the Include component.

Stretch goals:

  • Writing symbol.definition or symbol.def in the Include component should include the definition only. E.g. <Include file="my_script.gd" symbol="_ready.definition" /> should include the _ready() function definition only. This is only valid for symbols whose definition is separate from their body.
@NathanLovato NathanLovato added the enhancement New feature or request label Oct 4, 2024
@NathanLovato NathanLovato linked a pull request Oct 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant