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

core: Add connection graph and incremental reference resolution #269

Merged
merged 33 commits into from
Nov 29, 2023

Conversation

artempyanykh
Copy link
Owner

@artempyanykh artempyanykh commented Nov 26, 2023

This PR on a high-level does 3 things:

  1. In addition to Cst, it introduces Ast and Sym; level of abstraction goes as Cst -> Ast -> Sym; each level having less superfluous details. Right now mostly Cst and Sym are used, with Ast akwardly sitting in the middle, but future work may uncover more use for Ast.
  2. Introduce Conn - a connection graph between document symbols that can be incrementally updated whenever symbols change. The crucial parts are incremental updates and that when symbols are not changing (e.g. when just typing text rather than adding links/sections) there's no need to recompute the graph.
  3. Refactor the Refs and Diag to use the connection graph rather than doing from scratch recomputing on every keystroke.

TODO:

  • Add a flag to toggle incremental updating of the Conn graph.
  • Add a flag to toggle paranoid mode instead of a cmdline option.
  • Fix tests on windows (paths strike again 💀)
  • Add tests for tags

In later PRs:

  1. Use Conn graph to more granularly identify the "blast radius" of an edit for diagnostic recalculation (instead of recomputing for all docs in the folder).
  2. MORE REFACTORING!1!
  3. More explicit dependency tracking between symbols in the Conn graph.

This only adds the graph and tweaks Folder.withConfig to avoid full rebuild of the folder (and hence
the conn graph) when the config is unchanged.

Next up is figuring out how to use conn graph for diagnostics and reference queries.
At this point, incremental Conn seems to work (running for a while with paranoid mode on).
It still needs more testing and polish though.
One of the previous commits introduced a bug where the 'from-scratch' state was compared to the previous state rather than the incrementally updated state.
@artempyanykh artempyanykh merged commit f41eda4 into main Nov 29, 2023
3 checks passed
@artempyanykh artempyanykh deleted the cgraph branch November 29, 2023 09:18
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.

1 participant