Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 82 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,93 @@ root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
tab_width = 4
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120

[*.md]
max_line_length = 100
# Microsoft .NET properties
csharp_new_line_before_members_in_object_initializers = false
csharp_preferred_modifier_order = public, private, protected, internal, file, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_var_elsewhere = true:suggestion
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
dotnet_naming_rule.interfaces_rule.severity = warning
dotnet_naming_rule.interfaces_rule.style = i_upper_camel_case_style
dotnet_naming_rule.interfaces_rule.symbols = interfaces_symbols
dotnet_naming_rule.private_static_readonly_rule.severity = warning
dotnet_naming_rule.private_static_readonly_rule.style = lower_camel_case_style
dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols
dotnet_naming_rule.type_parameters_rule.severity = warning
dotnet_naming_rule.type_parameters_rule.style = upper_camel_case_style
dotnet_naming_rule.type_parameters_rule.symbols = type_parameters_symbols
dotnet_naming_style.i_upper_camel_case_style.capitalization = pascal_case
dotnet_naming_style.i_upper_camel_case_style.required_prefix = I
dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
dotnet_naming_style.lower_camel_case_style.required_prefix = _
dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case
dotnet_naming_symbols.interfaces_symbols.applicable_accessibilities = *
dotnet_naming_symbols.interfaces_symbols.applicable_kinds = interface
dotnet_naming_symbols.interfaces_symbols.resharper_applicable_kinds = interface
dotnet_naming_symbols.interfaces_symbols.resharper_required_modifiers = any
dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field
dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = readonly, static
dotnet_naming_symbols.private_static_readonly_symbols.resharper_applicable_kinds = readonly_field
dotnet_naming_symbols.private_static_readonly_symbols.resharper_required_modifiers = static
dotnet_naming_symbols.type_parameters_symbols.applicable_accessibilities = *
dotnet_naming_symbols.type_parameters_symbols.applicable_kinds = type_parameter
dotnet_naming_symbols.type_parameters_symbols.resharper_applicable_kinds = type_parameter
dotnet_naming_symbols.type_parameters_symbols.resharper_required_modifiers = any
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion

# ReSharper properties
resharper_autodetect_indent_settings = false
resharper_formatter_off_tag = @formatter:off
resharper_formatter_on_tag = @formatter:on
resharper_formatter_tags_enabled = true
resharper_use_indent_from_vs = false
csharp_align_linq_query = true
csharp_align_multiline_argument = true
csharp_align_multiline_calls_chain = true
csharp_align_multiline_extends_list = true
csharp_align_multiline_parameter = true
csharp_align_multiline_type_parameter_constraints = true
csharp_align_multiline_type_parameter_list = true
csharp_align_multiple_declaration = true
csharp_align_tuple_components = true
csharp_align_multiline_binary_expressions_chain = true
csharp_align_multiline_statement_conditions = true
csharp_align_multiline_comments = true
csharp_int_align_binary_expressions = true
csharp_outdent_binary_ops = true
csharp_int_align_comments = true
csharp_int_align_switch_sections = true
csharp_int_align_switch_expressions = true
csharp_int_align_variables = true


[*.{md,diff,patch}]
trim_trailing_whitespace = false

[*.{razor,cshtml}]
charset = utf-8-bom
[{*.yaml,*.yml}]
indent_size = 2

[{*.bash,*.sh,*.zsh}]
indent_size = 2

[*.yml]
indent_size = 2
[*.{cmd,bat,ps1}]
end_of_line = crlf
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* text=auto eol=lf

