Repository navigation
Fix 3267: only add project if needed - #3270
Conversation
| if not (workspace.ProjectTracker.ContainsProject(project)) then | ||
| workspace.ProjectTracker.AddProject(project) | ||
|
|
||
| for referencedSite in ProjectSitesAndFiles.GetReferencedProjectSites (site, this.SystemServiceProvider) do |
There was a problem hiding this comment.
For perf, I would suggest adding the reference before telling the workspace about the project. That would avoid sending a bunch of ProjectChanged workspace notifications that will cancel and kick off new work.
There was a problem hiding this comment.
@Pilchie Currently we do it in this order:
let project = projectContextFactory.CreateProjectContext(...)
let referencedProjectId1 = workspace.ProjectTracker.GetOrCreateProjectIdForPath(...)
project.AddProjectReference(ProjectReference referencedProjectId1)
let referencedProjectId2 = workspace.ProjectTracker.GetOrCreateProjectIdForPath(...)
project.AddProjectReference(ProjectReference referencedProjectId2)
workspace.ProjectTracker.AddProject(project)
... then setup referencedSite1 ....
... then setup referencedSite 2....
Is that right? Thanks
|
Tagging @jasonmalinowski for his opinion here too, but I think it would probably be most efficient if you can build things bottom up - projects that don't depend on anything first, etc. |
|
@Pilchie @jasonmalinowski OK, could you open a separate issue about that please (if you decide that setting up a referenced project after a referencing project is slower)? Right now the only simple way of coding that would hit non-termination if for some reason the project graph had a cycle. We'd need to track the graph in a different way, which is not something we should add to this stabilizing PR. This is ready, the last change was just cosmetic to avoid an extra call |
* only add project if needed * de-duplicate call * Update LanguageService.fs
Seems to fix #3267
The problem must be that the given project already exists in the workspace if there is a DAG dependency structure, and we should not be adding it twice.