Skip to content

Commit 20d2661

Browse files
committed
Code quality
1 parent 50130e4 commit 20d2661

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

Flow.Launcher.Core/ExternalPlugins/Environments/JavaScriptEnvironment.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Flow.Launcher.Core.ExternalPlugins.Environments
66
{
7-
87
internal class JavaScriptEnvironment : TypeScriptEnvironment
98
{
109
internal override string Language => AllowedLanguage.JavaScript;

Flow.Launcher.Core/ExternalPlugins/Environments/JavaScriptV2Environment.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Flow.Launcher.Core.ExternalPlugins.Environments
66
{
7-
87
internal class JavaScriptV2Environment : TypeScriptV2Environment
98
{
109
internal override string Language => AllowedLanguage.JavaScriptV2;

Flow.Launcher.Core/ExternalPlugins/Environments/PythonEnvironment.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Flow.Launcher.Infrastructure.UserSettings;
66
using Flow.Launcher.Plugin;
77
using Flow.Launcher.Plugin.SharedCommands;
8+
using Microsoft.VisualStudio.Threading;
89

910
namespace Flow.Launcher.Core.ExternalPlugins.Environments
1011
{
@@ -30,13 +31,15 @@ internal override string PluginsSettingsFilePath
3031

3132
internal PythonEnvironment(List<PluginMetadata> pluginMetadataList, PluginsSettings pluginSettings) : base(pluginMetadataList, pluginSettings) { }
3233

34+
private JoinableTaskFactory JTF { get; } = new JoinableTaskFactory(new JoinableTaskContext());
35+
3336
internal override void InstallEnvironment()
3437
{
3538
FilesFolders.RemoveFolderIfExists(InstallPath, (s) => API.ShowMsgBox(s));
3639

3740
// Python 3.11.4 is no longer Windows 7 compatible. If user is on Win 7 and
3841
// uses Python plugin they need to custom install and use v3.8.9
39-
DroplexPackage.Drop(App.python_3_11_4_embeddable, InstallPath).Wait();
42+
JTF.Run(() => DroplexPackage.Drop(App.python_3_11_4_embeddable, InstallPath));
4043

4144
PluginsSettingsFilePath = ExecutablePath;
4245
}

Flow.Launcher.Core/ExternalPlugins/Environments/TypeScriptEnvironment.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Flow.Launcher.Infrastructure.UserSettings;
66
using Flow.Launcher.Plugin;
77
using Flow.Launcher.Plugin.SharedCommands;
8+
using Microsoft.VisualStudio.Threading;
89

910
namespace Flow.Launcher.Core.ExternalPlugins.Environments
1011
{
@@ -27,11 +28,13 @@ internal override string PluginsSettingsFilePath
2728

2829
internal TypeScriptEnvironment(List<PluginMetadata> pluginMetadataList, PluginsSettings pluginSettings) : base(pluginMetadataList, pluginSettings) { }
2930

31+
private JoinableTaskFactory JTF { get; } = new JoinableTaskFactory(new JoinableTaskContext());
32+
3033
internal override void InstallEnvironment()
3134
{
3235
FilesFolders.RemoveFolderIfExists(InstallPath, (s) => API.ShowMsgBox(s));
3336

34-
DroplexPackage.Drop(App.nodejs_16_18_0, InstallPath).Wait();
37+
JTF.Run(() => DroplexPackage.Drop(App.nodejs_16_18_0, InstallPath));
3538

3639
PluginsSettingsFilePath = ExecutablePath;
3740
}

Flow.Launcher.Core/ExternalPlugins/Environments/TypeScriptV2Environment.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Flow.Launcher.Infrastructure.UserSettings;
66
using Flow.Launcher.Plugin;
77
using Flow.Launcher.Plugin.SharedCommands;
8+
using Microsoft.VisualStudio.Threading;
89

910
namespace Flow.Launcher.Core.ExternalPlugins.Environments
1011
{
@@ -27,11 +28,13 @@ internal override string PluginsSettingsFilePath
2728

2829
internal TypeScriptV2Environment(List<PluginMetadata> pluginMetadataList, PluginsSettings pluginSettings) : base(pluginMetadataList, pluginSettings) { }
2930

31+
private JoinableTaskFactory JTF { get; } = new JoinableTaskFactory(new JoinableTaskContext());
32+
3033
internal override void InstallEnvironment()
3134
{
3235
FilesFolders.RemoveFolderIfExists(InstallPath, (s) => API.ShowMsgBox(s));
3336

34-
DroplexPackage.Drop(App.nodejs_16_18_0, InstallPath).Wait();
37+
JTF.Run(() => DroplexPackage.Drop(App.nodejs_16_18_0, InstallPath));
3538

3639
PluginsSettingsFilePath = ExecutablePath;
3740
}

Flow.Launcher.Core/Plugin/ProcessStreamPluginV2.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
#nullable enable
2-
3-
using System;
4-
using System.Collections.Generic;
1+
using System;
52
using System.Diagnostics;
63
using System.IO.Pipelines;
74
using System.Threading.Tasks;
85
using Flow.Launcher.Infrastructure;
96
using Flow.Launcher.Plugin;
107
using Meziantou.Framework.Win32;
11-
using Microsoft.VisualBasic.ApplicationServices;
128
using Nerdbank.Streams;
139

10+
#nullable enable
11+
1412
namespace Flow.Launcher.Core.Plugin
1513
{
1614
internal abstract class ProcessStreamPluginV2 : JsonRPCPluginV2
1715
{
18-
private static JobObject _jobObject = new JobObject();
16+
private static readonly JobObject _jobObject = new();
1917

2018
static ProcessStreamPluginV2()
2119
{
@@ -66,11 +64,10 @@ private void SetupPipe(Process process)
6664
ClientPipe = new DuplexPipe(reader, writer);
6765
}
6866

69-
7067
public override async Task ReloadDataAsync()
7168
{
7269
var oldProcess = ClientProcess;
73-
ClientProcess = Process.Start(StartInfo);
70+
ClientProcess = Process.Start(StartInfo)!;
7471
ArgumentNullException.ThrowIfNull(ClientProcess);
7572
SetupPipe(ClientProcess);
7673
await base.ReloadDataAsync();
@@ -79,7 +76,6 @@ public override async Task ReloadDataAsync()
7976
oldProcess.Dispose();
8077
}
8178

82-
8379
public override async ValueTask DisposeAsync()
8480
{
8581
await base.DisposeAsync();

0 commit comments

Comments
 (0)