Skip to content

Commit

Permalink
Update empty line extension (#20) - Fix settings
Browse files Browse the repository at this point in the history
* Update empty line extension

* Update packages

* Update README.md

Co-authored-by: arnaud7394 <marcille.arnaud@gmail.com>
  • Loading branch information
ArnaudMarcille and Rowtips authored Sep 1, 2022
1 parent d8cd5cd commit 8c5dd90
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 13 deletions.
10 changes: 8 additions & 2 deletions EmptyLineExtension22/EmptyLineExtension22.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DeployExtension>True</DeployExtension>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down Expand Up @@ -122,8 +123,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Community.VisualStudio.VSCT" Version="16.0.29.6" PrivateAssets="all" />
<PackageReference Include="Community.VisualStudio.Toolkit.17" Version="17.0.430" ExcludeAssets="Runtime" />
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.0.5232" />
<PackageReference Include="Community.VisualStudio.Toolkit.17" Version="17.0.451" ExcludeAssets="Runtime">
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.3.2094">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\EmptyLineCommand.png" />
Expand Down
21 changes: 19 additions & 2 deletions EmptyLineExtension22/Packages/AutoFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public sealed class AutoFormat : AsyncPackage
/// Auto formatter instance
/// </summary>
private RunningDocTableEvents plugin;

/// <summary>
/// Is a document update in progress
/// </summary>
Expand Down Expand Up @@ -78,7 +78,7 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
/// <returns></returns>
private async Task OnBeforeSaveAsync(object arg1, EventArgs arg2)
{
if (working)
if (working || !IsAutoFormatEnabled())
{
return;
}
Expand Down Expand Up @@ -106,6 +106,23 @@ private async Task OnBeforeSaveAsync(object arg1, EventArgs arg2)
}
}

/// <summary>
/// Return true if auto format is enabled
/// </summary>
/// <returns></returns>
private bool IsAutoFormatEnabled()
{
try
{
OptionPage optionProperties = (OptionPage)GetDialogPage(typeof(OptionPage));
return optionProperties.IsAutoSaveEnabled;
}
catch (Exception)
{
return false;
}
}

/// <summary>
/// Get the value of AllowedLines property
/// </summary>
Expand Down
14 changes: 7 additions & 7 deletions EmptyLineExtension22/source.extension.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// ------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
// <auto-generated>
// This file was generated by the extension VSIX Synchronizer
// This file was generated by VSIX Synchronizer
// </auto-generated>
// ------------------------------------------------------------------------------
namespace EmptyLineExtension22
{
internal sealed partial class Vsix
{
public const string Id = "EmptyLineExtension22.e3b5b1d7-08a7-4dae-8a8b-d730a5d45620";
public const string Name = "EmptyLineExtension22";
public const string Description = @"Empty VSIX Project.";
public const string Name = "EmptyLine Extension 22";
public const string Description = @"Visual Studio extension for remove empty lines (more than one consecutive empty line)";
public const string Language = "en-US";
public const string Version = "1.0";
public const string Author = "METROPOLIS";
public const string Tags = "";
public const string Version = "2.1";
public const string Author = "Rowtips";
public const string Tags = "Empty Clean lines remove emptyline delete vide ligne supprimer";
}
}
2 changes: 1 addition & 1 deletion EmptyLineExtension22/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?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 Id="EmptyLineExtension22.e3b5b1d7-08a7-4dae-8a8b-d730a5d45620" Version="2.0" Language="en-US" Publisher="Rowtips" />
<Identity Id="EmptyLineExtension22.e3b5b1d7-08a7-4dae-8a8b-d730a5d45620" Version="2.1" Language="en-US" Publisher="Rowtips" />
<DisplayName>EmptyLine Extension 22</DisplayName>
<Description xml:space="preserve">Visual Studio extension for remove empty lines (more than one consecutive empty line)</Description>
<MoreInfo>https://github.com/ArnaudMarcille/EmptyLineExtension</MoreInfo>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Visual Studio extension for remove empty lines (more than one consecutive empty
The extension is available [the marketplace](https://marketplace.visualstudio.com/items?itemName=Mybiblipi.EmptyLineExtention) or directly in Visual studio in *Tools => Extension and Update*

[![marketplace](https://img.shields.io/static/v1?label=Marketplace&message=1.3.2&color=green)](https://marketplace.visualstudio.com/items?itemName=Mybiblipi.EmptyLineExtention)
[![marketplace](https://img.shields.io/static/v1?label=Marketplace&message=VS%202022%20-%202.0.0&color=green)](https://marketplace.visualstudio.com/items?itemName=Mybiblipi.EmptyLineExtension22)
[![marketplace](https://img.shields.io/static/v1?label=Marketplace&message=VS%202022%20-%202.1.0&color=green)](https://marketplace.visualstudio.com/items?itemName=Mybiblipi.EmptyLineExtension22)

## How to use it ?

Expand Down

0 comments on commit 8c5dd90

Please sign in to comment.