Skip to content

Commit 23f2796

Browse files
Hosch250retailcoder
authored andcommitted
Close #1546 (#1548)
1 parent 42636ca commit 23f2796

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

RetailCoder.VBE/UI/Command/IndentCurrentProcedureCommand.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System.Runtime.InteropServices;
2+
using Microsoft.Vbe.Interop;
3+
using Rubberduck.Parsing.VBA;
24
using Rubberduck.Settings;
35
using Rubberduck.SmartIndenter;
46

@@ -7,13 +9,22 @@ namespace Rubberduck.UI.Command
79
[ComVisible(false)]
810
public class IndentCurrentProcedureCommand : CommandBase
911
{
12+
private readonly VBE _vbe;
13+
private readonly RubberduckParserState _state;
1014
private readonly IIndenter _indenter;
1115

12-
public IndentCurrentProcedureCommand(IIndenter indenter)
16+
public IndentCurrentProcedureCommand(VBE vbe, RubberduckParserState state, IIndenter indenter)
1317
{
18+
_vbe = vbe;
19+
_state = state;
1420
_indenter = indenter;
1521
}
1622

23+
public override bool CanExecute(object parameter)
24+
{
25+
return _state.FindSelectedDeclaration(_vbe.ActiveCodePane, true) != null;
26+
}
27+
1728
public override void Execute(object parameter)
1829
{
1930
_indenter.IndentCurrentProcedure();

0 commit comments

Comments
 (0)