This PR improves UX regarding project loading for Scarb projects (so assume the rest of the description concerns only these). Logic regarding cairo_project.toml-based projects remains unchanged as there is no such an UX issue associated with them.
Before this PR scarb metadata was called on every didOpen notification. Moreover it was called once for each currently open file when:
cairo/reloadWorkspace command was executed
didChangeWatchedFiles informing about Scarb.toml change was received
This PR changes it so we keep paths to Scarb.tomls that correspond to members of Scarb's workspaces we already analysed/loaded.
When a didOpen notification is received, we check if the path to Scarb.toml for the opened file is in paths. If it is, we skip the scarb metadata execution, else we do as before, but we add paths of all workspace members' manifests to paths.
Keep in mind it also improves UX for the two remaining cases: we clear paths and load projects for all currently open files, but loading a project for one file from workspace A will prevent redundant scarb metadata calls for all the other open files from workspace A (via mechanism described above).
This PR improves UX regarding project loading for Scarb projects (so assume the rest of the description concerns only these). Logic regarding
cairo_project.toml
-based projects remains unchanged as there is no such an UX issue associated with them.Before this PR
scarb metadata
was called on everydidOpen
notification. Moreover it was called once for each currently open file when:cairo/reloadWorkspace
command was executeddidChangeWatchedFiles
informing aboutScarb.toml
change was receivedThis PR changes it so we keep paths to
Scarb.toml
s that correspond to members of Scarb's workspaces we already analysed/loaded.When a
didOpen
notification is received, we check if the path toScarb.toml
for the opened file is in paths. If it is, we skip thescarb metadata
execution, else we do as before, but we add paths of all workspace members' manifests to paths.Keep in mind it also improves UX for the two remaining cases: we clear paths and load projects for all currently open files, but loading a project for one file from workspace A will prevent redundant
scarb metadata
calls for all the other open files from workspace A (via mechanism described above).