Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T4LanguageService"/> class.
 /// </summary>
 /// <param name="t4Language">The T4 language.</param>
 /// <param name="directiveInfoManager">An instance of <see cref="DirectiveInfoManager"/>.</param>
 /// <param name="constantValueService">The constant value service.</param>
 /// <param name="t4Environment">An object describing the environment for T4 files.</param>
 public T4LanguageService([NotNull] T4Language t4Language, [NotNull] DirectiveInfoManager directiveInfoManager,
                          [NotNull] IConstantValueService constantValueService, [NotNull] T4Environment t4Environment)
     : base(t4Language, constantValueService)
 {
     _t4Environment        = t4Environment;
     _directiveInfoManager = directiveInfoManager;
 }
 public T4ProjectPsiModuleProviderFilter(
     [NotNull] ChangeManager changeManager,
     [NotNull] T4Environment t4Environment)
 {
     _changeManager = changeManager;
     _t4Environment = t4Environment;
 }
Esempio n. 3
0
		internal T4Parser([NotNull] T4Environment t4Environment, [NotNull] DirectiveInfoManager directiveInfoManager, [NotNull] ILexer lexer,
			[CanBeNull] IPsiSourceFile sourceFile) {
			_t4Environment = t4Environment;
			_directiveInfoManager = directiveInfoManager;
			_lexer = lexer;
			_sourceFile = sourceFile;
		}
Esempio n. 4
0
        internal T4PsiModule([NotNull] Lifetime lifetime, [NotNull] IPsiModules psiModules, [NotNull] DocumentManager documentManager,
                             [NotNull] ChangeManager changeManager, [NotNull] IAssemblyFactory assemblyFactory, [NotNull] IShellLocks shellLocks,
                             [NotNull] IProjectFile projectFile, [NotNull] T4FileDataCache fileDataCache, [NotNull] T4Environment t4Environment,
                             [NotNull] OutputAssemblies outputAssemblies)
        {
            _lifetime = lifetime;
            lifetime.AddAction(Dispose);

            _psiModules      = psiModules;
            _assemblyFactory = assemblyFactory;
            _changeManager   = changeManager;
            _shellLocks      = shellLocks;

            _projectFile = projectFile;
            IProject project = projectFile.GetProject();

            Assertion.AssertNotNull(project, "project != null");
            _project  = project;
            _solution = project.GetSolution();

            changeManager.RegisterChangeProvider(lifetime, this);
            changeManager.AddDependency(lifetime, psiModules, this);

            _t4Environment    = t4Environment;
            _outputAssemblies = outputAssemblies;
            _resolveProject   = new T4ResolveProject(lifetime, _solution, _shellLocks, t4Environment.PlatformID, project);

            _sourceFile = CreateSourceFile(projectFile, documentManager);

            _isValid = true;
            fileDataCache.FileDataChanged.Advise(lifetime, OnDataFileChanged);
            AddBaseReferences();
        }
Esempio n. 5
0
 public T4PsiModuleProvider([NotNull] Lifetime lifetime, [NotNull] IShellLocks shellLocks, [NotNull] ChangeManager changeManager, [NotNull] T4Environment t4Environment)
 {
     _lifetime = lifetime;
     _shellLocks = shellLocks;
     _changeManager = changeManager;
     _t4Environment = t4Environment;
 }
Esempio n. 6
0
        public TemplateDirectiveInfo([NotNull] T4Environment environment)
            : base("template")
        {
            bool isAtLeastVs11 = environment.VsVersion2.Major >= 11;

            _languageAttribute     = new EnumDirectiveAttributeInfo("language", DirectiveAttributeOptions.None, "C#", "VB");
            _hostSpecificAttribute = isAtLeastVs11
                                ? new EnumDirectiveAttributeInfo("hostspecific", DirectiveAttributeOptions.None, "true", "false", "trueFromBase")
                                : new BooleanDirectiveAttributeInfo("hostspecific", DirectiveAttributeOptions.None);
            _debugAttribute           = new BooleanDirectiveAttributeInfo("debug", DirectiveAttributeOptions.None);
            _inheritsAttribute        = new DirectiveAttributeInfo("inherits", DirectiveAttributeOptions.None);
            _cultureAttribute         = new CultureDirectiveAttributeInfo("culture", DirectiveAttributeOptions.None);
            _compilerOptionsAttribute = new DirectiveAttributeInfo("compilerOptions", DirectiveAttributeOptions.None);
            _linePragmasAttribute     = new BooleanDirectiveAttributeInfo("linePragmas", DirectiveAttributeOptions.None);
            _visibilityAttribute      = new EnumDirectiveAttributeInfo("visibility", DirectiveAttributeOptions.None, "public", "internal");

            var attributes = new List <DirectiveAttributeInfo>(8)
            {
                _languageAttribute,
                _hostSpecificAttribute,
                _debugAttribute,
                _inheritsAttribute,
                _cultureAttribute,
                _compilerOptionsAttribute
            };

            if (isAtLeastVs11)
            {
                attributes.Add(_linePragmasAttribute);
                attributes.Add(_visibilityAttribute);
            }

            _supportedAttributes = attributes.AsReadOnly();
        }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T4LanguageService"/> class.
 /// </summary>
 /// <param name="t4Language">The T4 language.</param>
 /// <param name="directiveInfoManager">An instance of <see cref="DirectiveInfoManager"/>.</param>
 /// <param name="constantValueService">The constant value service.</param>
 /// <param name="t4Environment">An object describing the environment for T4 files.</param>
 public T4LanguageService([NotNull] T4Language t4Language, [NotNull] DirectiveInfoManager directiveInfoManager,
     [NotNull] IConstantValueService constantValueService, [NotNull] T4Environment t4Environment)
     : base(t4Language, constantValueService)
 {
     _t4Environment = t4Environment;
     _directiveInfoManager = directiveInfoManager;
 }
Esempio n. 8
0
        public TemplateDirectiveInfo([NotNull] T4Environment environment)
            : base("template")
        {
            bool isAtLeastVs2012 = environment.VsVersion2.Major >= VsVersions.Vs2012;

            LanguageAttribute     = new EnumDirectiveAttributeInfo("language", DirectiveAttributeOptions.None, "C#", "VB");
            HostSpecificAttribute = isAtLeastVs2012
                                ? new EnumDirectiveAttributeInfo("hostspecific", DirectiveAttributeOptions.None, "true", "false", "trueFromBase")
                                : new BooleanDirectiveAttributeInfo("hostspecific", DirectiveAttributeOptions.None);
            DebugAttribute           = new BooleanDirectiveAttributeInfo("debug", DirectiveAttributeOptions.None);
            InheritsAttribute        = new DirectiveAttributeInfo("inherits", DirectiveAttributeOptions.None);
            CultureAttribute         = new CultureDirectiveAttributeInfo("culture", DirectiveAttributeOptions.None);
            CompilerOptionsAttribute = new DirectiveAttributeInfo("compilerOptions", DirectiveAttributeOptions.None);
            LinePragmasAttribute     = new BooleanDirectiveAttributeInfo("linePragmas", DirectiveAttributeOptions.None);
            VisibilityAttribute      = new EnumDirectiveAttributeInfo("visibility", DirectiveAttributeOptions.None, "public", "internal");

            var attributes = new List <DirectiveAttributeInfo>(8)
            {
                LanguageAttribute,
                HostSpecificAttribute,
                DebugAttribute,
                InheritsAttribute,
                CultureAttribute,
                CompilerOptionsAttribute
            };

            if (isAtLeastVs2012)
            {
                attributes.Add(LinePragmasAttribute);
                attributes.Add(VisibilityAttribute);
            }

            SupportedAttributes = attributes.ToImmutableArray();
        }
Esempio n. 9
0
 public T4MiscFilesProjectPsiModuleProvider(
     [NotNull] Lifetime lifetime,
     [NotNull] IShellLocks shellLocks,
     [NotNull] ChangeManager changeManager,
     [NotNull] T4Environment t4Environment)
 {
     _t4PsiModuleProvider = new T4PsiModuleProvider(lifetime, shellLocks, changeManager, t4Environment);
 }
Esempio n. 10
0
 public T4ProjectPsiModuleProviderFilter(
     [NotNull] ChangeManager changeManager,
     [NotNull] T4Environment t4Environment
     )
 {
     _changeManager = changeManager;
     _t4Environment = t4Environment;
 }
Esempio n. 11
0
 public T4PsiModuleProvider([NotNull] Lifetime lifetime, [NotNull] IShellLocks shellLocks, [NotNull] ChangeManager changeManager,
                            [NotNull] T4Environment t4Environment)
 {
     _lifetime      = lifetime;
     _shellLocks    = shellLocks;
     _changeManager = changeManager;
     _t4Environment = t4Environment;
 }
Esempio n. 12
0
 internal T4Parser([NotNull] T4Environment t4Environment, [NotNull] DirectiveInfoManager directiveInfoManager, [NotNull] ILexer lexer,
                   [CanBeNull] IPsiSourceFile sourceFile)
 {
     _t4Environment        = t4Environment;
     _directiveInfoManager = directiveInfoManager;
     _lexer      = lexer;
     _sourceFile = sourceFile;
 }
 public T4ProjectPsiModuleHandler(
     [NotNull] Lifetime lifetime,
     [NotNull] IProjectPsiModuleHandler handler,
     [NotNull] ChangeManager changeManager,
     [NotNull] T4Environment t4Environment,
     [NotNull] IProject project)
     : base(handler)
 {
     _t4PsiModuleProvider = new T4PsiModuleProvider(lifetime, project.Locks, changeManager, t4Environment);
 }
Esempio n. 14
0
        public IncludeDirectiveInfo([NotNull] T4Environment environment)
            : base("include")
        {
            _fileAttribute = new DirectiveAttributeInfo("file", DirectiveAttributeOptions.Required | DirectiveAttributeOptions.DisplayInCodeStructure);
            _onceAttribute = new BooleanDirectiveAttributeInfo("once", DirectiveAttributeOptions.None);

            _supportedAttributes = Array.AsReadOnly(environment.VsVersion2.Major >= 12
                                ? new[] { _fileAttribute, _onceAttribute }
                                : new[] { _fileAttribute });
        }
 public T4CSharpLanguageLevelProvider(
     [NotNull] T4Environment t4Environment,
     [NotNull] ILanguageLevelProjectProperty <CSharpLanguageLevel, CSharpLanguageVersion> projectProperty,
     [CanBeNull] ILanguageLevelOverrider <CSharpLanguageLevel> languageLevelOverrider             = null,
     [CanBeNull] Lazy <ILanguageVersionModifier <CSharpLanguageVersion> > languageVersionModifier = null
     )
     : base(projectProperty, languageLevelOverrider, languageVersionModifier)
 {
     _t4Environment = t4Environment;
 }
Esempio n. 16
0
        public T4PsiModuleProvider([NotNull] Lifetime lifetime, [NotNull] IShellLocks shellLocks, [NotNull] ChangeManager changeManager,
            [NotNull] T4Environment t4Environment, [NotNull] ISolution solution)
        {
            _lifetime = lifetime;
            _shellLocks = shellLocks;
            _changeManager = changeManager;
            _t4Environment = t4Environment;
            _solution = solution;

            changeManager.RegisterChangeProvider(lifetime, this);
            changeManager.AddDependency(lifetime, this, solution);
        }
