Skip to content
This repository has been archived by the owner on Jun 22, 2023. It is now read-only.

Commit

Permalink
Fixed formatting, removed useless stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrJul committed May 18, 2016
1 parent f323426 commit ff65273
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 42 deletions.
22 changes: 9 additions & 13 deletions GammaJul.ReSharper.ForTea/Daemon/T4CSharpErrorProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


using System;
using System.Collections.Generic;
using System.Linq;
using GammaJul.ReSharper.ForTea.Daemon.Highlightings;
using GammaJul.ReSharper.ForTea.Psi;
Expand All @@ -27,6 +26,8 @@
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Util;
using JetBrains.Util;

namespace GammaJul.ReSharper.ForTea.Daemon {

Expand All @@ -47,21 +48,16 @@ public override void VisitClassDeclaration(IClassDeclaration classDeclarationPar
ITypeElement typeElement = CSharpTypeFactory.CreateDeclaredType(superTypeUsage).GetTypeElement();
if (typeElement == null)
return;

if (!GetAllMethodsInTypeHierarchy(typeElement).Any(IsTransformTextMethod))
if (!HasTransformTextMethod(typeElement))
context.AddHighlighting(new MissingTransformTextMethodHighlighting(superTypeUsage));
}

private static IEnumerable<IMethod> GetAllMethodsInTypeHierarchy(ITypeElement typeElement) {
var currentTypeElement = typeElement;
while (currentTypeElement != null) {
foreach (var method in currentTypeElement.Methods)
yield return method;
var baseClassDeclaredType = currentTypeElement.GetSuperTypes().FirstOrDefault();
if (baseClassDeclaredType == null)
yield break;
currentTypeElement = baseClassDeclaredType.GetTypeElement();
}
private static bool HasTransformTextMethod([NotNull] ITypeElement typeElement) {
return typeElement
.GetAllClassMembers(T4CSharpCodeGenerator.TransformTextMethodName)
.SelectNotNull(instance => instance.Member as IMethod)
.Any(IsTransformTextMethod);
}

private static bool IsTransformTextMethod([NotNull] IMethod method) {
Expand Down
2 changes: 1 addition & 1 deletion GammaJul.ReSharper.ForTea/GammaJul.ReSharper.ForTea.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<ProjectGuid>{63F25238-06BA-4861-95A2-DA35A1D18B65}</ProjectGuid>
<AssemblyName>GammaJul.ReSharper.ForTea.v10.0</AssemblyName>
<AssemblyName>GammaJul.ReSharper.ForTea</AssemblyName>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
Expand Down
8 changes: 4 additions & 4 deletions GammaJul.ReSharper.ForTea/GammaJul.ReSharper.ForTea.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<authors>Julien Lebosquain</authors>
<description>Adds support for editing T4 text templating files (.tt)</description>
<releaseNotes>
Added support for ReSharper 2016.1
Added support for ReSharper 10.
</releaseNotes>
- Added support for ReSharper 2016.1 (#72)
- The TransformText method is now resolved from base classes (#64).
</releaseNotes>
<projectUrl>https://github.com/MrJul/ForTea/</projectUrl>
<iconUrl>https://raw.github.com/MrJul/ForTea/master/Logo/ForTea%20128x128.png</iconUrl>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
Expand All @@ -20,6 +20,6 @@
</dependencies>
</metadata>
<files>
<file src="bin\Release\GammaJul.ReSharper.ForTea.v10.0.dll" target="DotFiles" />
<file src="bin\Release\GammaJul.ReSharper.ForTea.dll" target="DotFiles" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ public bool CanUseStaticImport {
get { return false; }
}

public bool CanOmitBraces {
get { return false; }
}
public bool CanOmitBraces {
get { return false; }
}

/// <summary>
/// <summary>
/// Creates a new T4 code block.
/// </summary>
/// <param name="text">The C# code.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace GammaJul.ReSharper.ForTea.Psi {
public class T4ProjectPsiModuleProviderFilter : IProjectPsiModuleProviderFilter {

[NotNull] private readonly ChangeManager _changeManager;
[NotNull] private readonly T4Environment _t4Environment;
[NotNull] private readonly T4Environment _t4Environment;

Tuple<IProjectPsiModuleHandler, IPsiModuleDecorator> IProjectPsiModuleProviderFilter.OverrideHandler(Lifetime lifetime, IProject project, IProjectPsiModuleHandler handler)
{
Expand Down
34 changes: 18 additions & 16 deletions GammaJul.ReSharper.ForTea/Psi/T4PsiModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace GammaJul.ReSharper.ForTea.Psi {
/// <summary>
/// PSI module managing a single T4 file.
/// </summary>
internal sealed class T4PsiModule : IPsiModule, IProjectPsiModule, IChangeProvider {
internal sealed class T4PsiModule : IProjectPsiModule, IChangeProvider {

private const string Prefix = "[T4] ";

Expand All @@ -68,8 +68,8 @@ internal sealed class T4PsiModule : IPsiModule, IProjectPsiModule, IChangeProvid
[NotNull] private readonly IPsiSourceFile _sourceFile;
[NotNull] private readonly T4ResolveProject _resolveProject;
[NotNull] private readonly OutputAssemblies _outputAssemblies;
[NotNull] private readonly Dictionary<object, object> _userData = new Dictionary<object, object>();
[CanBeNull] private IModuleReferenceResolveManager _resolveManager;
[NotNull] private readonly UserDataHolder _userDataHolder = new UserDataHolder();
[CanBeNull] private IModuleReferenceResolveManager _resolveManager;
private bool _isValid;

/// <summary>
Expand Down Expand Up @@ -139,7 +139,6 @@ public TargetFrameworkId TargetFrameworkId {
/// Gets the solution this PSI module is attached to.
/// </summary>
/// <returns>An instance of <see cref="ISolution"/>.</returns>
[NotNull]
public ISolution GetSolution() {
return _solution;
}
Expand Down Expand Up @@ -419,6 +418,21 @@ private IAssemblyCookie CreateCookieCore([NotNull] AssemblyReferenceTarget targe
: null;
}


public T GetData<T>(Key<T> key)
where T : class {
return _userDataHolder.GetData(key);
}

public void PutData<T>(Key<T> key, T val)
where T : class {
_userDataHolder.PutData(key, val);
}

public IEnumerable<KeyValuePair<object, object>> EnumerateData() {
return _userDataHolder.EnumerateData();
}

/// <summary>
/// Disposes this instance.
/// </summary>
Expand Down Expand Up @@ -478,18 +492,6 @@ internal T4PsiModule([NotNull] Lifetime lifetime, [NotNull] IPsiModules psiModul
AddBaseReferences();
}

public void PutData<T>(Key<T> key, T value) where T : class {
_userData.Add(key, value);
}

public T GetData<T>(Key<T> key) where T : class {
return (_userData.ContainsKey(key) ? _userData[key] : null) as T;
}

public IEnumerable<KeyValuePair<object, object>> EnumerateData() {
return _userData.Select(p => p);
}

}

}
4 changes: 2 additions & 2 deletions GammaJul.ReSharper.ForTea/T4Environment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ public IEnumerable<FileSystemPath> IncludePaths {

[NotNull]
private IList<FileSystemPath> ReadIncludePaths() {
string registryKey = JetBrains.ReSharper.Resources.Shell.Shell.Instance.GetComponent<IVsEnvironmentInformation>().GetVisualStudioGlobalRegistryPath()
string registryKey = _vsEnvironmentInformation.GetVisualStudioGlobalRegistryPath()
+ @"_Config\TextTemplating\IncludeFolders\.tt";
MessageBox.ShowInfo(registryKey, "Info");

using (RegistryKey key = Registry.CurrentUser.OpenSubKey(registryKey)) {

if (key == null)
Expand Down
1 change: 0 additions & 1 deletion GammaJul.ReSharper.ForTea/build.bat

This file was deleted.

0 comments on commit ff65273

Please sign in to comment.