Skip to content

Commit

Permalink
Merge pull request #769 from codecadwallader/dev
Browse files Browse the repository at this point in the history
v11.2 (branch renames)
  • Loading branch information
codecadwallader authored Jan 2, 2021
2 parents 50d84a7 + e9a8f09 commit 4ba8ddd
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 80 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
# Changelog

## vNext (11.2)
## vNext (11.3)

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/).

- [ ] Features

- [ ] Fixes

## Previous Releases

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

## 11.2

**2021-01-02**

- [x] Features
- [x] [#692](https://github.com/codecadwallader/codemaid/pull/692) - Remove and sort namespaces now supports XAML - thanks [Apflkuacha](https://github.com/Apflkuacha)!

- [x] Fixes
- [x] [#727](https://github.com/codecadwallader/codemaid/pull/727) - Remove and sort usings fixes - thanks [kyleruddbiz](https://github.com/kyleruddbiz)!

## 11.1

**2019-11-03**
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Guidelines for bug reports:
reported.

2. **Check if the issue has been fixed** — try to reproduce it using the
latest `master` or development branch in the repository.
latest `dev` or development branch in the repository.

3. **Isolate the problem** — ideally create an
[SSCCE](http://www.sscce.org/) and a live example.
Expand Down Expand Up @@ -113,8 +113,8 @@ included in the project:
2. If you cloned a while ago, get the latest changes from upstream:

```bash
git checkout master
git pull upstream master
git checkout dev
git pull upstream dev
```

3. Create a new topic branch (off the main project development branch) to
Expand All @@ -134,7 +134,7 @@ included in the project:
5. Locally merge (or rebase) the upstream development branch into your topic branch:

```bash
git pull [--rebase] upstream master
git pull [--rebase] upstream dev
```

6. Push your topic branch up to your fork:
Expand All @@ -144,7 +144,7 @@ included in the project:
```

7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
with a clear title and description against the `master` branch.
with a clear title and description against the `dev` branch.


## Code guidelines
Expand Down
Binary file modified CodeMaid/Integration/Images/about.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified CodeMaid/Integration/Images/about.xcf
Binary file not shown.
4 changes: 4 additions & 0 deletions CodeMaid/Logic/Cleaning/CodeCleanupManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,10 @@ private void RunCodeCleanupMarkup(Document document)
var textDocument = document.GetTextDocument();

RunExternalFormatting(textDocument);
if (!document.IsExternal())
{
_usingStatementCleanupLogic.RemoveAndSortUsingStatements(textDocument);
}

// Perform file header cleanup.
_fileHeaderLogic.UpdateFileHeader(textDocument);
Expand Down
36 changes: 18 additions & 18 deletions CodeMaid/Logic/Cleaning/UsingStatementCleanupLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,9 @@ public void RemoveAndSortUsingStatements(TextDocument textDocument)
// Capture all existing using statements that should be re-inserted if removed.
const string patternFormat = @"^[ \t]*{0}[ \t]*\r?\n";

var points = (from usingStatement in _usingStatementsToReinsertWhenRemoved.Value
from editPoint in TextDocumentHelper.FindMatches(textDocument, string.Format(patternFormat, usingStatement))
select new { editPoint, text = editPoint.GetLine() }).Reverse().ToList();

// Shift every captured point one character to the right so they will auto-advance
// during new insertions at the start of the line.
foreach (var point in points)
{
point.editPoint.CharRight();
}
var usingStatementsToReinsert = _usingStatementsToReinsertWhenRemoved.Value
.Where(usingStatement => TextDocumentHelper.FirstOrDefaultMatch(textDocument, string.Format(patternFormat, usingStatement)) != null)
.ToList();

if (_package.IDEVersion >= 15)
{
Expand All @@ -91,19 +84,26 @@ from editPoint in TextDocumentHelper.FindMatches(textDocument, string.Format(pat
else
{
_commandHelper.ExecuteCommand(textDocument, "Edit.RemoveUnusedUsings");
_commandHelper.ExecuteCommand(textDocument, "Edit.SortUsings");
}

// Check each using statement point and re-insert it if removed.
foreach (var point in points)
// Ignore any using statements that are still referenced
usingStatementsToReinsert = usingStatementsToReinsert
.Where(usingStatement => TextDocumentHelper.FirstOrDefaultMatch(textDocument, string.Format(patternFormat, usingStatement)) == null)
.ToList();

if (usingStatementsToReinsert.Count > 0)
{
string text = point.editPoint.GetLine();
if (text != point.text)
var point = textDocument.StartPoint.CreateEditPoint();

foreach (string usingStatement in usingStatementsToReinsert)
{
point.editPoint.StartOfLine();
point.editPoint.Insert(point.text);
point.editPoint.Insert(Environment.NewLine);
point.StartOfLine();
point.Insert(usingStatement);
point.Insert(Environment.NewLine);
}

// Now sort without removing to ensure correct ordering.
_commandHelper.ExecuteCommand(textDocument, "Edit.SortUsings");
}
}

Expand Down
2 changes: 1 addition & 1 deletion CodeMaid/source.extension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ static class Vsix
public const string Name = "CodeMaid";
public const string Description = "CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, R, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.";
public const string Language = "en-US";
public const string Version = "11.1";
public const string Version = "11.2";
public const string Author = "Steve Cadwallader";
public const string Tags = "build, code, c#, beautify, cleanup, cleaning, digging, reorganizing, formatting";
}
Expand Down
44 changes: 22 additions & 22 deletions CodeMaid/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Publisher="Steve Cadwallader" Version="11.1" Id="4c82e17d-927e-42d2-8460-b473ac7df316" Language="en-US" />
<DisplayName>CodeMaid</DisplayName>
<Description xml:space="preserve">CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, R, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.</Description>
<MoreInfo>http://www.codemaid.net/</MoreInfo>
<License>LICENSE.txt</License>
<Icon>CodeMaid.png</Icon>
<PreviewImage>CodeMaid_Large.png</PreviewImage>
<Tags>build, code, c#, beautify, cleanup, cleaning, digging, reorganizing, formatting</Tags>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0, 17.0)" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.7.2,)" />
</Dependencies>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,)" DisplayName="Visual Studio core editor" />
</Prerequisites>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
</Assets>
<Metadata>
<Identity Publisher="Steve Cadwallader" Version="11.2" Id="4c82e17d-927e-42d2-8460-b473ac7df316" Language="en-US" />
<DisplayName>CodeMaid</DisplayName>
<Description xml:space="preserve">CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, R, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.</Description>
<MoreInfo>http://www.codemaid.net/</MoreInfo>
<License>LICENSE.txt</License>
<Icon>CodeMaid.png</Icon>
<PreviewImage>CodeMaid_Large.png</PreviewImage>
<Tags>build, code, c#, beautify, cleanup, cleaning, digging, reorganizing, formatting</Tags>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0, 17.0)" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.7.2,)" />
</Dependencies>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,)" DisplayName="Visual Studio core editor" />
</Prerequisites>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
</Assets>
</PackageManifest>
Loading

0 comments on commit 4ba8ddd

Please sign in to comment.