Permalink
Browse files

Address @Vogel612's comments.

  • Loading branch information...
IvenBach committed Nov 26, 2017
1 parent 8147beb commit 2a21d5cf63cdf90fe5fa604df46eb03fcbc85e8a
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using NLog;
@@ -18,7 +17,6 @@
using Rubberduck.UI.Command.MenuItems;
using Rubberduck.VBEditor;
using Rubberduck.VBEditor.SafeComWrappers;
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
using System.Windows;
// ReSharper disable CanBeReplacedWithTryCastAndCheckForNull
@@ -479,8 +477,7 @@ private void SetErrorState(CodeExplorerItemViewModel itemNode, QualifiedModuleNa
private void ExecuteCollapseNodes(object parameter)
{
var node = parameter as CodeExplorerItemViewModel;
if (node == null)
if (!(parameter is CodeExplorerItemViewModel node))
{
return;
}
@@ -490,8 +487,7 @@ private void ExecuteCollapseNodes(object parameter)
private void ExecuteExpandNodes(object parameter)
{
var node = parameter as CodeExplorerItemViewModel;
if (node == null)
if (!(parameter is CodeExplorerItemViewModel node))
{
return;
}
@@ -558,7 +554,7 @@ private void ExecuteRemoveComand(object param)
private bool CanExecuteExportAllCommand => ExportAllCommand.CanExecute(SelectedItem);
public Visibility ExportVisibility => CanExecuteExportAllCommand == false ? Visibility.Visible : Visibility.Collapsed;
public Visibility ExportVisibility => CanExecuteExportAllCommand ? Visibility.Collapsed : Visibility.Visible;
public Visibility ExportAllVisibility => CanExecuteExportAllCommand ? Visibility.Visible : Visibility.Collapsed;
@@ -35,7 +35,9 @@ public RegexSearchReplace(IVBE vbe, IParseCoordinator parser)
public IEnumerable<RegexSearchResult> Search(string searchPattern, RegexSearchReplaceScope scope = RegexSearchReplaceScope.CurrentFile)
{
return _search.TryGetValue(scope, out var searchFunc) ? searchFunc.Invoke(searchPattern) : new List<RegexSearchResult>();
return _search.TryGetValue(scope, out var searchFunc)
? searchFunc.Invoke(searchPattern)
: new List<RegexSearchResult>();
}
public void Replace(string searchPattern, string replaceValue, RegexSearchReplaceScope scope)
@@ -11,10 +11,8 @@ public class PropertyGenerator
public bool GenerateLetter { get; set; }
public bool GenerateSetter { get; set; }
public string AllPropertyCode => string.Format("{0}{1}{2}",
GetterCode,
(GenerateLetter ? LetterCode : string.Empty),
(GenerateSetter ? SetterCode : string.Empty));
public string AllPropertyCode =>
$"{GetterCode}{(GenerateLetter ? LetterCode : string.Empty)}{(GenerateSetter ? SetterCode : string.Empty)}";
public string GetterCode
{
@@ -32,7 +32,9 @@ public ExtractInterfacePresenter Create()
}
var model = new ExtractInterfaceModel(_state, selection.Value);
return model.Members.Any() ? new ExtractInterfacePresenter(_view, model) : null;
// don't show the UI if there's no memeber to extract
return model.Members.Any() ? new ExtractInterfacePresenter(_view, model) : null;
}
}
}
@@ -44,12 +44,7 @@ public string FullMemberSignature
{
get
{
//var signature = MemberType + " " + Member.IdentifierName + "(" +
// string.Join(", ", MemberParams) + ")";
var signature = string.Format("{0} {1}({2})",
MemberType,
Member.IdentifierName,
string.Join(", ", MemberParams));
var signature = $"{MemberType} {Member.IdentifierName}({string.Join(", ", MemberParams)})";
return Type == null ? signature : $"{signature} As {Type}";
}
@@ -178,7 +178,7 @@ private void UpdateSignature(Declaration targetVariable)
.Where(item => item.ProjectId == interfaceImplementation.ProjectId
&&
item.IdentifierName ==
interfaceImplementation.ComponentName + "_" + interfaceImplementation.IdentifierName
$"{interfaceImplementation.ComponentName}_{interfaceImplementation.IdentifierName}"
&& !item.Equals(functionDeclaration));
foreach (var implementation in interfaceImplementations)
@@ -200,7 +200,7 @@ private void AddParameter(Declaration targetMethod, Declaration targetVariable,
_rewriters.Add(rewriter);
var argList = paramList.arg();
var newParameter = Tokens.ByVal + " " + targetVariable.IdentifierName + " " + Tokens.As + " " + targetVariable.AsTypeName;
var newParameter = $"{Tokens.ByVal} {targetVariable.IdentifierName} {Tokens.As} {targetVariable.AsTypeName}";
if (!argList.Any())
{

0 comments on commit 2a21d5c

Please sign in to comment.