public T4OutsideSolutionSourceFileManager(Lifetime lifetime, [NotNull] IProjectFileExtensions projectFileExtensions, [NotNull] PsiProjectFileTypeCoordinator psiProjectFileTypeCoordinator, [NotNull] DocumentManager documentManager, [NotNull] ISolution solution, [NotNull] IT4Environment t4Environment, [NotNull] IFileSystemTracker fileSystemTracker, [NotNull] PsiSourceFileWithLocationTracker psiSourceFileWithLocationTracker ) { ProjectFileExtensions = projectFileExtensions; PsiProjectFileTypeCoordinator = psiProjectFileTypeCoordinator; DocumentManager = documentManager; SourceFiles = new ConcurrentDictionary <FileSystemPath, IPsiSourceFile>(); lifetime.OnTermination(this); PsiModule = new PsiModuleOnFileSystemPaths( solution, "T4OutsideSolution", Guid.NewGuid().ToString(), t4Environment.TargetFrameworkId, fileSystemTracker, lifetime, psiSourceFileWithLocationTracker, false); }
public T4MiscFilesProjectPsiModuleProvider( Lifetime lifetime, [NotNull] IShellLocks shellLocks, [NotNull] ChangeManager changeManager, [NotNull] IT4Environment t4Environment, [NotNull] PsiProjectFileTypeCoordinator coordinator, [NotNull] IT4TemplateKindProvider templateDataManager ) => _t4PsiModuleProvider = new T4PsiModuleProvider(
public T4ReferenceExtractionManager( [NotNull] IT4AssemblyReferenceResolver assemblyReferenceResolver, [NotNull] IT4LowLevelReferenceExtractionManager lowLevelReferenceExtractionManager, [NotNull] IT4Environment environment ) { AssemblyReferenceResolver = assemblyReferenceResolver; LowLevelReferenceExtractionManager = lowLevelReferenceExtractionManager; Environment = environment; }
public T4ProjectPsiModuleProviderFilter( [NotNull] ChangeManager changeManager, [NotNull] IT4Environment t4Environment, [NotNull] IT4TemplateKindProvider templateDataManager ) { _changeManager = changeManager; _t4Environment = t4Environment; TemplateDataManager = templateDataManager; }
internal T4PsiModuleProvider( Lifetime lifetime, [NotNull] IShellLocks shellLocks, [NotNull] ChangeManager changeManager, [NotNull] IT4Environment t4Environment, [NotNull] IT4TemplateKindProvider templateDataManager ) { _lifetime = lifetime; _shellLocks = shellLocks; _changeManager = changeManager; _t4Environment = t4Environment; TemplateDataManager = templateDataManager; }
internal T4PsiModuleProvider( Lifetime lifetime, [NotNull] IShellLocks shellLocks, [NotNull] ChangeManager changeManager, [NotNull] IT4Environment t4Environment, [NotNull] IT4TemplateKindProvider templateDataManager, [CanBeNull] TargetFrameworkId primaryTargetFrameworkId = null ) { _lifetime = lifetime; _shellLocks = shellLocks; _changeManager = changeManager; _t4Environment = t4Environment; TemplateDataManager = templateDataManager; PrimaryTargetFrameworkId = primaryTargetFrameworkId; }
public T4FilePsiModule( Lifetime lifetime, [NotNull] IProjectFile projectFile, [NotNull] ChangeManager changeManager, [NotNull] IShellLocks shellLocks, [NotNull] IT4Environment t4Environment ) { Lifetime = lifetime; lifetime.AddDispose(this); ProjectFile = projectFile; Solution = ProjectFile.GetSolution(); PsiModules = Solution.GetComponent <IPsiModules>(); PsiServices = Solution.GetComponent <IPsiServices>(); ChangeManager = changeManager; ShellLocks = shellLocks; ChangeProvider = new FakeChangeProvider(); TargetFrameworkId = ProjectFile.SelectTargetFrameworkId(t4Environment); Project = ProjectFile.GetProject().NotNull(); var resolveContext = Project.IsMiscFilesProject() ? UniversalModuleReferenceContext.Instance : this.GetResolveContextEx(ProjectFile); AssemblyReferenceManager = new T4AssemblyReferenceManager( Solution.GetComponent <IAssemblyFactory>(), SourceFile, ProjectFile, resolveContext, shellLocks ); ProjectReferenceManager = new T4ProjectReferenceManager(ProjectFile, Solution); changeManager.RegisterChangeProvider(lifetime, ChangeProvider); changeManager.AddDependency(lifetime, PsiModules, ChangeProvider); var documentManager = Solution.GetComponent <DocumentManager>(); SourceFile = CreateSourceFile(ProjectFile, documentManager); Solution.GetComponent <T4DeclaredAssembliesManager>().FileDataChanged.Advise(lifetime, OnFileDataChanged); ChangeManager.ExecuteAfterChange(() => { AssemblyReferenceManager.AddBaseReferences(); NotifyModuleChange(); }); }
public T4ProjectPsiModuleHandler( Lifetime lifetime, [NotNull] IProjectPsiModuleHandler handler, [NotNull] ChangeManager changeManager, [NotNull] IT4Environment t4Environment, [NotNull] IProject project, [NotNull] IT4TemplateKindProvider templateKindProvider ) : base(handler) { TemplateKindProvider = templateKindProvider; _t4PsiModuleProvider = new T4PsiModuleProvider( lifetime, project.Locks, changeManager, t4Environment, templateKindProvider ); }
public static TargetFrameworkId SelectTargetFrameworkId( [NotNull] this IProjectFile file, [NotNull] IT4Environment t4Environment ) { var project = file.GetProject(); if (project?.IsMiscFilesProject() != false) { return(UniversalModuleReferenceContext.Instance.TargetFramework); } var containingTargetFrameworkId = project.GetResolveContext().TargetFramework; if (containingTargetFrameworkId.IsNetFramework) { return(containingTargetFrameworkId); } return(t4Environment.TargetFrameworkId); }
public T4FilePsiModule( Lifetime lifetime, [NotNull] IProjectFile projectFile, [NotNull] ChangeManager changeManager, [NotNull] IShellLocks shellLocks, [NotNull] IT4Environment t4Environment, [CanBeNull] TargetFrameworkId primaryTargetFrameworkId ) { Lifetime = lifetime; lifetime.AddDispose(this); ProjectFile = projectFile; Solution = ProjectFile.GetSolution(); PsiModules = Solution.GetComponent <IPsiModules>(); PsiServices = Solution.GetComponent <IPsiServices>(); ChangeManager = changeManager; ShellLocks = shellLocks; ChangeProvider = new T4WriteOnlyChangeProvider(); changeManager.RegisterChangeProvider(lifetime, ChangeProvider); changeManager.AddDependency(lifetime, PsiModules, ChangeProvider); TargetFrameworkId = t4Environment.SelectTargetFrameworkId(primaryTargetFrameworkId, projectFile); Project = ProjectFile.GetProject().NotNull(); var resolveContext = Project.IsMiscFilesProject() ? UniversalModuleReferenceContext.Instance : this.GetResolveContextEx(ProjectFile); Assertion.Assert(resolveContext.TargetFramework == TargetFrameworkId, "Failed to select TargetFrameworkId"); var documentManager = Solution.GetComponent <DocumentManager>(); SourceFile = CreateSourceFile(ProjectFile, documentManager, resolveContext); AssemblyReferenceManager = new T4AssemblyReferenceManager( Solution.GetComponent <IAssemblyFactory>(), SourceFile, ProjectFile, resolveContext, shellLocks ); Solution.GetComponent <T4DeclaredAssembliesManager>().FileDataChanged.Advise(lifetime, OnFileDataChanged); PersistentId = BuildPersistentId(primaryTargetFrameworkId); OriginalTargetFrameworkId = primaryTargetFrameworkId; }
public static TargetFrameworkId SelectTargetFrameworkId( [NotNull] this IT4Environment t4Environment, [CanBeNull] TargetFrameworkId candidate, [NotNull] IProjectFile file ) { var project = file.GetProject(); if (project?.IsMiscFilesProject() != false) { return(UniversalModuleReferenceContext.Instance.TargetFramework); } // Generated C# code contains references to CodeDom, and thus can only be compiled by classical .NET // TODO: generate code without CodeDom in .NET Core projects if (candidate != null && candidate.IsNetFramework) { return(candidate); } return(t4Environment.TargetFrameworkId); }
public T4IncludeResolver([NotNull] IT4PsiFileSelector selector, [NotNull] IT4Environment environment) { Selector = selector; Environment = environment; }
public T4CSharpLanguageLevelProvider( [NotNull] IT4Environment t4Environment, [NotNull] ILanguageLevelProjectProperty <CSharpLanguageLevel, CSharpLanguageVersion> projectProperty, [CanBeNull] ILanguageLevelOverrider <CSharpLanguageLevel> languageLevelOverrider = null, [CanBeNull] Lazy <ILanguageVersionModifier <CSharpLanguageVersion> > languageVersionModifier = null ) : base(projectProperty, languageLevelOverrider, languageVersionModifier) => _t4Environment = t4Environment;
/// <summary>Initializes a new instance of the <see cref="T4ProjectFileLanguageService" /> class.</summary> /// <param name="t4ProjectFileType">Type of the T4 project file.</param> /// <param name="t4Environment">The host environment.</param> public T4ProjectFileLanguageService([NotNull] T4ProjectFileType t4ProjectFileType, [NotNull] IT4Environment t4Environment) : base(t4ProjectFileType) => _t4Environment = t4Environment;