Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Import Project="..\Configuration.props" />
<Import Project="..\Containers.props" />
<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2019.3.1">
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2021.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Import Project="..\Configuration.props" />
<Import Project="..\Containers.props" />
<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2019.3.1">
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2021.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Import Project="..\Configuration.props" />
<Import Project="..\Containers.props" />
<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2019.3.1">
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2021.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Import Project="..\Configuration.props" />
<Import Project="..\Containers.props" />
<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2019.3.1">
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2021.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Import Project="..\Configuration.props" />
<Import Project="..\Containers.props" />
<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2019.3.1">
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2021.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Import Project="..\Configuration.props" />
<Import Project="..\Containers.props" />
<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2019.3.1">
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2021.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Import Project="..\Configuration.props" />
<Import Project="..\Containers.props" />
<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2019.3.1">
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2021.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Import Project="..\Configuration.props" />
<Import Project="..\Containers.props" />
<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2019.3.1">
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2021.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Import Project="..\Configuration.props" />
<Import Project="..\Containers.props" />
<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2019.3.1">
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2021.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Import Project="..\Configuration.props" />
<Import Project="..\Main.props" />
<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2019.3.1">
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2021.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<Compile Remove="Navigation\SearchRegisteredComponentsDescriptor.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="EnvDTE80" Version="8.0.3" />
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2019.3.1">
<PackageReference Include="EnvDTE80" Version="16.10.31320.204" />
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" />
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2021.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
27 changes: 13 additions & 14 deletions src/AgentMulder.ReSharper.Plugin/Components/PatternManagerCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using JetBrains.Application.Progress;
using JetBrains.DocumentManagers.impl;
using JetBrains.ProjectModel;
Expand All @@ -14,7 +13,7 @@
namespace AgentMulder.ReSharper.Plugin.Components
{
[SolutionComponent]
public class PatternManagerCache : IPatternManager, ICache
public class PatternManagerCache : IPatternManager, IPsiSourceFileCache
{
private readonly object lockObject = new object();
private readonly JetHashSet<IPsiSourceFile> dirtyFiles = new JetHashSet<IPsiSourceFile>();
Expand All @@ -32,7 +31,7 @@ public PatternManagerCache(SolutionAnalyzer solutionAnalyzer, PsiProjectFileType

public IEnumerable<RegistrationInfo> GetRegistrationsForFile(IPsiSourceFile sourceFile)
{
if (!((ICache)this).UpToDate(sourceFile))
if (!((IPsiSourceFileCache)this).UpToDate(sourceFile))
{
Merge(sourceFile, ProcessSourceFile(sourceFile));
}
Expand All @@ -50,12 +49,12 @@ public void Refresh()
lock (lockObject)
{
var list = this.ProcessSourceFile(file).ToList();
((ICache)this).Merge(file, list);
((IPsiSourceFileCache)this).Merge(file, list);
}
}
}

object ICache.Build(IPsiSourceFile sourceFile, bool isStartup)
object IPsiSourceFileCache.Build(IPsiSourceFile sourceFile, bool isStartup)
{
var registrationInfos = ProcessSourceFile(sourceFile).ToList();
Merge(sourceFile, registrationInfos);
Expand All @@ -79,7 +78,7 @@ void ICache.Save(IProgressIndicator progress, bool enablePersistence)
Save?.Invoke(this, EventArgs.Empty);
}

void ICache.MarkAsDirty(IPsiSourceFile sourceFile)
void IPsiSourceFileCache.MarkAsDirty(IPsiSourceFile sourceFile)
{
MarkAsDirty(sourceFile);
}
Expand All @@ -92,7 +91,7 @@ private void MarkAsDirty(IPsiSourceFile sourceFile)
}
}

void ICache.Merge(IPsiSourceFile sourceFile, object builtPart)
void IPsiSourceFileCache.Merge(IPsiSourceFile sourceFile, object builtPart)
{
if (builtPart == null)
{
Expand All @@ -102,7 +101,7 @@ void ICache.Merge(IPsiSourceFile sourceFile, object builtPart)
Merge(sourceFile, (IEnumerable<RegistrationInfo>)builtPart);
}

void ICache.Drop(IPsiSourceFile sourceFile)
void IPsiSourceFileCache.Drop(IPsiSourceFile sourceFile)
{
RemoveFileItems(sourceFile);
}
Expand Down Expand Up @@ -140,7 +139,7 @@ private void RemoveFileItems(IPsiSourceFile sourceFile)
}
}

void ICache.OnPsiChange(ITreeNode elementContainingChanges, PsiChangedElementType type)
void IPsiSourceFileCache.OnPsiChange(ITreeNode elementContainingChanges, PsiChangedElementType type)
{
var sourceFile = elementContainingChanges?.GetSourceFile();
if (sourceFile == null)
Expand All @@ -154,28 +153,28 @@ void ICache.OnPsiChange(ITreeNode elementContainingChanges, PsiChangedElementTyp
}
}

