Skip to content

view: tidy the structure and types of the Rust view model #2082

Closed

Description

@shunichironomura

Warning

This content was written by an AI agent and must be verified by a human developer. After human verification, this alert may be removed.

Found in the review of #2057, which adds the experimental view. Paths refer to #2059's head.

Summary

Structure and types of the Rust side of the view:

  • Project root. The CLI (view_root_dir), the language server and the Wasm engine each find the project root again, with different fallbacks. Keep the root the loader already knows in LoadedProject, and drop the root_dir parameter of project_view.
  • root_source_dir turns the typed PackageSourceDirectory into a PathBuf, and is set by an assignment after from_parts.
  • Module names. Scope::module_name in crates/graphcal-project/src/view_model/project.rs guesses a module's path by skipping as many segments as the source directory has components, then joins them with .. The loader or ModulePaths should record the module path of every file, the root included.
  • SourceFiles::name_of returns "" as a sentinel for an unknown file.
  • Node kind. ViewNodeKind::External mixes what a node is with where it comes from. Split it into kind and origin: Local | Imported | Included, with the model contract changes.
  • EvalResult.identities in graphcal-eval is a map kept in step with entries. Store the identity in each entry instead.
  • Wasm outcome. EvaluateViewOutcome::Unavailable { message } covers "prepared without the view", "projection failed" and "a value could not be displayed" with one string. view: fix the must-fix findings of the #2057 review #2059 made the prepared state an enum (PreparedView); the outcome should follow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorrustwebviewThe experimental view (web/view, graphcal view, graphcal/viewModel)

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions