Skip to content

Highlight Current Node #13

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

Merged
merged 86 commits into from
Sep 26, 2024
Merged

Highlight Current Node #13

merged 86 commits into from
Sep 26, 2024

Conversation

tmr232
Copy link
Owner

@tmr232 tmr232 commented Sep 26, 2024

Highlight the CFG node matching the current cursor position in the code.

Closes #3

- Need to connect the click to the goto
- Need to get index instead of line-number.
  Alternatively, we can convert in the graph itself.
We should probably get more data out of the graph, and play with what makes sense for people.
Also, we should add handling for clusters, probably with selection in this case.

This is related to #2.
We map the code positions to nodes, and can later find the right node.
Sadly, I can't wrap my head around the codemirror docs yet to make it interactive,
so it is only via the browser console.
But there are some significant issues.
- Only implemented for Python
- code->graph requires that every line of code is mapped to the nodes
- nodes only map to line number, they should map to the actual text if possible.
# Conflicts:
#	src/control-flow/cfg-python.ts
#	src/test/__snapshots__/commentTest.test.ts.snap
This is important for debugging!

To enable it, set the `segmentation` URL param in the demo
Editing the code now updates the graph highlighting as expected
While CSS is the way to go in the future, this is a simpler solution for now.
It also makes it easier to maintain alongside the extension itself.
This was not ready, so it's removed from this PR.
They very well belong there, and it makes reading the code easier.
@tmr232 tmr232 marked this pull request as ready for review September 26, 2024 15:35
@tmr232 tmr232 merged commit 1a3cad8 into main Sep 26, 2024
3 checks passed
@tmr232 tmr232 deleted the extension-highlight-nodes branch October 6, 2024 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Highlight current node in graph
1 participant