void ICache.OnDocumentChange(IPsiSourceFile sourceFile, ProjectFileDocumentCopyChange change)
void IPsiSourceFileCache.OnDocumentChange(IPsiSourceFile sourceFile, ProjectFileDocumentCopyChange change)
{
MarkAsDirty(sourceFile);
}

void ICache.SyncUpdate(bool underTransaction)
void IPsiSourceFileCache.SyncUpdate(bool underTransaction)
{
lock (lockObject)
{
if (HasDirtyFiles)
{
foreach (var psiSourceFile in dirtyFiles.ToList()) // ToList to prevent InvalidOperation while enumerating
{
((ICache)this).Merge(psiSourceFile, ProcessSourceFile(psiSourceFile));
((IPsiSourceFileCache)this).Merge(psiSourceFile, ProcessSourceFile(psiSourceFile));
}

dirtyFiles.Clear();
}
}
}

bool ICache.UpToDate(IPsiSourceFile sourceFile)
bool IPsiSourceFileCache.UpToDate(IPsiSourceFile sourceFile)
{
lock (lockObject)
{
Expand Down Expand Up @@ -208,7 +207,7 @@ public IEnumerable<RegistrationInfo> GetAllRegistrations()
{
if (HasDirtyFiles)
{
((ICache)this).SyncUpdate(false);
((IPsiSourceFileCache)this).SyncUpdate(false);
}

lock (lockObject)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace AgentMulder.ReSharper.Plugin.Components
/// </summary>
/// <remarks>This is constructed and injected automatically by the runtime.</remarks>
[SolutionComponent]
public sealed class RegisteredTypeCollector : IRegisteredTypeCollector, ICache
public sealed class RegisteredTypeCollector : IRegisteredTypeCollector, IPsiSourceFileCache
{
private readonly ConcurrentDictionary<IPsiSourceFile, object> dirtyFiles = new ConcurrentDictionary<IPsiSourceFile, object>();
private readonly PsiProjectFileTypeCoordinator projectFileTypeCoordinator;
Expand All @@ -45,7 +45,7 @@ public RegisteredTypeCollector(PsiProjectFileTypeCoordinator projectFileTypeCoor
/// <returns>A read-only collection of type declarations and registration information.</returns>
public IEnumerable<Tuple<ITypeDeclaration, RegistrationInfo>> GetRegisteredTypes()
{
((ICache)this).SyncUpdate(false);
((IPsiSourceFileCache)this).SyncUpdate(false);

// this cache stores declared types for each source file
// when a source file changes, types in that file are recalculated
Expand All @@ -58,7 +58,7 @@ public IEnumerable<Tuple<ITypeDeclaration, RegistrationInfo>> GetRegisteredType
return types;
}

object ICache.Build(IPsiSourceFile sourceFile, bool isStartup)
object IPsiSourceFileCache.Build(IPsiSourceFile sourceFile, bool isStartup)
{
if (sourceFile.Properties.IsGeneratedFile || sourceFile.Properties.IsNonUserFile)
{
Expand All @@ -69,12 +69,12 @@ object ICache.Build(IPsiSourceFile sourceFile, bool isStartup)
// this is because to collect registered types, we first need the pattern manager cache to be completely populated
// that will only happen later - see Refresh()
var list = new List<MatchingType>();
((ICache)this).Merge(sourceFile, list);
((IPsiSourceFileCache)this).Merge(sourceFile, list);

return list;
}

void ICache.MarkAsDirty(IPsiSourceFile sf)
void IPsiSourceFileCache.MarkAsDirty(IPsiSourceFile sf)
{
dirtyFiles.AddOrUpdate(sf, _ => null, (file, current) => null);
}
Expand All @@ -95,7 +95,7 @@ void ICache.Save(IProgressIndicator progress, bool enablePersistence)
// we do not persist this cache
}

bool ICache.UpToDate(IPsiSourceFile sourceFile)
bool IPsiSourceFileCache.UpToDate(IPsiSourceFile sourceFile)
{
if (dirtyFiles.ContainsKey(sourceFile))
{
Expand All @@ -116,7 +116,7 @@ bool ICache.UpToDate(IPsiSourceFile sourceFile)
return !languageType.IsNullOrUnknown() && projectFileTypeCoordinator.TryGetService(languageType) != null;
}

void ICache.Merge(IPsiSourceFile sourceFile, object data)
void IPsiSourceFileCache.Merge(IPsiSourceFile sourceFile, object data)
{
// merges the provided data into the cache
// this is usually called after Build
Expand All @@ -131,7 +131,7 @@ void ICache.Merge(IPsiSourceFile sourceFile, object data)
dirtyFiles.TryRemove(sourceFile, out _);
}

void ICache.Drop(IPsiSourceFile sourceFile)
void IPsiSourceFileCache.Drop(IPsiSourceFile sourceFile)
{
// removes the specified file from the cache
if (!matchingTypes.ContainsKey(sourceFile))
Expand All @@ -142,7 +142,7 @@ void ICache.Drop(IPsiSourceFile sourceFile)
matchingTypes.TryRemove(sourceFile, out _);
}

void ICache.OnPsiChange(ITreeNode elementContainingChanges, PsiChangedElementType type)
void IPsiSourceFileCache.OnPsiChange(ITreeNode elementContainingChanges, PsiChangedElementType type)
{
if (type == PsiChangedElementType.Whitespaces)
{
Expand All @@ -158,13 +158,13 @@ void ICache.OnPsiChange(ITreeNode elementContainingChanges, PsiChangedElementTyp
dirtyFiles.AddOrUpdate(sourceFile, _ => null, (file, current) => null);
}

void ICache.OnDocumentChange(IPsiSourceFile sourceFile, ProjectFileDocumentCopyChange change)
void IPsiSourceFileCache.OnDocumentChange(IPsiSourceFile sourceFile, ProjectFileDocumentCopyChange change)
{
// marks the document as dirty
((ICache)this).MarkAsDirty(sourceFile);
((IPsiSourceFileCache)this).MarkAsDirty(sourceFile);
}

void ICache.SyncUpdate(bool underTransaction)
void IPsiSourceFileCache.SyncUpdate(bool underTransaction)
{
if (underTransaction)
{
Expand All @@ -181,14 +181,14 @@ void ICache.SyncUpdate(bool underTransaction)
{
foreach (var psiSourceFile in dirtyFiles.Keys.ToList()) // ToList to prevent InvalidOperation while enumerating
{
((ICache)this).Merge(psiSourceFile, CollectTypes(psiSourceFile));
((IPsiSourceFileCache)this).Merge(psiSourceFile, CollectTypes(psiSourceFile));
}

dirtyFiles.Clear();
}
}

void ICache.Dump(TextWriter writer, IPsiSourceFile sourceFile)
void IPsiSourceFileCache.Dump(TextWriter writer, IPsiSourceFile sourceFile)
{
// this is just a debugging facility
}
Expand All @@ -213,7 +213,7 @@ public void Refresh()
foreach (var file in matchingTypes.Keys.ToList())
{
var list = CollectTypes(file);
((ICache)this).Merge(file, list);
((IPsiSourceFileCache)this).Merge(file, list);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
using System.Collections.Generic;
using AgentMulder.ReSharper.Plugin.Highlighting;
using System.Linq;
using JetBrains.Application.UI.Controls.BulbMenu.Anchors;
using JetBrains.Application.UI.Controls.BulbMenu.Items;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Feature.Services.Resources;
using JetBrains.ReSharper.Resources.Shell;
using JetBrains.TextControl.DocumentMarkup;

[assembly: RegisterHighlighter("Container Registration", EffectType = EffectType.GUTTER_MARK, GutterMarkType = typeof(ContainerGutterMark), Layer = 2001)]
using JetBrains.UI.RichText;

namespace AgentMulder.ReSharper.Plugin.Highlighting
{
public class ContainerGutterMark : IconGutterMark
[RegisterHighlighter("Container Registration", EffectType = EffectType.GUTTER_MARK, GutterMarkType = typeof(ContainerGutterMark), Layer = 2001)]
public class ContainerGutterMark : IconGutterMarkType
{
public ContainerGutterMark()
: base(AlteringFeatuThemedIcons.GeneratedMembers.Id)
Expand All @@ -33,7 +33,9 @@ public override IEnumerable<BulbMenuItem> GetBulbMenuItems(IHighlighter highligh
var clickable = solution?.GetComponent<IDaemon>().GetHighlighting(highlighter) as IClickableGutterHighlighting;
clickable?.OnClick();

}), highlighter.ToolTip, IconId, BulbMenuAnchors.PermanentBackgroundItems, true);
}),
(highlighter.TryGetTooltip(HighlighterTooltipKind.GutterMark) ?? (RichTextBlock)"The item has no text").Lines.Aggregate((a, b) => a.Append(" ", TextStyle.Default).Append(b)),
IconId, BulbMenuAnchors.PermanentBackgroundItems, true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace AgentMulder.ReSharper.Plugin.Highlighting
{
[StaticSeverityHighlighting(Severity.INFO, "GutterMarks", OverlapResolve = OverlapResolveKind.NONE, AttributeId = "Container Registration", ShowToolTipInStatusBar = false)]
[StaticSeverityHighlighting(Severity.INFO, typeof(HighlightingGroupIds.GutterMarks), OverlapResolve = OverlapResolveKind.NONE, AttributeId = "Container Registration", ShowToolTipInStatusBar = false)]
public class RegisteredByContainerHighlighting : IClickableGutterHighlighting
{
private readonly RegistrationInfo registrationInfo;
Expand Down
Loading