Skip to content

Commit

Permalink
Support for ReSharper 2016.2
Browse files Browse the repository at this point in the history
  • Loading branch information
citizenmatt committed Aug 30, 2016
1 parent 2729559 commit a474c3f
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 85 deletions.
7 changes: 5 additions & 2 deletions install/StyleCop.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
<metadata>
<id>StyleCop.StyleCop</id>
<title>StyleCop by JetBrains</title>
<version>2016.1.4</version>
<version>2016.2.0</version>
<authors>Matt Ellis, Andy Reeves</authors>
<owners>JetBrains, Matt Ellis</owners>
<summary>StyleCop analyzes C# source code to enforce a set of style and consistency rules. Maintained by JetBrains</summary>
<description>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.</description>
<releaseNotes>
&#8226; Updated to ReSharper 2016.2 (StyleCop/StyleCop#55)

From 2016.1.4:
&#8226; Create SuppressMessage attribute parameters more reliably
&#8226; Works properly if StyleCop 4.7.49 is already loaded in Visual Studio

Expand Down Expand Up @@ -43,7 +46,7 @@ From previous releases:
<licenseUrl>https://github.com/StyleCop/StyleCop/blob/master/License.html</licenseUrl>
<iconUrl>https://raw.githubusercontent.com/StyleCop/StyleCop/master/logo.png</iconUrl>
<dependencies>
<dependency id="Wave" version="[5.0]" />
<dependency id="Wave" version="[6.0]" />
</dependencies>
<tags>StyleCop analysis</tags>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace StyleCop.ReSharper.BulbItems.Framework
/// <summary>
/// BulbItem Implementation for ReSharper build items.
/// </summary>
public abstract class V5BulbItemImpl : BulbItemImpl
public abstract class V5BulbItemImpl : BulbActionBase
{
/// <summary>
/// Gets or sets the description of the BulbItem.
Expand Down
24 changes: 13 additions & 11 deletions src/StyleCop.ReSharper/CodeCleanup/Rules/LayoutRules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -337,25 +336,21 @@ private static void ChainedStatementBlocksMustNotBePrecededByBlankLine(ITreeNode
/// </param>
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;
Expand All @@ -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;
Expand All @@ -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);
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
Expand Down
Loading

0 comments on commit a474c3f

Please sign in to comment.