# Windows scripts that might require CRLF line endings.
*.cmd text eol=crlf
*.bat text eol=crlf
*.ps1 text eol=crlf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void InitFileWatcher()
_scriptDirWatcher.Created += (_, ev) => _pushDirectoryChanged();
_scriptDirWatcher.Deleted += (_, ev) => _pushDirectoryChanged();
_scriptDirWatcher.Renamed += (_, ev) => _pushDirectoryChanged();
_scriptDirWatcher.Error += delegate(object sender, ErrorEventArgs args)
_scriptDirWatcher.Error += (_, args) =>
{
Logger.LogError(args.GetException(), "Error in FileSystemWatcher. Will re-initialize watcher");
_scriptDirWatcher.Dispose();
Expand Down
2 changes: 1 addition & 1 deletion src/Apps/NetPad.Apps.App/Controllers/WindowController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
using NetPad.Apps.UiInterop;

namespace NetPad.Controllers;
Expand Down
2 changes: 1 addition & 1 deletion src/Apps/NetPad.Apps.App/Host/ShellType.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace NetPad.Host;
namespace NetPad.Host;

public enum ShellType
{
Expand Down
2 changes: 1 addition & 1 deletion src/Apps/NetPad.Apps.Common/BackgroundService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace NetPad.Apps;

public abstract class BackgroundService : IHostedService
public abstract class BackgroundService : IHostedService
{
protected readonly ILogger Logger;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using NetPad.Application;
using NetPad.Application;

namespace NetPad.Apps.CQs;

Expand Down
2 changes: 1 addition & 1 deletion src/Apps/NetPad.Apps.Common/CQs/AlertUserCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace NetPad.Apps.CQs;
namespace NetPad.Apps.CQs;

public class AlertUserCommand(string message) : Command
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using MediatR;
using MediatR;
using Microsoft.Extensions.Logging;
using NetPad.Application;
using NetPad.DotNet;
Expand Down
2 changes: 1 addition & 1 deletion src/Apps/NetPad.Apps.Common/CQs/ConfirmWithUserCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using NetPad.Apps.UiInterop;
using NetPad.Apps.UiInterop;

namespace NetPad.Apps.CQs;

Expand Down
2 changes: 1 addition & 1 deletion src/Apps/NetPad.Apps.Common/CQs/DeleteScriptCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using MediatR;
using MediatR;
using NetPad.Events;
using NetPad.Scripts;
using NetPad.Scripts.Events;
Expand Down
2 changes: 1 addition & 1 deletion src/Apps/NetPad.Apps.Common/CQs/PromptUserCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace NetPad.Apps.CQs;
namespace NetPad.Apps.CQs;

public class PromptUserCommand(string message, string? prefillValue) : Command<string?>
{
Expand Down
2 changes: 1 addition & 1 deletion src/Apps/NetPad.Apps.Common/CQs/StopAllScriptsCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using MediatR;
using MediatR;
using Microsoft.Extensions.Logging;
using NetPad.Scripts;
using NetPad.Sessions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using MediatR;
using MediatR;
using NetPad.DotNet;
using NetPad.Events;
using NetPad.Scripts;
Expand Down
2 changes: 1 addition & 1 deletion src/Apps/NetPad.Apps.Common/CQs/UpdateSettingsCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using MediatR;
using MediatR;
using NetPad.Configuration;
using NetPad.Configuration.Events;
using NetPad.Events;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ public override string ToString()
return string.Join(";", this.Select(x => $"{x.Key}={x.Value}")) + ";";
}

public static ConnectionStringBuilder Parse(string connectionString) => new (connectionString);
public static ConnectionStringBuilder Parse(string connectionString) => new(connectionString);
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public bool CanSupport(DataConnection dataConnection)

private async Task<string?> GetSchemaHashAsync(MariaDbDatabaseConnection connection)
{
string[] interestingColumns = [ "table_schema", "table_name", "column_name", "is_nullable", "data_type" ];
string[] interestingColumns = ["table_schema", "table_name", "column_name", "is_nullable", "data_type"];

var sql = $"""
SELECT {string.Join(",", interestingColumns)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public bool CanSupport(DataConnection dataConnection)

private async Task<string?> GetSchemaHashAsync(MySqlDatabaseConnection connection)
{
string[] interestingColumns = [ "table_schema", "table_name", "column_name", "is_nullable", "data_type" ];
string[] interestingColumns = ["table_schema", "table_name", "column_name", "is_nullable", "data_type"];

var sql = $"""
SELECT {string.Join(",", interestingColumns)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using NetPad.Apps.Data.EntityFrameworkCore.DataConnections;
using NetPad.Apps.Data.EntityFrameworkCore.DataConnections.MariaDb;
using NetPad.Apps.Data.EntityFrameworkCore.DataConnections.MsSqlServer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public async Task<BrowserWindow> CreateWindowAsync(

logger.LogDebug("Created window with name: {WindowName} and ID: {ID} and URL: {Url}", windowName, window.Id, url);

window.OnClosed += () =>_windows.TryRemove(windowId, out _);
window.OnClosed += () => _windows.TryRemove(windowId, out _);

await window.WebContents.Session.ClearCacheAsync();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ElectronSharp.API.Entities;
using ElectronSharp.API.Entities;

namespace NetPad.Apps.Shells.Electron.UiInterop;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using NetPad.DotNet;
using NetPad.DotNet;

namespace NetPad.Application;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ILogger<UnloadableAssemblyLoader> logger
// Try to find it by name if it can't be found by full name. Assemblies generated in memory typically have FullName
// strings that are missing things like Version, Culture and PublicKeyToken
else if (assemblyName.Name != null && _referenceAssemblyImages.TryGetValue(assemblyName.Name, out referenceAssemblyImage))
assembly = LoadFrom(referenceAssemblyImage.Image);
assembly = LoadFrom(referenceAssemblyImage.Image);

else if (_referenceAssemblyFiles.TryGetValue(assemblyName.FullName, out var referenceAssemblyFile))
assembly = LoadFrom(referenceAssemblyFile.Bytes);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace NetPad.CodeAnalysis;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.IO;
using System.IO;
using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.Disassembler;
using Microsoft.CodeAnalysis;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis;
using NetPad.DotNet;

namespace NetPad.CodeAnalysis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ public enum Dependant
Script,
ScriptHost,
Shared,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ public enum DependencyLoadStrategy
/// Dependency will not be copied, and will be loaded from its original location (in-place).
/// </summary>
LoadInPlace
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using NetPad.Compilation.Scripts.Dependencies;
using NetPad.DotNet;
using NetPad.DotNet.CodeAnalysis;
Expand Down
2 changes: 1 addition & 1 deletion src/Core/NetPad.Runtime/Configuration/EditorOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void DefaultMissingValues()
},
themeCustomizations = new
{
colors = new {},
colors = new { },
rules = Array.Empty<string>()
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public class KeyboardShortcutConfiguration(string id)
public KeyCode? Key { get; set; }
}

public enum KeyCode {
public enum KeyCode
{
Unknown = 0,
Backspace = 1,
Tab,
Expand Down
2 changes: 1 addition & 1 deletion src/Core/NetPad.Runtime/Configuration/StyleOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;

namespace NetPad.Configuration;

Expand Down
2 changes: 1 addition & 1 deletion src/Core/NetPad.Runtime/DotNet/DotNetCliRunner.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Diagnostics;
using System.Diagnostics;

namespace NetPad.DotNet;

Expand Down
2 changes: 1 addition & 1 deletion src/Core/NetPad.Runtime/DotNet/DotNetEnvironment.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace NetPad.DotNet;
namespace NetPad.DotNet;

public class DotNetEnvironment
{
Expand Down
2 changes: 1 addition & 1 deletion src/Core/NetPad.Runtime/DotNet/DotNetPathResolver.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Diagnostics;
using System.Diagnostics;
using System.IO;
using NetPad.Configuration;
using NetPad.IO;
Expand Down
4 changes: 2 additions & 2 deletions src/Core/NetPad.Runtime/Events/EventBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ private async Task PublishInternalAsync<TEvent>(TEvent Event) where TEvent : cla
lock (_subscriptionsPadlock)
{
currentlySubscribed = (from sub in _subscriptions
where sub.Subscription.ShouldAttemptDelivery(Event)
select sub).ToList();
where sub.Subscription.ShouldAttemptDelivery(Event)
select sub).ToList();
}

foreach (var sub in currentlySubscribed)
Expand Down
2 changes: 1 addition & 1 deletion src/Core/NetPad.Runtime/Events/IEvent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace NetPad.Events;
namespace NetPad.Events;

/// <summary>
/// An event. All events sent and received by the <see cref="IEventBus"/> must implement this interface.
Expand Down
2 changes: 1 addition & 1 deletion src/Core/NetPad.Runtime/Events/IEventBus.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace NetPad.Events;
namespace NetPad.Events;

/// <summary>
/// Event bus responsible for taking subscriptions/publications and delivering of Events.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using NetPad.Events;
using NetPad.Events;

namespace NetPad.ExecutionModel.ClientServer.Events;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace NetPad.ExecutionModel.ClientServer.Messages;
namespace NetPad.ExecutionModel.ClientServer.Messages;

public record ClearMemCacheMessage;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace NetPad.ExecutionModel.ClientServer.Messages;
namespace NetPad.ExecutionModel.ClientServer.Messages;

public record DeleteMemCacheItemMessage(string Key);
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace NetPad.ExecutionModel.ClientServer.Messages;
namespace NetPad.ExecutionModel.ClientServer.Messages;

public record DumpMemCacheItemMessage(string Key);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using NetPad.ExecutionModel.ScriptServices;
using NetPad.ExecutionModel.ScriptServices;

namespace NetPad.ExecutionModel.ClientServer.Messages;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace NetPad.ExecutionModel.ClientServer.Messages;
namespace NetPad.ExecutionModel.ClientServer.Messages;

public record ScriptOutputMessage(string Output);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using NetPad.DotNet;
using NetPad.DotNet;
using NetPad.Scripts;

namespace NetPad.ExecutionModel.ClientServer;
Expand Down
Loading
Loading