private void AddFile([NotNull] IProjectFile projectFile, [NotNull] PsiModuleChangeBuilder changeBuilder) { ISolution solution = projectFile.GetSolution(); // creates a new T4PsiModule for the file var lifetimeDefinition = Lifetime.Define(_lifetime, T4FilePsiModule.Prefix + projectFile.Name); var psiModule = new T4FilePsiModule( lifetimeDefinition.Lifetime, projectFile, _changeManager, _shellLocks, _t4Environment, PrimaryTargetFrameworkId ); _modules[projectFile] = new ModuleWrapper(psiModule, lifetimeDefinition); psiModule.AddBaseReferences(); changeBuilder.AddModuleChange(psiModule, PsiModuleChange.ChangeType.Added); changeBuilder.AddFileChange(psiModule.SourceFile, PsiModuleChange.ChangeType.Added); // Invalidate files that had this specific files as an include, // and whose IPsiSourceFile was previously managed by T4OutsideSolutionSourceFileManager. // Those files will be reparsed with the new source file. var fileManager = solution.GetComponent <T4OutsideSolutionSourceFileManager>(); VirtualFileSystemPath location = projectFile.Location; if (fileManager.HasSourceFile(location)) { fileManager.DeleteSourceFile(location); } }
public ModuleWrapper([NotNull] T4FilePsiModule module, [NotNull] LifetimeDefinition lifetimeDefinition) { Module = module; LifetimeDefinition = lifetimeDefinition; }