Esempio n. 17
0
 private T4TreeBuilder([NotNull] T4Environment t4Environment, [NotNull] DirectiveInfoManager directiveInfoManager, [NotNull] ILexer lexer,
                       [CanBeNull] IPsiSourceFile sourceFile, [NotNull] HashSet <FileSystemPath> existingIncludePaths, [CanBeNull] ISolution solution,
                       [CanBeNull] T4PsiModule macroResolveModule)
 {
     _t4Environment        = t4Environment;
     _directiveInfoManager = directiveInfoManager;
     _builderLexer         = new PsiBuilderLexer(lexer, tnt => tnt.IsWhitespace);
     _existingIncludePaths = existingIncludePaths;
     _sourceFile           = sourceFile;
     _solution             = solution;
     _macroResolveModule   = macroResolveModule;
 }
Esempio n. 18
0
        public T4PsiModuleProvider([NotNull] Lifetime lifetime, [NotNull] IShellLocks shellLocks, [NotNull] ChangeManager changeManager,
                                   [NotNull] T4Environment t4Environment, [NotNull] ISolution solution)
        {
            _lifetime      = lifetime;
            _shellLocks    = shellLocks;
            _changeManager = changeManager;
            _t4Environment = t4Environment;
            _solution      = solution;

            changeManager.RegisterChangeProvider(lifetime, this);
            changeManager.AddDependency(lifetime, this, solution);
        }
Esempio n. 19
0
        public IncludeDirectiveInfo([NotNull] T4Environment environment)
            : base("include")
        {
            FileAttribute = new DirectiveAttributeInfo("file", DirectiveAttributeOptions.Required | DirectiveAttributeOptions.DisplayInCodeStructure);
            OnceAttribute = new BooleanDirectiveAttributeInfo("once", DirectiveAttributeOptions.None);

            SupportedAttributes = ImmutableArray.FromArguments(
                environment.VsVersion2.Major >= 12
                                        ? new[] { FileAttribute, OnceAttribute }
                                        : new[] { FileAttribute }
                );
        }
Esempio n. 20
0
 private T4TreeBuilder([NotNull] T4Environment t4Environment, [NotNull] DirectiveInfoManager directiveInfoManager, [NotNull] ILexer lexer,
     [CanBeNull] IPsiSourceFile sourceFile, [NotNull] HashSet<FileSystemPath> existingIncludePaths, [CanBeNull] ISolution solution,
     [CanBeNull] T4PsiModule macroResolveModule)
 {
     _t4Environment = t4Environment;
     _directiveInfoManager = directiveInfoManager;
     _builderLexer = new PsiBuilderLexer(lexer, tnt => tnt.IsWhitespace);
     _existingIncludePaths = existingIncludePaths;
     _sourceFile = sourceFile;
     _solution = solution;
     _macroResolveModule = macroResolveModule;
 }
 public T4OutsideSolutionSourceFileManager(
     [NotNull] Lifetime lifetime,
     [NotNull] IProjectFileExtensions projectFileExtensions,
     [NotNull] PsiProjectFileTypeCoordinator psiProjectFileTypeCoordinator,
     [NotNull] DocumentManager documentManager,
     [NotNull] ISolution solution,
     [NotNull] T4Environment t4Environment,
     [NotNull] IFileSystemTracker fileSystemTracker)
 {
     _projectFileExtensions         = projectFileExtensions;
     _psiProjectFileTypeCoordinator = psiProjectFileTypeCoordinator;
     _documentManager = documentManager;
     _psiModule       = new PsiModuleOnFileSystemPaths(solution, "T4OutsideSolution", t4Environment.TargetFrameworkId, fileSystemTracker, lifetime);
     lifetime.AddDispose(_sourceFiles);
 }
