Skip to content

Commit

Permalink
Fix #36
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuinox committed Feb 29, 2024
1 parent a8b32c8 commit e1fff88
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
using Abc.MoqComplete.Services;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.CodeCompletion;
using JetBrains.ReSharper.Feature.Services.CodeCompletion.Infrastructure;
using JetBrains.ReSharper.Feature.Services.CodeCompletion.Infrastructure.LookupItems;
using JetBrains.ReSharper.Feature.Services.CSharp.CodeCompletion.Infrastructure;
using JetBrains.ReSharper.Features.Intellisense.CodeCompletion.CSharp;
using JetBrains.ReSharper.Features.Intellisense.CodeCompletion.CSharp.Rules;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.ExpectedTypes;
using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree;
using JetBrains.ReSharper.Psi.Resources;
using JetBrains.ReSharper.Psi.Util;

Expand Down Expand Up @@ -50,7 +53,16 @@ protected override bool AddLookupItems(CSharpCodeCompletionContext context, IIte
private static ILookupItem GetLookupItem(CSharpCodeCompletionContext context, string proposedCompletion)
{
var lookupItem = CSharpLookupItemFactory.Instance.CreateKeywordLookupItem(context, proposedCompletion, TailType.None, PsiSymbolsThemedIcons.Variable.Id);
lookupItem.WithInitializedRanges(context.CompletionRanges, context.BasicContext);

var node = context.NodeInFile;
while (!(node is ICSharpArgument) && node != null) node = node?.Parent;
if (node != null)
{
var arg = (ICSharpArgument)node;
var range = arg.GetExtendedDocumentRange();
lookupItem.SetRanges(context.CompletionRanges.WithReplaceRange(range));
}

lookupItem.SetTopPriority();
return lookupItem;
}
Expand Down

0 comments on commit e1fff88

Please sign in to comment.