From a474c3fbd21565248260b5ccc39b78f766f6d05a Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Tue, 30 Aug 2016 19:02:23 +0100 Subject: [PATCH] Support for ReSharper 2016.2 Fixes StyleCop/StyleCop#55 --- install/StyleCop.nuspec | 7 +- .../BulbItems/Framework/V5BulbItemImpl.cs | 2 +- .../CodeCleanup/Rules/LayoutRules.cs | 24 ++--- .../Framework/ChangeStyleCopRuleAction.cs | 2 +- .../StyleCop.ReSharper.csproj | 93 ++++++++++--------- src/StyleCop.ReSharper/packages.config | 49 +++++----- 6 files changed, 92 insertions(+), 85 deletions(-) diff --git a/install/StyleCop.nuspec b/install/StyleCop.nuspec index 706016b..3673039 100644 --- a/install/StyleCop.nuspec +++ b/install/StyleCop.nuspec @@ -3,12 +3,15 @@ StyleCop.StyleCop StyleCop by JetBrains - 2016.1.4 + 2016.2.0 Matt Ellis, Andy Reeves JetBrains, Matt Ellis StyleCop analyzes C# source code to enforce a set of style and consistency rules. Maintained by JetBrains StyleCop analyzes C# source code to enforce a set of style and consistency rules. This plugin is compatible with StyleCop 4.7.54, and maintained by JetBrains. +• Updated to ReSharper 2016.2 (StyleCop/StyleCop#55) + +From 2016.1.4: • Create SuppressMessage attribute parameters more reliably • Works properly if StyleCop 4.7.49 is already loaded in Visual Studio @@ -43,7 +46,7 @@ From previous releases: https://github.com/StyleCop/StyleCop/blob/master/License.html https://raw.githubusercontent.com/StyleCop/StyleCop/master/logo.png - + StyleCop analysis diff --git a/src/StyleCop.ReSharper/BulbItems/Framework/V5BulbItemImpl.cs b/src/StyleCop.ReSharper/BulbItems/Framework/V5BulbItemImpl.cs index 2f109a5..db241a6 100644 --- a/src/StyleCop.ReSharper/BulbItems/Framework/V5BulbItemImpl.cs +++ b/src/StyleCop.ReSharper/BulbItems/Framework/V5BulbItemImpl.cs @@ -32,7 +32,7 @@ namespace StyleCop.ReSharper.BulbItems.Framework /// /// BulbItem Implementation for ReSharper build items. /// - public abstract class V5BulbItemImpl : BulbItemImpl + public abstract class V5BulbItemImpl : BulbActionBase { /// /// Gets or sets the description of the BulbItem. diff --git a/src/StyleCop.ReSharper/CodeCleanup/Rules/LayoutRules.cs b/src/StyleCop.ReSharper/CodeCleanup/Rules/LayoutRules.cs index 3591c32..e2304ec 100644 --- a/src/StyleCop.ReSharper/CodeCleanup/Rules/LayoutRules.cs +++ b/src/StyleCop.ReSharper/CodeCleanup/Rules/LayoutRules.cs @@ -25,7 +25,6 @@ namespace StyleCop.ReSharper.CodeCleanup.Rules using JetBrains.ReSharper.Psi.CodeStyle; using JetBrains.ReSharper.Psi.CSharp; using JetBrains.ReSharper.Psi.CSharp.CodeStyle; - using JetBrains.ReSharper.Psi.CSharp.Impl.Tree; using JetBrains.ReSharper.Psi.CSharp.Parsing; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.Impl.CodeStyle; @@ -337,25 +336,21 @@ private static void ChainedStatementBlocksMustNotBePrecededByBlankLine(ITreeNode /// private static void CommentsMustBePreceededByBlankLine(ITreeNode node) { - ITreeNode siblingMinus2; - ITreeNode siblingMinus1; - ITreeNode siblingMinus3; - for (ITreeNode currentNode = node; currentNode != null; currentNode = currentNode.NextSibling) { if (currentNode is ICommentNode && !(currentNode is IDocCommentNode)) { if (Utils.IsFirstNodeOnLine(currentNode) && !(currentNode.Parent is ICSharpFile)) { - siblingMinus1 = currentNode.PrevSibling; + ITreeNode siblingMinus1 = currentNode.PrevSibling; if (siblingMinus1 != null) { - siblingMinus2 = siblingMinus1.PrevSibling; + ITreeNode siblingMinus2 = siblingMinus1.PrevSibling; if (siblingMinus2 != null) { - siblingMinus3 = siblingMinus2.PrevSibling; + ITreeNode siblingMinus3 = siblingMinus2.PrevSibling; ITokenNode siblingMinus3Token = siblingMinus3 as ITokenNode; IWhitespaceNode siblingMinus2WhitespaceNode = siblingMinus2 as IWhitespaceNode; @@ -368,7 +363,7 @@ private static void CommentsMustBePreceededByBlankLine(ITreeNode node) continue; } - if (siblingMinus3Token != null && siblingMinus3Token.GetTokenType() == TokenType.LBRACE) + if (siblingMinus3Token != null && siblingMinus3Token.GetTokenType() == CSharpTokenType.LBRACE) { // if we're the start of a code block then don't insert a new line. continue; @@ -380,8 +375,15 @@ private static void CommentsMustBePreceededByBlankLine(ITreeNode node) currentNode.InsertNewLineBefore(); ////CSharpFormatterHelper.FormatterInstance.Format(currentNode.Parent); - ICSharpCodeFormatter codeFormatter = (ICSharpCodeFormatter)CSharpLanguage.Instance.LanguageService().CodeFormatter; - codeFormatter.Format(currentNode.Parent); + LanguageService languageService = CSharpLanguage.Instance.LanguageService(); + if (languageService != null) + { + ICSharpCodeFormatter codeFormatter = (ICSharpCodeFormatter)languageService.CodeFormatter; + if (codeFormatter != null) + { + codeFormatter.Format(currentNode.Parent); + } + } } } } diff --git a/src/StyleCop.ReSharper/QuickFixes/Framework/ChangeStyleCopRuleAction.cs b/src/StyleCop.ReSharper/QuickFixes/Framework/ChangeStyleCopRuleAction.cs index f867ae2..f94b3b1 100644 --- a/src/StyleCop.ReSharper/QuickFixes/Framework/ChangeStyleCopRuleAction.cs +++ b/src/StyleCop.ReSharper/QuickFixes/Framework/ChangeStyleCopRuleAction.cs @@ -26,7 +26,7 @@ namespace StyleCop.ReSharper.QuickFixes.Framework using JetBrains.ReSharper.Feature.Services.Bulbs; using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.TextControl; - using JetBrains.UI.CrossFramework; + using JetBrains.UI.Application; using JetBrains.UI.Icons; /// diff --git a/src/StyleCop.ReSharper/StyleCop.ReSharper.csproj b/src/StyleCop.ReSharper/StyleCop.ReSharper.csproj index 49c73d9..2106952 100644 --- a/src/StyleCop.ReSharper/StyleCop.ReSharper.csproj +++ b/src/StyleCop.ReSharper/StyleCop.ReSharper.csproj @@ -12,7 +12,7 @@ v4.0 512 - 98d5b7c7 + da9b7b31 true @@ -33,6 +33,12 @@ 4 true + + false + + + ..\StyleCop.snk + ..\packages\Antlr2.Runtime.2.7.7.02\lib\antlr.runtime.dll @@ -42,6 +48,10 @@ ..\packages\AsyncBridge.JetBrains.0.1.1.0\lib\net40-Client\AsyncBridge.dll True + + ..\packages\AsyncIO.0.1.18.0\lib\net40\AsyncIO.dll + True + ..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll True @@ -80,8 +90,8 @@ ..\packages\DotNetZip.Reduced.1.9.1.8\lib\net20\Ionic.Zip.Reduced.dll True - - ..\packages\JetBrains.Annotations.10.1.4\lib\net20\JetBrains.Annotations.dll + + ..\packages\JetBrains.Annotations.10.1.5\lib\net\JetBrains.Annotations.dll True @@ -92,10 +102,6 @@ ..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.Compression.Cab.2.0.20140304.0\lib\Microsoft.Deployment.Compression.Cab.dll True - - ..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.WindowsInstaller.2.0.20140821.0\lib\Microsoft.Deployment.WindowsInstaller.dll - True - ..\packages\JetBrains.Platform.Lib.VisualStudio.AnyVs.ShellInterop.PrivateBuild.2.0.20140304.0\lib\Microsoft.VisualStudio.Shell.Interop.dll True @@ -116,12 +122,16 @@ ..\packages\JetBrains.Mono.Posix.0.1\lib\net40\Mono.Posix.dll True + + ..\packages\NetMQ.3.3.3.1\lib\net40\NetMQ.dll + True + ..\packages\Newtonsoft35.Json.7.0.1\lib\net35\Newtonsoft.Json.dll True - - ..\packages\NuGet.Core.2.10.1\lib\net40-Client\NuGet.Core.dll + + ..\packages\NuGet.Core.2.12.0\lib\net40-Client\NuGet.Core.dll True @@ -149,7 +159,6 @@ True - False ..\..\lib\StyleCop.4.7.54\StyleCop.dll @@ -469,53 +478,49 @@ - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + +