Skip to content

Commit 0f2472b

Browse files
committed
- Removed unncessary code
1 parent cb1e244 commit 0f2472b

File tree

2 files changed

+3
-22
lines changed

2 files changed

+3
-22
lines changed

Codist/SmartBars/CSharpSmartBar.cs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void AddCommandsForNode() {
9494
else {
9595
AddCommand(MyToolBar, KnownMonikers.CommentCode, "Comment selection\nRight click: Comment line", ctx => {
9696
if (ctx.RightClick) {
97-
TextEditorHelper.ExpandSelectionToLine(View);
97+
View.ExpandSelectionToLine();
9898
}
9999
TextEditorHelper.ExecuteEditorCommand("Edit.CommentSelection");
100100
});
@@ -137,25 +137,6 @@ void AddCommand(ImageMoniker moniker, string tooltip, Action<ITextEdit> editComm
137137
});
138138
}
139139

140-
void ExpandSelection() {
141-
if (UpdateSemanticModel() == false) {
142-
return;
143-
}
144-
do {
145-
if (_Node.FullSpan.Contains(View.Selection, false)
146-
&& (_Node.IsSyntaxBlock() || _Node.IsDeclaration())) {
147-
if ((_Node.HasLeadingTrivia || _Node.HasTrailingTrivia)
148-
&& _Node.Span.Contains(View.Selection, false)) {
149-
View.Selection.Select(new SnapshotSpan(View.TextSnapshot, _Node.Span.Start, _Node.Span.Length), false);
150-
}
151-
else {
152-
View.Selection.Select(new SnapshotSpan(View.TextSnapshot, _Node.FullSpan.Start, _Node.FullSpan.Length), false);
153-
}
154-
return;
155-
}
156-
} while ((_Node = _Node.Parent) != null);
157-
}
158-
159140
bool UpdateSemanticModel() {
160141
var workspace = View.TextBuffer.GetWorkspace();
161142
_SemanticModel = workspace.GetDocument(View.Selection.SelectedSpans[0]).GetSemanticModelAsync().Result;

Codist/SmartBars/SmartBar.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public SmartBar(IWpfTextView view, int iconSize) {
4141
View.Selection.SelectionChanged += ViewSelectionChanged;
4242
View.Closed += ViewClosed;
4343
ToolBar = new ToolBar { BorderThickness = new Thickness(1), BorderBrush = Brushes.Gray, Band = 1, IsOverflowOpen = false }.HideOverflow();
44-
ToolBar2 = new ToolBar { BorderThickness = new Thickness(1), Background = Brushes.LightGray, BorderBrush = Brushes.Gray, Band = 2, IsOverflowOpen = false }.HideOverflow();
44+
ToolBar2 = new ToolBar { BorderThickness = new Thickness(1), BorderBrush = Brushes.Gray, Band = 2, IsOverflowOpen = false }.HideOverflow();
4545
_ToolBarTray = new ToolBarTray() {
4646
ToolBars = { ToolBar, ToolBar2 },
4747
IsLocked = true,
@@ -267,7 +267,7 @@ protected void AddEditorCommand(ToolBar toolBar, ImageMoniker moniker, string co
267267
if (CodistPackage.DTE.Commands.Item(command).IsAvailable) {
268268
AddCommand(toolBar, moniker, tooltip, (ctx) => {
269269
TextEditorHelper.ExecuteEditorCommand(ctx.RightClick ? command2 : command);
270-
View.Selection.Clear();
270+
//View.Selection.Clear();
271271
});
272272
}
273273
}

0 commit comments

Comments
 (0)