Esempio n. 22
0
 public DirectiveInfoManager([NotNull] T4Environment environment)
 {
     Template      = new TemplateDirectiveInfo(environment);
     Parameter     = new ParameterDirectiveInfo();
     Output        = new OutputDirectiveInfo();
     Include       = new IncludeDirectiveInfo();
     Assembly      = new AssemblyDirectiveInfo();
     Import        = new ImportDirectiveInfo();
     AllDirectives = Array.AsReadOnly(new DirectiveInfo[] {
         Template,
         Parameter,
         Output,
         Include,
         Assembly,
         Import
     });
 }
 public T4OutsideSolutionSourceFileManager(
     Lifetime lifetime,
     [NotNull] IProjectFileExtensions projectFileExtensions,
     [NotNull] PsiProjectFileTypeCoordinator psiProjectFileTypeCoordinator,
     [NotNull] DocumentManager documentManager,
     [NotNull] ISolution solution,
     [NotNull] T4Environment t4Environment,
     [NotNull] IFileSystemTracker fileSystemTracker
     )
 {
     _projectFileExtensions         = projectFileExtensions;
     _psiProjectFileTypeCoordinator = psiProjectFileTypeCoordinator;
     _documentManager = documentManager;
     _sourceFiles     = new StrongToWeakDictionary <FileSystemPath, IPsiSourceFile>(lifetime);
     _psiModule       = new PsiModuleOnFileSystemPaths(solution, "T4OutsideSolution", Guid.NewGuid().ToString(), t4Environment.TargetFrameworkId, fileSystemTracker, lifetime);
     lifetime.OnTermination(_sourceFiles);
 }
Esempio n. 24
0
 internal T4TreeBuilder(
     [NotNull] T4Environment t4Environment,
     [NotNull] DirectiveInfoManager directiveInfoManager,
     [NotNull] ILexer lexer,
     [CanBeNull] IPsiSourceFile sourceFile = null
     )
     : this(
         t4Environment,
         directiveInfoManager,
         lexer,
         sourceFile,
         new HashSet <FileSystemPath>(),
         sourceFile?.GetSolution(),
         sourceFile?.PsiModule as T4PsiModule
         )
 {
 }
Esempio n. 25
0
        internal T4PsiModule([NotNull] Lifetime lifetime, [NotNull] PsiModuleManager psiModuleManager, [NotNull] DocumentManager documentManager,
                             [NotNull] ChangeManager changeManager, [NotNull] IAssemblyFactory assemblyFactory, [NotNull] IShellLocks shellLocks,
                             [NotNull] IProjectFile projectFile, [NotNull] T4FileDataCache fileDataCache, [NotNull] T4Environment t4Environment,
                             [NotNull] OutputAssembliesCache outputAssembliesCache)
        {
            _lifetime = lifetime;
            lifetime.AddAction(Dispose);

            _psiModuleManager = psiModuleManager;
            _documentManager  = documentManager;
            _assemblyFactory  = assemblyFactory;

            _changeManager = changeManager;
            changeManager.RegisterChangeProvider(lifetime, this);
            changeManager.AddDependency(lifetime, psiModuleManager, this);

            _shellLocks  = shellLocks;
            _projectFile = projectFile;
            _project     = projectFile.GetProject();
            Assertion.AssertNotNull(_project, "_project != null");
            _solution = _project.GetSolution();

            _t4Environment         = t4Environment;
            _outputAssembliesCache = outputAssembliesCache;
            _resolveProject        = new T4ResolveProject(_solution, _shellLocks, t4Environment.PlatformID, _project);

            _sourceFile = new PsiProjectFile(
                this,
                _projectFile,
                (pf, sf) => new DefaultPsiProjectFileProperties(pf, sf),
                JetFunc <IProjectFile, IPsiSourceFile> .True,
                _documentManager);

            _isValid = true;
            fileDataCache.FileDataChanged.Advise(lifetime, OnDataFileChanged);
            AddBaseReferences();
        }
