Skip to content

Commit

Permalink
Upgrade ReSharper SDK to 2017.2
Browse files Browse the repository at this point in the history
  • Loading branch information
olsh committed Aug 24, 2017
1 parent 6ba0baf commit 06eed2d
Show file tree
Hide file tree
Showing 16 changed files with 179 additions and 189 deletions.
10 changes: 4 additions & 6 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#addin "Cake.ExtendedNuGet"
#addin "nuget:?package=NuGet.Core&version=2.8.6"

var target = Argument("target", "Default");
var buildConfiguration = Argument("buildConfig", "Debug");
var extensionsVersion = Argument("version", "2017.1.2");
var waveVersion = Argument("wave", "[8.0]");
var extensionsVersion = Argument("version", "2017.2.0");
var waveVersion = Argument("wave", "[9.0]");

var projectName = "Resharper.ConfigurationSense";
var solutionFile = string.Format("./src/{0}.sln", projectName);
Expand Down Expand Up @@ -88,7 +85,8 @@ Task("NugetPack")
NoPackageAnalysis = true,
Files = files,
OutputDirectory = ".",
Dependencies = new [] { new NuSpecDependency() { Id = "Wave", Version = waveVersion } }
Dependencies = new [] { new NuSpecDependency() { Id = "Wave", Version = waveVersion } },
ReleaseNotes = new [] { "https://github.com/olsh/resharper-configuration-sense/releases" }
};
NuGetPack(nuGetPackSettings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using JetBrains.DocumentModel;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.CodeCompletion.Infrastructure;
using JetBrains.ReSharper.Feature.Services.CSharp.CodeCompletion.Infrastructure;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.Util;

Expand All @@ -25,7 +24,7 @@ public GenericSettingsSuggestionProvider(ProjectModelElementPresentationService
}

public LinkedList<KeyValueSettingLookupItem> GetJsonSettingsLookupItems(
CSharpCodeCompletionContext context,
ISpecificCodeCompletionContext context,
JsonSettingType settingType,
string jsonPath = null)
{
Expand All @@ -44,7 +43,7 @@ public LinkedList<KeyValueSettingLookupItem> GetJsonSettingsLookupItems(
}

public LinkedList<KeyValueSettingLookupItem> GetXmlSettingsLookupItems(
CSharpCodeCompletionContext context,
ISpecificCodeCompletionContext context,
string settingsTagName,
string settingsKeyAttribute,
string settingsValueAttributes)
Expand All @@ -64,7 +63,7 @@ public LinkedList<KeyValueSettingLookupItem> GetXmlSettingsLookupItems(
}

private LinkedList<KeyValueSettingLookupItem> CreateLookupItems(
CSharpCodeCompletionContext context,
ISpecificCodeCompletionContext context,
IEnumerable<KeyValueSetting> settings,
IProjectModelElement project,
IRangeMarker rangeMarker,
Expand All @@ -85,7 +84,7 @@ private LinkedList<KeyValueSettingLookupItem> CreateLookupItems(
private IRangeMarker CreateRangeMarker(ISpecificCodeCompletionContext context)
{
var rangeMarker =
new TextRange(context.BasicContext.CaretDocumentRange.TextRange.StartOffset).CreateRangeMarker(
new TextRange(context.BasicContext.CaretDocumentOffset.Offset).CreateRangeMarker(
context.BasicContext.Document);
return rangeMarker;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System.Collections.Generic;

using JetBrains.ReSharper.Feature.Services.CSharp.CodeCompletion.Infrastructure;

using JetBrains.ReSharper.Feature.Services.CodeCompletion.Infrastructure;
using Resharper.ConfigurationSense.Constants;
using Resharper.ConfigurationSense.Models;

Expand All @@ -10,12 +8,12 @@ namespace Resharper.ConfigurationSense.Components
public interface IGenericSettingsProvider
{
LinkedList<KeyValueSettingLookupItem> GetJsonSettingsLookupItems(
CSharpCodeCompletionContext context,
ISpecificCodeCompletionContext context,
JsonSettingType settingType,
string jsonPath = null);

LinkedList<KeyValueSettingLookupItem> GetXmlSettingsLookupItems(
CSharpCodeCompletionContext context,
ISpecificCodeCompletionContext context,
string settingsTagName,
string settingsKeyAttribute,
string settingsValueAttributes);
Expand Down
26 changes: 12 additions & 14 deletions src/Resharper.ConfigurationSense/Extensions/RangeExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System;
using System.Linq;

using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.CodeCompletion.Infrastructure;
using JetBrains.ReSharper.Feature.Services.CSharp.CodeCompletion.Infrastructure;
using JetBrains.ReSharper.Psi.CSharp.Util.Literals;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.Util;

namespace Resharper.ConfigurationSense.Extensions
{
Expand All @@ -14,26 +12,26 @@ public static class RangeExtensions
public static TextLookupRanges EvaluateRanges(this ISpecificCodeCompletionContext context)
{
var basicContext = context.BasicContext;
var selectedRange = basicContext.SelectedRange.TextRange;
var documentRange = basicContext.CaretDocumentRange.TextRange;

var startOffset = basicContext.CaretDocumentOffset;
var endOffset = basicContext.SelectedRange.EndOffset;

var caretTreeOffset = basicContext.CaretTreeOffset;
var tokenNode = basicContext.File.FindTokenAt(caretTreeOffset) as ITokenNode;

if ((tokenNode != null) && tokenNode.IsAnyStringLiteral())
if (basicContext.File.FindTokenAt(caretTreeOffset) is ITokenNode tokenNode && tokenNode.IsAnyStringLiteral())
{
documentRange = tokenNode.GetDocumentRange().TextRange;
startOffset = tokenNode.GetDocumentStartOffset();
endOffset = tokenNode.GetDocumentEndOffset();
}

var replaceRange = new TextRange(
documentRange.StartOffset,
Math.Max(documentRange.EndOffset, selectedRange.EndOffset));
var replaceRange = new DocumentRange(startOffset, endOffset);

return new TextLookupRanges(replaceRange, replaceRange);
}

public static bool IsInsideAccessorPath(this ISpecificCodeCompletionContext context, string path)
{
var nodeAt = context.BasicContext.File.FindNodeAt(context.BasicContext.CaretDocumentRange);
var nodeAt = context.BasicContext.File.FindNodeAt(context.BasicContext.CaretDocumentOffset);

var accessorPath = nodeAt.GetAccessorPath();
if (accessorPath == null)
Expand All @@ -46,7 +44,7 @@ public static bool IsInsideAccessorPath(this ISpecificCodeCompletionContext cont

public static bool IsInsideMethodPath(this ISpecificCodeCompletionContext context, string path)
{
var nodeAt = context.BasicContext.File.FindNodeAt(context.BasicContext.CaretDocumentRange);
var nodeAt = context.BasicContext.File.FindNodeAt(context.BasicContext.CaretDocumentOffset);

var accessorPath = nodeAt.GetMethodPath();
if (accessorPath == null)
Expand All @@ -59,7 +57,7 @@ public static bool IsInsideMethodPath(this ISpecificCodeCompletionContext contex

public static bool IsInsideAccessorType(this ISpecificCodeCompletionContext context, string accessorType)
{
var nodeAt = context.BasicContext.File.FindNodeAt(context.BasicContext.CaretDocumentRange);
var nodeAt = context.BasicContext.File.FindNodeAt(context.BasicContext.CaretDocumentOffset);

var accessorClrType = nodeAt.GetAccessorSuperTypes();
if (accessorClrType == null)
Expand Down
4 changes: 2 additions & 2 deletions src/Resharper.ConfigurationSense/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
using System.Reflection;

[assembly: AssemblyTitle("Resharper.ConfigurationSense")]
[assembly: AssemblyVersion("2017.1.2")]
[assembly: AssemblyFileVersion("2017.1.2")]
[assembly: AssemblyVersion("2017.2.0")]
[assembly: AssemblyFileVersion("2017.2.0")]

Loading

0 comments on commit 06eed2d

Please sign in to comment.