Skip to content

Commit

Permalink
Fixed parameter info sometimes not working. Fixes #43
Browse files Browse the repository at this point in the history
  • Loading branch information
MrJul committed Aug 20, 2015
1 parent cce0e2d commit 6f34598
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

<metadata>
<id>JLebosquain.EnhancedTooltip</id>
<version>2.5.0.13</version>
<version>2.5.1.14</version>
<title>Enhanced Tooltip</title>
<authors>Julien Lebosquain</authors>
<description>Colorizes the tooltip as well as the parameter information popup.</description>
<releaseNotes>
- [Added] Support for ReSharper 9.2.
- [Fixed] Parameter info colorization sometimes not working. (#43)
</releaseNotes>
<projectUrl>https://github.com/MrJul/ReSharper.EnhancedTooltip/</projectUrl>
<iconUrl>https://raw.github.com/MrJul/ReSharper.EnhancedTooltip/master/Logo/Logo128.png</iconUrl>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
using System.Collections.Generic;
using System.Linq;
using GammaJul.ReSharper.EnhancedTooltip.Presentation;
using GammaJul.ReSharper.EnhancedTooltip.Presentation;
using GammaJul.ReSharper.EnhancedTooltip.Settings;
using JetBrains.Annotations;
using JetBrains.Application.Settings;
using JetBrains.DocumentModel;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.CSharp.ParameterInfo;
using JetBrains.ReSharper.Feature.Services.ParameterInfo;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Resources.Shell;
using JetBrains.Util;
using JetBrains.Util.Lazy;

namespace GammaJul.ReSharper.EnhancedTooltip.ParameterInfo {

Expand All @@ -25,21 +20,16 @@ namespace GammaJul.ReSharper.EnhancedTooltip.ParameterInfo {
/// - <see cref="ParameterInfoCandidate"/> (overridden by <see cref="EnhancedParameterInfoCandidate"/>)
/// </remarks>
[ParameterInfoContextFactory(typeof(CSharpLanguage))]
public class EnhancedParameterInfoContextFactory : IParameterInfoContextFactory {
public class EnhancedParameterInfoContextFactory : CSParameterInfoContextFactory, IParameterInfoContextFactory {

[NotNull] [ItemCanBeNull] private readonly Lazy<IParameterInfoContextFactory> _csParameterInfoContextFactory;

public bool IsIntellisenseEnabled(ISolution solution, IContextBoundSettingsStore contextBoundSettingsStore)
=> _csParameterInfoContextFactory.Value?.IsIntellisenseEnabled(solution, contextBoundSettingsStore) == true;

public IParameterInfoContext CreateContext(ISolution solution,
public new IParameterInfoContext CreateContext(ISolution solution,
IDocument document,
int caretOffset,
int expectedLParenthOffset,
char invocationChar,
IContextBoundSettingsStore contextBoundSettingsStore) {

IParameterInfoContext context = _csParameterInfoContextFactory.Value?.CreateContext(
IParameterInfoContext context = base.CreateContext(
solution, document, caretOffset, expectedLParenthOffset, invocationChar, contextBoundSettingsStore);
return Enhance(context, solution, contextBoundSettingsStore);
}
Expand All @@ -56,22 +46,6 @@ private static IParameterInfoContext Enhance([CanBeNull] IParameterInfoContext c
settings);
}

public bool ShouldPopup(IDocument document, int caretOffset, char c, ISolution solution, IContextBoundSettingsStore contextBoundSettingsStore)
=> _csParameterInfoContextFactory.Value?.ShouldPopup(document, caretOffset, c, solution, contextBoundSettingsStore) == true;

public PsiLanguageType Language
=> CSharpLanguage.Instance;

public IEnumerable<char> ImportantChars
=> _csParameterInfoContextFactory.Value?.ImportantChars ?? EmptyList<char>.InstanceList;

public EnhancedParameterInfoContextFactory() {
_csParameterInfoContextFactory =
Lazy.Of(() => Shell.Instance.GetComponent<ILanguageManager>()
.GetServices<IParameterInfoContextFactory>(Language)
.FirstOrDefault(f => f.GetType().Name == "CSParameterInfoContextFactory" /* unfortunately the original factory is internal so we can't use typeof */));
}

}

}
2 changes: 1 addition & 1 deletion SharedAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("2.5.0.0")]
[assembly: AssemblyVersion("2.5.1.0")]

0 comments on commit 6f34598

Please sign in to comment.