Esempio n. 26
0
        internal T4PsiModule([NotNull] Lifetime lifetime, [NotNull] IPsiModules psiModules, [NotNull] DocumentManager documentManager,
            [NotNull] ChangeManager changeManager, [NotNull] IAssemblyFactory assemblyFactory, [NotNull] IShellLocks shellLocks,
            [NotNull] IProjectFile projectFile, [NotNull] T4FileDataCache fileDataCache, [NotNull] T4Environment t4Environment,
            [NotNull] OutputAssemblies outputAssemblies)
        {
            _lifetime = lifetime;
            lifetime.AddAction(Dispose);

            _psiModules = psiModules;
            _assemblyFactory = assemblyFactory;
            _changeManager = changeManager;
            _shellLocks = shellLocks;

            _projectFile = projectFile;
            IProject project = projectFile.GetProject();
            Assertion.AssertNotNull(project, "project != null");
            _project = project;
            _solution = project.GetSolution();

            changeManager.RegisterChangeProvider(lifetime, this);
            changeManager.AddDependency(lifetime, psiModules, this);

            _t4Environment = t4Environment;
            _outputAssemblies = outputAssemblies;
            _resolveProject = new T4ResolveProject(lifetime, _solution, _shellLocks, t4Environment.PlatformID, project);

            _sourceFile = CreateSourceFile(projectFile, documentManager);

            _isValid = true;
            fileDataCache.FileDataChanged.Advise(lifetime, OnDataFileChanged);
            AddBaseReferences();
        }
 /// <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(T4ProjectFileType t4ProjectFileType, T4Environment t4Environment)
     : base(t4ProjectFileType)
 {
     _t4Environment = t4Environment;
 }
		public T4CSharpLanguageLevelProvider([NotNull] T4Environment t4Environment) {
			_t4Environment = t4Environment;
		}
Esempio n. 29
0
        internal T4PsiModule([NotNull] Lifetime lifetime, [NotNull] PsiModuleManager psiModuleManager, [NotNull] DocumentManager documentManager,
            [NotNull] ChangeManager changeManager, [NotNull] IAssemblyFactory assemblyFactory, [NotNull] IShellLocks shellLocks,
            [NotNull] IProjectFile projectFile, [NotNull] T4FileDataCache fileDataCache, [NotNull] T4Environment t4Environment,
            [NotNull] OutputAssembliesCache outputAssembliesCache)
        {
            _lifetime = lifetime;
            lifetime.AddAction(Dispose);

            _psiModuleManager = psiModuleManager;
            _documentManager = documentManager;
            _assemblyFactory = assemblyFactory;

            _changeManager = changeManager;
            changeManager.RegisterChangeProvider(lifetime, this);
            changeManager.AddDependency(lifetime, psiModuleManager, this);

            _shellLocks = shellLocks;
            _projectFile = projectFile;
            _project = projectFile.GetProject();
            Assertion.AssertNotNull(_project, "_project != null");
            _solution = _project.GetSolution();

            _t4Environment = t4Environment;
            _outputAssembliesCache = outputAssembliesCache;
            _resolveProject = new T4ResolveProject(_solution, _shellLocks, t4Environment.PlatformID, _project);

            _sourceFile = new PsiProjectFile(
                this,
                _projectFile,
                (pf, sf) => new DefaultPsiProjectFileProperties(pf, sf),
                JetFunc<IProjectFile, IPsiSourceFile>.True,
                _documentManager);

            _isValid = true;
            fileDataCache.FileDataChanged.Advise(lifetime, OnDataFileChanged);
            AddBaseReferences();
        }
Esempio n. 30
0
 public T4ModuleReferencer([NotNull] T4Environment environment, [NotNull] DirectiveInfoManager directiveInfoManager)
 {
     _environment          = environment;
     _directiveInfoManager = directiveInfoManager;
 }
		/// <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(T4ProjectFileType t4ProjectFileType, T4Environment t4Environment)
			: base(t4ProjectFileType) {
			_t4Environment = t4Environment;
		}
 public T4CSharpLanguageLevelProvider([NotNull] T4Environment t4Environment)
 {
     _t4Environment = t4Environment;
 }
Esempio n. 33
0
 public T4ModuleReferencer([NotNull] T4Environment environment, [NotNull] DirectiveInfoManager directiveInfoManager)
 {
     _environment = environment;
     _directiveInfoManager = directiveInfoManager;
 }