-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- [Added] Support for external extensions tooltip highlighting.
- [Added] More colorizings over the tooltip - [Fixed] hide redundant Roslyn analizers tooltip items
- Loading branch information
Showing
18 changed files
with
315 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...maJul.ReSharper.EnhancedTooltip/ExternalHighlightings/ExceptionalExtensionHighlighting.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
| ||
|
||
namespace GammaJul.ReSharper.EnhancedTooltip.ExceptionalHighlightings { | ||
|
||
using GammaJul.ReSharper.EnhancedTooltip.ExternalHighlightings; | ||
|
||
public interface IExceptionNotDocumentedHighlighting : IExternalHighlighting { } | ||
public interface IExceptionNotDocumentedOptionalHighlighting : IExternalHighlighting { } | ||
} |
6 changes: 6 additions & 0 deletions
6
source/GammaJul.ReSharper.EnhancedTooltip/ExternalHighlightings/IExternalHighlighting.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
using JetBrains.ReSharper.Feature.Services.Daemon; | ||
|
||
namespace GammaJul.ReSharper.EnhancedTooltip.ExternalHighlightings { | ||
public interface IExternalHighlighting : IHighlighting { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...edTooltip/Presentation/Highlightings/CSharp/ExceptionNotDocumentedHighlightingEnhancer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using GammaJul.ReSharper.EnhancedTooltip.DocumentMarkup; | ||
using JetBrains.ProjectModel; | ||
using JetBrains.ReSharper.Psi.CodeAnnotations; | ||
|
||
namespace GammaJul.ReSharper.EnhancedTooltip.Presentation.Highlightings.CSharp { | ||
|
||
using GammaJul.ReSharper.EnhancedTooltip.ExceptionalHighlightings; | ||
using GammaJul.ReSharper.EnhancedTooltip.Utils; | ||
using JetBrains.ReSharper.Feature.Services.Daemon; | ||
|
||
[SolutionComponent] | ||
internal sealed class ExceptionNotDocumentedHighlightingEnhancer : CSharpHighlightingEnhancer<IExceptionNotDocumentedHighlighting> { | ||
|
||
protected override void AppendTooltip(IExceptionNotDocumentedHighlighting highlighting, CSharpColorizer colorizer) { } | ||
|
||
protected override void AppendTooltip(IHighlighting highlighting, CSharpColorizer colorizer) { | ||
var typeName = highlighting.GetDynamicFieldOrPropertySafe("ExceptionTypeName"); | ||
if (typeName != null) { | ||
colorizer.AppendPlainText("(optional) Exception '"); | ||
colorizer.AppendClassName(typeName.ToString()); | ||
colorizer.AppendPlainText("' is not documented [Exceptional]"); | ||
} else { | ||
colorizer.AppendPlainText(highlighting.ToolTip); | ||
} | ||
} | ||
|
||
public ExceptionNotDocumentedHighlightingEnhancer( | ||
TextStyleHighlighterManager textStyleHighlighterManager, | ||
CodeAnnotationsConfiguration codeAnnotationsConfiguration, | ||
HighlighterIdProviderFactory highlighterIdProviderFactory) | ||
: base(textStyleHighlighterManager, codeAnnotationsConfiguration, highlighterIdProviderFactory) { | ||
} | ||
|
||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
...p/Presentation/Highlightings/CSharp/ExceptionNotDocumentedOptionalHighlightingEnhancer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using GammaJul.ReSharper.EnhancedTooltip.DocumentMarkup; | ||
using JetBrains.ProjectModel; | ||
using JetBrains.ReSharper.Psi.CodeAnnotations; | ||
|
||
namespace GammaJul.ReSharper.EnhancedTooltip.Presentation.Highlightings.CSharp { | ||
|
||
using GammaJul.ReSharper.EnhancedTooltip.ExceptionalHighlightings; | ||
using GammaJul.ReSharper.EnhancedTooltip.Utils; | ||
|
||
using JetBrains.Reflection; | ||
using JetBrains.ReSharper.Feature.Services.Daemon; | ||
|
||
[SolutionComponent] | ||
internal sealed class ExceptionNotDocumentedOptionalHighlightingEnhancer : CSharpHighlightingEnhancer<IExceptionNotDocumentedOptionalHighlighting> { | ||
|
||
protected override void AppendTooltip(IExceptionNotDocumentedOptionalHighlighting highlighting, CSharpColorizer colorizer) { | ||
|
||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void AppendTooltip(IHighlighting highlighting, CSharpColorizer colorizer) { | ||
var typeName = highlighting.GetDynamicFieldOrPropertySafe("ExceptionTypeName"); | ||
if (typeName != null) { | ||
colorizer.AppendPlainText("(optional) Exception '"); | ||
colorizer.AppendClassName(typeName.ToString()); | ||
colorizer.AppendPlainText("' is not documented [Exceptional]"); | ||
} else { | ||
colorizer.AppendPlainText(highlighting.ToolTip); | ||
} | ||
} | ||
|
||
public ExceptionNotDocumentedOptionalHighlightingEnhancer( | ||
TextStyleHighlighterManager textStyleHighlighterManager, | ||
CodeAnnotationsConfiguration codeAnnotationsConfiguration, | ||
HighlighterIdProviderFactory highlighterIdProviderFactory) | ||
: base(textStyleHighlighterManager, codeAnnotationsConfiguration, highlighterIdProviderFactory) { | ||
} | ||
|
||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
...EnhancedTooltip/Presentation/Highlightings/CSharp/NullReferenceArgumentWarningEnhancer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using GammaJul.ReSharper.EnhancedTooltip.DocumentMarkup; | ||
using JetBrains.ProjectModel; | ||
using JetBrains.ReSharper.Daemon.CSharp.Errors; | ||
using JetBrains.ReSharper.Psi; | ||
using JetBrains.ReSharper.Psi.CodeAnnotations; | ||
|
||
namespace GammaJul.ReSharper.EnhancedTooltip.Presentation.Highlightings.CSharp { | ||
|
||
[SolutionComponent] | ||
internal sealed class NullReferenceArgumentWarningEnhancer : CSharpHighlightingEnhancer<NullReferenceArgumentWarning> { | ||
|
||
protected override void AppendTooltip(NullReferenceArgumentWarning highlighting, CSharpColorizer colorizer) { | ||
colorizer.AppendPlainText("Possible '"); | ||
colorizer.AppendKeyword("null"); | ||
colorizer.AppendPlainText("' reference argument for parameter '"); | ||
colorizer.AppendParameterName(highlighting.Parameter.ShortName); | ||
colorizer.AppendPlainText("' in '"); | ||
var declaredElement = new DeclaredElementInstance(highlighting.ParametersOwner, highlighting.Parameter.IdSubstitution); | ||
colorizer.AppendDeclaredElement( | ||
declaredElement.Element, | ||
declaredElement.Substitution, | ||
PresenterOptions.QualifiedName, | ||
highlighting.Node); | ||
colorizer.AppendPlainText("'"); | ||
} | ||
|
||
public NullReferenceArgumentWarningEnhancer( | ||
TextStyleHighlighterManager textStyleHighlighterManager, | ||
CodeAnnotationsConfiguration codeAnnotationsConfiguration, | ||
HighlighterIdProviderFactory highlighterIdProviderFactory) | ||
: base(textStyleHighlighterManager, codeAnnotationsConfiguration, highlighterIdProviderFactory) { | ||
} | ||
|
||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
...ooltip/Presentation/Highlightings/CSharp/PossibleNullReferenceExceptionWarningEnhancer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using GammaJul.ReSharper.EnhancedTooltip.DocumentMarkup; | ||
using JetBrains.ProjectModel; | ||
using JetBrains.ReSharper.Daemon.CSharp.Errors; | ||
using JetBrains.ReSharper.Psi; | ||
using JetBrains.ReSharper.Psi.CodeAnnotations; | ||
|
||
namespace GammaJul.ReSharper.EnhancedTooltip.Presentation.Highlightings.CSharp { | ||
|
||
[SolutionComponent] | ||
internal sealed class PossibleNullReferenceExceptionWarningEnhancer : CSharpHighlightingEnhancer<PossibleNullReferenceExceptionWarning> { | ||
|
||
protected override void AppendTooltip(PossibleNullReferenceExceptionWarning highlighting, CSharpColorizer colorizer) { | ||
colorizer.AppendPlainText("Possible '"); | ||
colorizer.AppendNamespaceName("System"); | ||
colorizer.AppendPlainText("."); | ||
colorizer.AppendClassName("NullReferenceException"); | ||
colorizer.AppendPlainText("'"); | ||
} | ||
|
||
public PossibleNullReferenceExceptionWarningEnhancer( | ||
TextStyleHighlighterManager textStyleHighlighterManager, | ||
CodeAnnotationsConfiguration codeAnnotationsConfiguration, | ||
HighlighterIdProviderFactory highlighterIdProviderFactory) | ||
: base(textStyleHighlighterManager, codeAnnotationsConfiguration, highlighterIdProviderFactory) { | ||
} | ||
|
||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
...EnhancedTooltip/Presentation/Highlightings/CSharp/RoslynDiagnosticHighlightingEnhancer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using GammaJul.ReSharper.EnhancedTooltip.DocumentMarkup; | ||
using JetBrains.ProjectModel; | ||
using JetBrains.ReSharper.Psi.CodeAnnotations; | ||
|
||
namespace GammaJul.ReSharper.EnhancedTooltip.Presentation.Highlightings.CSharp { | ||
|
||
using System; | ||
|
||
using JetBrains.PsiFeatures.VisualStudio.Backend.Daemon; | ||
using JetBrains.Reflection; | ||
|
||
[SolutionComponent] | ||
internal sealed class RoslynDiagnosticHighlightingEnhancer : CSharpHighlightingEnhancer<RoslynDiagnosticsDaemonProcess.RoslynDiagnosticHighlighting> { | ||
|
||
protected override void AppendTooltip(RoslynDiagnosticsDaemonProcess.RoslynDiagnosticHighlighting highlighting, CSharpColorizer colorizer) { | ||
var originalTooltip = highlighting.GetDynamicFieldOrProperty("ToolTip").ToString(); | ||
var destinationTooltip = originalTooltip.Replace(highlighting.CompilerId + ": ", String.Empty); | ||
colorizer.AppendPlainText(destinationTooltip); | ||
colorizer.AppendPlainText(" [Roslyn Rule: "); | ||
colorizer.AppendPlainText(highlighting.CompilerId); | ||
colorizer.AppendPlainText("]"); | ||
} | ||
|
||
public RoslynDiagnosticHighlightingEnhancer( | ||
TextStyleHighlighterManager textStyleHighlighterManager, | ||
CodeAnnotationsConfiguration codeAnnotationsConfiguration, | ||
HighlighterIdProviderFactory highlighterIdProviderFactory) | ||
: base(textStyleHighlighterManager, codeAnnotationsConfiguration, highlighterIdProviderFactory) { | ||
} | ||
|
||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
...per.EnhancedTooltip/Presentation/Highlightings/CSharp/UnusedMemberLocalWarningEnhancer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using GammaJul.ReSharper.EnhancedTooltip.DocumentMarkup; | ||
using JetBrains.ProjectModel; | ||
using JetBrains.ReSharper.Psi; | ||
using JetBrains.ReSharper.Psi.CodeAnnotations; | ||
|
||
namespace GammaJul.ReSharper.EnhancedTooltip.Presentation.Highlightings.CSharp { | ||
|
||
using System; | ||
using System.Linq; | ||
using GammaJul.ReSharper.EnhancedTooltip.Psi; | ||
using JetBrains.ReSharper.Daemon.UsageChecking; | ||
|
||
|
||
[SolutionComponent] | ||
internal sealed class UnusedMemberLocalWarningEnhancer : CSharpHighlightingEnhancer<UnusedMemberLocalWarning> { | ||
|
||
protected override void AppendTooltip(UnusedMemberLocalWarning highlighting, CSharpColorizer colorizer) { | ||
var kind = highlighting.Declaration.DeclaredElement.GetElementKindString(false, false, false, false, false); | ||
|
||
colorizer.AppendPlainText(Char.ToUpper(kind.First()) + kind.Substring(1).ToLower()); | ||
colorizer.AppendPlainText(" '"); | ||
colorizer.AppendDeclaredElement( | ||
highlighting.Declaration.DeclaredElement!, | ||
highlighting.Declaration.DeclaredElement.GetIdSubstitutionSafe(), | ||
PresenterOptions.NameOnly, | ||
null); | ||
colorizer.AppendPlainText("' is never used"); | ||
} | ||
|
||
public UnusedMemberLocalWarningEnhancer( | ||
TextStyleHighlighterManager textStyleHighlighterManager, | ||
CodeAnnotationsConfiguration codeAnnotationsConfiguration, | ||
HighlighterIdProviderFactory highlighterIdProviderFactory) | ||
: base(textStyleHighlighterManager, codeAnnotationsConfiguration, highlighterIdProviderFactory) { | ||
} | ||
|
||
} | ||
|
||
} |
8 changes: 6 additions & 2 deletions
8
...maJul.ReSharper.EnhancedTooltip/Presentation/Highlightings/HighlightingEnhancerManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.