-
Notifications
You must be signed in to change notification settings - Fork 136
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 Lua bindings for building stack graphs #351
Draft
dcreager
wants to merge
10
commits into
main
Choose a base branch
from
lua-bindings
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Commits on Nov 20, 2023
-
Add Lua bindings for building stack graphs
We're using the `mlua` crate, since it seems most actively maintained and performant.
Configuration menu - View commit details
-
Copy full SHA for f96b8d6 - Browse repository at this point
Copy the full SHA f96b8d6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 91e44c6 - Browse repository at this point
Copy the full SHA 91e44c6View commit details -
Configuration menu - View commit details
-
Copy full SHA for b450a87 - Browse repository at this point
Copy the full SHA b450a87View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9ae6a87 - Browse repository at this point
Copy the full SHA 9ae6a87View commit details
Commits on Nov 21, 2023
-
You can't do anything with them other than call `tostring` on them, but even that is helpful in test cases!
Configuration menu - View commit details
-
Copy full SHA for 9a30497 - Browse repository at this point
Copy the full SHA 9a30497View commit details -
Configuration menu - View commit details
-
Copy full SHA for ea2e203 - Browse repository at this point
Copy the full SHA ea2e203View commit details -
Configuration menu - View commit details
-
Copy full SHA for b82ec8b - Browse repository at this point
Copy the full SHA b82ec8bView commit details -
Add Lua+tree-sitter stack graph builder
This is the spackle that parses a source file using tree-sitter, and calls a Lua function with it and an empty stack graph. The Lua function can do whatever it wants to walk the parse tree and add nodes and edges to the graph.
Configuration menu - View commit details
-
Copy full SHA for ff1e99d - Browse repository at this point
Copy the full SHA ff1e99dView commit details -
Add Lua bindings for
SpanCalculator
This one is fun, because `SpanCalculator` holds a reference to the file's source code, while the `mlua::UserData` works best for Rust types that are 'static. To get around this, we make sure to only ever create `SpanCalculator` wrappers for source data that is owned by the Lua interpreter, and add that source data as a user value of the Lua wrapper that we create. That should cause Lua's garbage collector to ensure that the source code outlives the `SpanCalculator`, making it safe for us to transmute the source reference to a 'static lifetime.
Configuration menu - View commit details
-
Copy full SHA for 0c639ff - Browse repository at this point
Copy the full SHA 0c639ffView commit details -
Calculate spans in Lua stack graph scripts
The stack graph builder now imports the `lsp-position` module before handing control to your Lua script. That lets you create a span calculator, and use that to fill in spans and definiens for the stack graph nodes that you create.
Configuration menu - View commit details
-
Copy full SHA for 39ee686 - Browse repository at this point
Copy the full SHA 39ee686View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.