Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
madskristensen committed Jun 8, 2017
1 parent 944bbdd commit c5c476e
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 69 deletions.
79 changes: 79 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# EditorConfig is awesome:http://EditorConfig.org

# top-most EditorConfig file
root = true

# Don't use tabs for indentation.
[*]
indent_style = space
end_of_line = crlf
# (Please don't specify an indent_size here; that has too many unintended consequences.)

# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

# JSON files
[*.json]
indent_size = 2

# Dotnet code style settings:
[*.{cs, vb}]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion

# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion

# CSharp code style settings:
[*.cs]
# Prefer "var" everywhere
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = false:suggestion

# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none

# Prefer property-like constructs to have an expression-body
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none

# Suggest more modern language features when available
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

# Newline settings
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
53 changes: 0 additions & 53 deletions src/Helpers/Logger.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/Installer/DataStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private void Initialize()

private void UpdateRegistry()
{
var uninstall = string.Join(";", Log.Where(l => l.Action == _uninstalled).Select(l => l.Id));
string uninstall = string.Join(";", Log.Where(l => l.Action == _uninstalled).Select(l => l.Id));

using (_key.CreateSubKey(Constants.RegistrySubKey))
{
Expand Down
17 changes: 8 additions & 9 deletions src/Installer/Installer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ public async Task ResetAsync(Version vsVersion, IVsExtensionRepository repositor

public async Task RunAsync(Version vsVersion, IVsExtensionRepository repository, IVsExtensionManager manager, CancellationToken cancellationToken)
{
var toUninstall = GetExtensionsMarkedForDeletion(vsVersion);
IEnumerable<ExtensionEntry> toUninstall = GetExtensionsMarkedForDeletion(vsVersion);
await UninstallAsync(toUninstall, repository, manager, cancellationToken);

var toInstall = GetMissingExtensions(manager).Except(toUninstall);
IEnumerable<ExtensionEntry> toInstall = GetMissingExtensions(manager).Except(toUninstall);
await InstallAsync(toInstall, repository, manager, cancellationToken);
}

Expand All @@ -73,7 +73,7 @@ await Task.Run(() =>
{
try
{
foreach (var extension in extensions)
foreach (ExtensionEntry extension in extensions)
{
if (token.IsCancellationRequested)
return;
Expand Down Expand Up @@ -101,16 +101,15 @@ await Task.Run(() =>
{
try
{
foreach (var ext in extensions)
foreach (ExtensionEntry ext in extensions)
{
if (token.IsCancellationRequested)
return;
IInstalledExtension installedExtension;
try
{
if (manager.TryGetInstalledExtension(ext.Id, out installedExtension))
if (manager.TryGetInstalledExtension(ext.Id, out IInstalledExtension installedExtension))
{
manager.Uninstall(installedExtension);
Store.MarkUninstalled(ext);
Expand Down Expand Up @@ -143,7 +142,7 @@ private void InstallExtension(ExtensionEntry extension, IVsExtensionRepository r

if (entry != null)
{
var installable = repository.Download(entry);
IInstallableExtension installable = repository.Download(entry);
manager.Install(installable, false);
Telemetry.Install(extension.Id, true);
}
Expand All @@ -163,8 +162,8 @@ private void InstallExtension(ExtensionEntry extension, IVsExtensionRepository r

private IEnumerable<ExtensionEntry> GetMissingExtensions(IVsExtensionManager manager)
{
var installed = manager.GetInstalledExtensions();
var notInstalled = LiveFeed.Extensions.Where(ext => !installed.Any(ins => ins.Header.Identifier == ext.Id));
IEnumerable<IInstalledExtension> installed = manager.GetInstalledExtensions();
IEnumerable<ExtensionEntry> notInstalled = LiveFeed.Extensions.Where(ext => !installed.Any(ins => ins.Header.Identifier == ext.Id));

return notInstalled.Where(ext => !Store.HasBeenInstalled(ext.Id));
}
Expand Down
4 changes: 2 additions & 2 deletions src/Installer/LiveFeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ internal async Task ParseAsync()
string json = await reader.ReadToEndAsync();
var root = JObject.Parse(json);

foreach (var obj in root.Children<JProperty>())
foreach (JProperty obj in root.Children<JProperty>())
{
var child = obj.Children<JProperty>();
JEnumerable<JProperty> child = obj.Children<JProperty>();

var entry = new ExtensionEntry()
{
Expand Down
6 changes: 3 additions & 3 deletions src/VSPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected override async Tasks.Task InitializeAsync(CancellationToken cancellati

var repository = await GetServiceAsync(typeof(SVsExtensionRepository)) as IVsExtensionRepository;
var manager = await GetServiceAsync(typeof(SVsExtensionManager)) as IVsExtensionManager;
var vsVersion = GetVisualStudioVersion();
Version vsVersion = GetVisualStudioVersion();

await Installer.RunAsync(vsVersion, repository, manager, cancellationToken);

Expand All @@ -69,7 +69,7 @@ protected override async Tasks.Task InitializeAsync(CancellationToken cancellati
public static Version GetVisualStudioVersion()
{
var process = System.Diagnostics.Process.GetCurrentProcess();
var v = process.MainModule.FileVersionInfo;
System.Diagnostics.FileVersionInfo v = process.MainModule.FileVersionInfo;

return new Version(v.ProductMajorPart, v.ProductMinorPart, v.ProductBuildPart);
}
Expand All @@ -78,7 +78,7 @@ protected override void Dispose(bool disposing)
{
if (disposing && _installTime != DateTime.MinValue)
{
var minutes = (DateTime.Now - _installTime).Minutes;
int minutes = (DateTime.Now - _installTime).Minutes;
Telemetry.RecordTimeToClose(minutes);
}

Expand Down
1 change: 0 additions & 1 deletion src/WebEssentials2017.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
</Compile>
<Compile Include="Commands\ShowModalCommand.cs" />
<Compile Include="Constants.cs" />
<Compile Include="Helpers\Logger.cs" />
<Compile Include="Helpers\Telemetry.cs" />
<Compile Include="Installer\DataStore.cs" />
<Compile Include="Installer\ExtensionEntry.cs" />
Expand Down

0 comments on commit c5c476e

Please sign in to comment.