Skip to content

Commit 7273b60

Browse files
Merge remote-tracking branch 'refs/remotes/origin/master' into stable
2 parents 85bc35c + c1d7d7a commit 7273b60

File tree

14 files changed

+241
-112
lines changed

14 files changed

+241
-112
lines changed

CHANGELOG.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## vNext (10.4)
3+
## vNext (10.5)
44

55
These changes have not been released to the Visual Studio marketplace, but (if checked) are available in preview within the [CI build](http://vsixgallery.com/extension/4c82e17d-927e-42d2-8460-b473ac7df316/).
66

@@ -12,17 +12,29 @@ These changes have not been released to the Visual Studio marketplace, but (if c
1212

1313
These are the changes to each version that has been released to the Visual Studio marketplace.
1414

15+
## 10.4
16+
17+
**2017-03-26**
18+
19+
- [x] Features
20+
- [x] [#444](https://github.com/codecadwallader/codemaid/pull/444) - Cleaning: VB now supports many of the same cleanups as C# - thanks [thehutman](https://github.com/thehutman)!
21+
- [x] [#449](https://github.com/codecadwallader/codemaid/pull/449) - Undo a previous pull request for hiding Spade during full screen mode (inconsistent with other extensions) - thanks [iouri-s](https://github.com/iouri-s)!
22+
23+
- [x] Fixes
24+
- [x] [#333](https://github.com/codecadwallader/codemaid/issues/333) - Reorganizing: VB now moves attributes - thanks [thehutman](https://github.com/thehutman)!
25+
- [x] [#440](https://github.com/codecadwallader/codemaid/issues/440) - Cleaning: Exclude *.min.css and *.min.js files by default
26+
1527
## 10.3
1628

1729
**2017-03-26**
1830

1931
- [x] Features
2032
- [x] [#359](https://github.com/codecadwallader/codemaid/pull/359) - Reorganizing: Add option to sort private->public vs. public->private - thanks [ahalassy](https://github.com/ahalassy)!
2133
- [x] [#394](https://github.com/codecadwallader/codemaid/pull/394) - Finding: Add ability to clear solution explorer search before finding - thanks [joeburdick](https://github.com/joeburdick)!
22-
- [x] [#420](https://github.com/codecadwallader/codemaid/issues/420) - Upgraded projects to .NET 4.6.1 and misc. fixes for VS2017 build support
34+
- [x] [#420](https://github.com/codecadwallader/codemaid/pull/420) - Upgraded projects to .NET 4.6.1 and misc. fixes for VS2017 build support
2335

2436
- [x] Fixes
25-
- [x] [#419](https://github.com/codecadwallader/codemaid/issues/419) - Cleaning: Switched using statement cleanup command to workaround VS2017+ReSharper issue that prevented using statement cleanup from activating - thanks [jlbeard84](https://github.com/jlbeard84)!
37+
- [x] [#419](https://github.com/codecadwallader/codemaid/pull/419) - Cleaning: Switched using statement cleanup command to workaround VS2017+ReSharper issue that prevented using statement cleanup from activating - thanks [jlbeard84](https://github.com/jlbeard84)!
2638

2739
## 10.2
2840

CodeMaid/CodeMaidPackage.cs

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace SteveCadwallader.CodeMaid
4444
[ProvideToolWindow(typeof(SpadeToolWindow), MultiInstances = false, Style = VsDockStyle.Tabbed, Orientation = ToolWindowOrientation.Left, Window = EnvDTE.Constants.vsWindowKindSolutionExplorer)]
4545
[ProvideToolWindowVisibility(typeof(SpadeToolWindow), "{F1536EF8-92EC-443C-9ED7-FDADF150DA82}")]
4646
[Guid(PackageGuids.GuidCodeMaidPackageString)] // Package unique GUID.
47-
public sealed class CodeMaidPackage : Package, IVsInstalledProduct, IVsPackageDynamicToolOwner
47+
public sealed class CodeMaidPackage : Package, IVsInstalledProduct
4848
{
4949
#region Fields
5050

@@ -307,46 +307,6 @@ public string GetResourceString(string resourceName)
307307

308308
#endregion IVsInstalledProduct Members
309309

310-
#region IVsPackageDynamicToolOwner members
311-
312-
/// <summary>
313-
/// Allows the package to control whether the tool window should be shown or hidden. This
314-
/// method is called by the shell when the user switches to a different window view or
315-
/// context, for example Design, Debugging, Full Screen, etc.
316-
/// </summary>
317-
/// <returns>
318-
/// If the method succeeds, it returns <see
319-
/// cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
320-
/// </returns>
321-
/// <param name="rguidPersistenceSlot">[in] The GUID of the window.</param>
322-
/// <param name="pfShowTool">[out] true to show the window, otherwise false.</param>
323-
public int QueryShowTool(ref Guid rguidPersistenceSlot, out int pfShowTool)
324-
{
325-
pfShowTool = 1;
326-
327-
if (rguidPersistenceSlot == PackageGuids.GuidCodeMaidToolWindowSpade)
328-
{
329-
var monitorSelection = GetService(typeof(IVsMonitorSelection)) as IVsMonitorSelection;
330-
if (monitorSelection != null)
331-
{
332-
var guidCmdUI = VSConstants.UICONTEXT_FullScreenMode;
333-
uint dwCmdUICookie;
334-
monitorSelection.GetCmdUIContextCookie(ref guidCmdUI, out dwCmdUICookie);
335-
336-
int fActive;
337-
monitorSelection.IsCmdUIContextActive(dwCmdUICookie, out fActive);
338-
if (fActive == 1)
339-
{
340-
pfShowTool = 0;
341-
}
342-
}
343-
}
344-
345-
return VSConstants.S_OK;
346-
}
347-
348-
#endregion IVsPackageDynamicToolOwner members
349-
350310
#region Private Methods
351311

352312
/// <summary>

CodeMaid/Integration/Images/about.png

-189 Bytes
Loading

CodeMaid/Integration/Images/about.xcf

1 Byte
Binary file not shown.

CodeMaid/Logic/Cleaning/CodeCleanupManager.cs

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ private Action<Document> FindCodeCleanupMethod(Document document)
191191
case CodeLanguage.CSharp:
192192
return RunCodeCleanupCSharp;
193193

194+
case CodeLanguage.VisualBasic:
195+
return RunCodeCleanupVB;
196+
194197
case CodeLanguage.CPlusPlus:
195198
case CodeLanguage.CSS:
196199
case CodeLanguage.JavaScript:
@@ -209,7 +212,6 @@ private Action<Document> FindCodeCleanupMethod(Document document)
209212
return RunCodeCleanupMarkup;
210213

211214
case CodeLanguage.FSharp:
212-
case CodeLanguage.VisualBasic:
213215
case CodeLanguage.Unknown:
214216
return RunCodeCleanupGeneric;
215217

@@ -338,6 +340,106 @@ private void RunCodeCleanupCSharp(Document document)
338340
_commentFormatLogic.FormatComments(textDocument);
339341
}
340342

343+
/// <summary>
344+
/// Attempts to run code cleanup on the specified VB.Net document.
345+
/// </summary>
346+
/// <param name="document">The document for cleanup.</param>
347+
private void RunCodeCleanupVB(Document document)
348+
{
349+
var textDocument = document.GetTextDocument();
350+
351+
// Perform any actions that can modify the file code model first.
352+
RunExternalFormatting(textDocument);
353+
if (!document.IsExternal())
354+
{
355+
_usingStatementCleanupLogic.RemoveAndSortUsingStatements(textDocument);
356+
}
357+
358+
// Interpret the document into a collection of elements.
359+
var codeItems = _codeModelManager.RetrieveAllCodeItems(document);
360+
361+
var regions = codeItems.OfType<CodeItemRegion>().ToList();
362+
var usingStatements = codeItems.OfType<CodeItemUsingStatement>().ToList();
363+
var namespaces = codeItems.OfType<CodeItemNamespace>().ToList();
364+
var classes = codeItems.OfType<CodeItemClass>().ToList();
365+
var delegates = codeItems.OfType<CodeItemDelegate>().ToList();
366+
var enumerations = codeItems.OfType<CodeItemEnum>().ToList();
367+
var events = codeItems.OfType<CodeItemEvent>().ToList();
368+
var fields = codeItems.OfType<CodeItemField>().ToList();
369+
var interfaces = codeItems.OfType<CodeItemInterface>().ToList();
370+
var methods = codeItems.OfType<CodeItemMethod>().ToList();
371+
var properties = codeItems.OfType<CodeItemProperty>().ToList();
372+
var structs = codeItems.OfType<CodeItemStruct>().ToList();
373+
374+
// Build up more complicated collections.
375+
var usingStatementBlocks = CodeModelHelper.GetCodeItemBlocks(usingStatements).ToList();
376+
var usingStatementsThatStartBlocks = (from IEnumerable<CodeItemUsingStatement> block in usingStatementBlocks select block.First()).ToList();
377+
var usingStatementsThatEndBlocks = (from IEnumerable<CodeItemUsingStatement> block in usingStatementBlocks select block.Last()).ToList();
378+
379+
// Perform file header cleanup.
380+
_fileHeaderLogic.UpdateFileHeader(textDocument);
381+
382+
// Perform removal cleanup.
383+
_removeRegionLogic.RemoveRegionsPerSettings(regions);
384+
_removeWhitespaceLogic.RemoveEOLWhitespace(textDocument);
385+
_removeWhitespaceLogic.RemoveBlankLinesAtTop(textDocument);
386+
_removeWhitespaceLogic.RemoveBlankLinesAtBottom(textDocument);
387+
_removeWhitespaceLogic.RemoveEOFTrailingNewLine(textDocument);
388+
_removeWhitespaceLogic.RemoveBlankLinesAfterAttributes(textDocument);
389+
_removeWhitespaceLogic.RemoveBlankLinesBetweenChainedStatements(textDocument);
390+
_removeWhitespaceLogic.RemoveMultipleConsecutiveBlankLines(textDocument);
391+
392+
// Perform insertion of blank line padding cleanup.
393+
_insertBlankLinePaddingLogic.InsertPaddingBeforeRegionTags(regions);
394+
_insertBlankLinePaddingLogic.InsertPaddingAfterRegionTags(regions);
395+
396+
_insertBlankLinePaddingLogic.InsertPaddingBeforeEndRegionTags(regions);
397+
_insertBlankLinePaddingLogic.InsertPaddingAfterEndRegionTags(regions);
398+
399+
_insertBlankLinePaddingLogic.InsertPaddingBeforeCodeElements(usingStatementsThatStartBlocks);
400+
_insertBlankLinePaddingLogic.InsertPaddingAfterCodeElements(usingStatementsThatEndBlocks);
401+
402+
_insertBlankLinePaddingLogic.InsertPaddingBeforeCodeElements(namespaces);
403+
_insertBlankLinePaddingLogic.InsertPaddingAfterCodeElements(namespaces);
404+
405+
_insertBlankLinePaddingLogic.InsertPaddingBeforeCodeElements(classes);
406+
_insertBlankLinePaddingLogic.InsertPaddingAfterCodeElements(classes);
407+
408+
_insertBlankLinePaddingLogic.InsertPaddingBeforeCodeElements(delegates);
409+
_insertBlankLinePaddingLogic.InsertPaddingAfterCodeElements(delegates);
410+
411+
_insertBlankLinePaddingLogic.InsertPaddingBeforeCodeElements(enumerations);
412+
_insertBlankLinePaddingLogic.InsertPaddingAfterCodeElements(enumerations);
413+
414+
_insertBlankLinePaddingLogic.InsertPaddingBeforeCodeElements(events);
415+
_insertBlankLinePaddingLogic.InsertPaddingAfterCodeElements(events);
416+
417+
_insertBlankLinePaddingLogic.InsertPaddingBeforeCodeElements(fields);
418+
_insertBlankLinePaddingLogic.InsertPaddingAfterCodeElements(fields);
419+
420+
_insertBlankLinePaddingLogic.InsertPaddingBeforeCodeElements(interfaces);
421+
_insertBlankLinePaddingLogic.InsertPaddingAfterCodeElements(interfaces);
422+
423+
_insertBlankLinePaddingLogic.InsertPaddingBeforeCodeElements(methods);
424+
_insertBlankLinePaddingLogic.InsertPaddingAfterCodeElements(methods);
425+
426+
_insertBlankLinePaddingLogic.InsertPaddingBeforeCodeElements(properties);
427+
_insertBlankLinePaddingLogic.InsertPaddingBetweenMultiLinePropertyAccessors(properties);
428+
_insertBlankLinePaddingLogic.InsertPaddingAfterCodeElements(properties);
429+
430+
_insertBlankLinePaddingLogic.InsertPaddingBeforeCodeElements(structs);
431+
_insertBlankLinePaddingLogic.InsertPaddingAfterCodeElements(structs);
432+
433+
_insertBlankLinePaddingLogic.InsertPaddingBeforeCaseStatements(textDocument);
434+
_insertBlankLinePaddingLogic.InsertPaddingBeforeSingleLineComments(textDocument);
435+
436+
// Perform insertion of whitespace cleanup.
437+
_insertWhitespaceLogic.InsertEOFTrailingNewLine(textDocument);
438+
439+
// Perform comment cleaning.
440+
_commentFormatLogic.FormatComments(textDocument);
441+
}
442+
341443
/// <summary>
342444
/// Attempts to run code cleanup on the specified C/C++ document.
343445
/// </summary>

CodeMaid/Model/CodeItems/BaseCodeItemElement.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ protected BaseCodeItemElement()
4040
/// <summary>
4141
/// Gets the start point adjusted for leading comments, may be null.
4242
/// </summary>
43-
public override EditPoint StartPoint => CodeElement != null ? GetStartPointAdjustedForComments(CodeElement.StartPoint) : null;
43+
public override EditPoint StartPoint => CodeElement != null ? GetStartPointAdjustedForComments(CodeElement.GetStartPoint()) : null;
4444

4545
/// <summary>
4646
/// Gets the end point, may be null.
4747
/// </summary>
48-
public override EditPoint EndPoint => CodeElement?.EndPoint.CreateEditPoint();
48+
public override EditPoint EndPoint => CodeElement?.GetEndPoint().CreateEditPoint();
4949

5050
/// <summary>
5151
/// Loads all lazy initialized values immediately.
@@ -66,10 +66,13 @@ public override void LoadLazyInitializedValues()
6666
/// </summary>
6767
public override void RefreshCachedPositionAndName()
6868
{
69-
StartLine = CodeElement.StartPoint.Line;
70-
StartOffset = CodeElement.StartPoint.AbsoluteCharOffset;
71-
EndLine = CodeElement.EndPoint.Line;
72-
EndOffset = CodeElement.EndPoint.AbsoluteCharOffset;
69+
var startPoint = CodeElement.GetStartPoint();
70+
var endPoint = CodeElement.GetEndPoint();
71+
72+
StartLine = startPoint.Line;
73+
StartOffset = startPoint.AbsoluteCharOffset;
74+
EndLine = endPoint.Line;
75+
EndOffset = endPoint.AbsoluteCharOffset;
7376
Name = CodeElement.Name;
7477
}
7578

CodeMaid/Model/CodeItems/CodeItemUsingStatement.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ public CodeItemUsingStatement()
3636
/// </remarks>
3737
public override void RefreshCachedPositionAndName()
3838
{
39-
StartLine = CodeElement.StartPoint.Line;
40-
StartOffset = CodeElement.StartPoint.AbsoluteCharOffset;
41-
EndLine = CodeElement.EndPoint.Line;
42-
EndOffset = CodeElement.EndPoint.AbsoluteCharOffset;
39+
var startPoint = CodeElement.GetStartPoint();
40+
var endPoint = CodeElement.GetEndPoint();
41+
42+
StartLine = startPoint.Line;
43+
StartOffset = startPoint.AbsoluteCharOffset;
44+
EndLine = endPoint.Line;
45+
EndOffset = endPoint.AbsoluteCharOffset;
4346
}
4447

4548
#endregion BaseCodeItem Overrides

CodeMaid/Properties/Settings.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CodeMaid/Properties/Settings.settings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<Value Profile="(Default)">True</Value>
1313
</Setting>
1414
<Setting Name="Cleaning_ExclusionExpression" Type="System.String" Scope="User">
15-
<Value Profile="(Default)">\.Designer\.cs$||\.Designer\.vb$||\.resx$</Value>
15+
<Value Profile="(Default)">\.Designer\.cs$||\.Designer\.vb$||\.resx$||\.min\.css$||\.min\.js$</Value>
1616
</Setting>
1717
<Setting Name="Cleaning_IncludeCPlusPlus" Type="System.Boolean" Scope="User">
1818
<Value Profile="(Default)">True</Value>

0 commit comments

Comments
 (0)