Skip to content

Commit 7ea5c68

Browse files
authored
Merge pull request #2617 from Flow-Launcher/dev
Release 1.18.0 | Plugin 4.3.0
2 parents 2f679e9 + a9b4187 commit 7ea5c68

File tree

133 files changed

+1386
-1239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+1386
-1239
lines changed

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ dotnet_style_prefer_conditional_expression_over_return = true:silent
5858
###############################
5959
# Style Definitions
6060
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
61-
# Use PascalCase for constant fields
61+
# Use PascalCase for constant fields
6262
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
6363
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
6464
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
@@ -134,7 +134,7 @@ csharp_preserve_single_line_statements = true
134134
csharp_preserve_single_line_blocks = true
135135
csharp_using_directive_placement = outside_namespace:silent
136136
csharp_prefer_simple_using_statement = true:suggestion
137-
csharp_style_namespace_declarations = block_scoped:silent
137+
csharp_style_namespace_declarations = file_scoped:silent
138138
csharp_style_prefer_method_group_conversion = true:silent
139139
csharp_style_expression_bodied_lambdas = true:silent
140140
csharp_style_expression_bodied_local_functions = false:silent

.github/actions/spelling/expect.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,4 @@ alreadyexists
106106
JsonRPC
107107
JsonRPCV2
108108
Softpedia
109+
img

.github/workflows/default_plugins.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
dotnet-version: 7.0.x
1919

2020
- name: Determine New Plugin Updates
21-
uses: dorny/paths-filter@v2
21+
uses: dorny/paths-filter@v3
2222
id: changes
2323
with:
2424
filters: |
@@ -65,7 +65,7 @@ jobs:
6565
6666
- name: Publish BrowserBookmark
6767
if: steps.changes.outputs.browserbookmark == 'true'
68-
uses: softprops/action-gh-release@v1
68+
uses: softprops/action-gh-release@v2
6969
with:
7070
repository: "Flow-Launcher/Flow.Launcher.Plugin.BrowserBookmark"
7171
files: "Flow.Launcher.Plugin.BrowserBookmark.zip"
@@ -92,7 +92,7 @@ jobs:
9292
9393
- name: Publish Calculator
9494
if: steps.changes.outputs.calculator == 'true'
95-
uses: softprops/action-gh-release@v1
95+
uses: softprops/action-gh-release@v2
9696
with:
9797
repository: "Flow-Launcher/Flow.Launcher.Plugin.Calculator"
9898
files: "Flow.Launcher.Plugin.Calculator.zip"
@@ -119,7 +119,7 @@ jobs:
119119
120120
- name: Publish Explorer
121121
if: steps.changes.outputs.explorer == 'true'
122-
uses: softprops/action-gh-release@v1
122+
uses: softprops/action-gh-release@v2
123123
with:
124124
repository: "Flow-Launcher/Flow.Launcher.Plugin.Explorer"
125125
files: "Flow.Launcher.Plugin.Explorer.zip"
@@ -146,7 +146,7 @@ jobs:
146146
147147
- name: Publish PluginIndicator
148148
if: steps.changes.outputs.pluginindicator == 'true'
149-
uses: softprops/action-gh-release@v1
149+
uses: softprops/action-gh-release@v2
150150
with:
151151
repository: "Flow-Launcher/Flow.Launcher.Plugin.PluginIndicator"
152152
files: "Flow.Launcher.Plugin.PluginIndicator.zip"
@@ -173,7 +173,7 @@ jobs:
173173
174174
- name: Publish PluginsManager
175175
if: steps.changes.outputs.pluginsmanager == 'true'
176-
uses: softprops/action-gh-release@v1
176+
uses: softprops/action-gh-release@v2
177177
with:
178178
repository: "Flow-Launcher/Flow.Launcher.Plugin.PluginsManager"
179179
files: "Flow.Launcher.Plugin.PluginsManager.zip"
@@ -200,7 +200,7 @@ jobs:
200200
201201
- name: Publish ProcessKiller
202202
if: steps.changes.outputs.processkiller == 'true'
203-
uses: softprops/action-gh-release@v1
203+
uses: softprops/action-gh-release@v2
204204
with:
205205
repository: "Flow-Launcher/Flow.Launcher.Plugin.ProcessKiller"
206206
files: "Flow.Launcher.Plugin.ProcessKiller.zip"
@@ -227,7 +227,7 @@ jobs:
227227
228228
- name: Publish Program
229229
if: steps.changes.outputs.program == 'true'
230-
uses: softprops/action-gh-release@v1
230+
uses: softprops/action-gh-release@v2
231231
with:
232232
repository: "Flow-Launcher/Flow.Launcher.Plugin.Program"
233233
files: "Flow.Launcher.Plugin.Program.zip"
@@ -254,7 +254,7 @@ jobs:
254254
255255
- name: Publish Shell
256256
if: steps.changes.outputs.shell == 'true'
257-
uses: softprops/action-gh-release@v1
257+
uses: softprops/action-gh-release@v2
258258
with:
259259
repository: "Flow-Launcher/Flow.Launcher.Plugin.Shell"
260260
files: "Flow.Launcher.Plugin.Shell.zip"
@@ -281,7 +281,7 @@ jobs:
281281
282282
- name: Publish Sys
283283
if: steps.changes.outputs.sys == 'true'
284-
uses: softprops/action-gh-release@v1
284+
uses: softprops/action-gh-release@v2
285285
with:
286286
repository: "Flow-Launcher/Flow.Launcher.Plugin.Sys"
287287
files: "Flow.Launcher.Plugin.Sys.zip"
@@ -308,7 +308,7 @@ jobs:
308308
309309
- name: Publish Url
310310
if: steps.changes.outputs.url == 'true'
311-
uses: softprops/action-gh-release@v1
311+
uses: softprops/action-gh-release@v2
312312
with:
313313
repository: "Flow-Launcher/Flow.Launcher.Plugin.Url"
314314
files: "Flow.Launcher.Plugin.Url.zip"
@@ -335,7 +335,7 @@ jobs:
335335
336336
- name: Publish WebSearch
337337
if: steps.changes.outputs.websearch == 'true'
338-
uses: softprops/action-gh-release@v1
338+
uses: softprops/action-gh-release@v2
339339
with:
340340
repository: "Flow-Launcher/Flow.Launcher.Plugin.WebSearch"
341341
files: "Flow.Launcher.Plugin.WebSearch.zip"
@@ -362,7 +362,7 @@ jobs:
362362
363363
- name: Publish WindowsSettings
364364
if: steps.changes.outputs.windowssettings == 'true'
365-
uses: softprops/action-gh-release@v1
365+
uses: softprops/action-gh-release@v2
366366
with:
367367
repository: "Flow-Launcher/Flow.Launcher.Plugin.WindowsSettings"
368368
files: "Flow.Launcher.Plugin.WindowsSettings.zip"

Flow.Launcher.Core/Flow.Launcher.Core.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@
5656
<PackageReference Include="Droplex" Version="1.7.0" />
5757
<PackageReference Include="FSharp.Core" Version="7.0.401" />
5858
<PackageReference Include="Meziantou.Framework.Win32.Jobs" Version="3.2.1" />
59-
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.3.2" />
59+
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.0" />
6060
<PackageReference Include="squirrel.windows" Version="1.5.2" NoWarn="NU1701" />
61-
<PackageReference Include="StreamJsonRpc" Version="2.17.8" />
61+
<PackageReference Include="StreamJsonRpc" Version="2.17.11" />
6262
</ItemGroup>
6363

6464
<ItemGroup>

Flow.Launcher.Core/Plugin/ExecutablePluginV2.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,9 @@ internal sealed class ExecutablePluginV2 : ProcessStreamPluginV2
1212

1313
public ExecutablePluginV2(string filename)
1414
{
15-
StartInfo = new ProcessStartInfo
16-
{
17-
FileName = filename,
18-
UseShellExecute = false,
19-
CreateNoWindow = true,
20-
RedirectStandardOutput = true,
21-
RedirectStandardError = true
22-
};
15+
StartInfo = new ProcessStartInfo { FileName = filename };
2316
}
2417

18+
protected override MessageHandlerType MessageHandler { get; } = MessageHandlerType.NewLineDelimited;
2519
}
2620
}

Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ namespace Flow.Launcher.Core.Plugin
1515
{
1616
internal abstract class JsonRPCPluginV2 : JsonRPCPluginBase, IAsyncDisposable, IAsyncReloadable, IResultUpdated
1717
{
18-
public abstract string SupportedLanguage { get; set; }
19-
2018
public const string JsonRpc = "JsonRPC";
2119

2220
protected abstract IDuplexPipe ClientPipe { get; set; }
@@ -41,17 +39,31 @@ protected override async Task<bool> ExecuteResultAsync(JsonRPCResult result)
4139
}
4240
}
4341

42+
private JoinableTaskFactory JTF { get; } = new JoinableTaskFactory(new JoinableTaskContext());
43+
4444
public override List<Result> LoadContextMenus(Result selectedResult)
4545
{
46-
throw new NotImplementedException();
46+
try
47+
{
48+
var res = JTF.Run(() => RPC.InvokeWithCancellationAsync<JsonRPCQueryResponseModel>("context_menu",
49+
new object[] { selectedResult.ContextData }));
50+
51+
var results = ParseResults(res);
52+
53+
return results;
54+
}
55+
catch
56+
{
57+
return new List<Result>();
58+
}
4759
}
4860

4961
public override async Task<List<Result>> QueryAsync(Query query, CancellationToken token)
5062
{
5163
try
5264
{
5365
var res = await RPC.InvokeWithCancellationAsync<JsonRPCQueryResponseModel>("query",
54-
new[] { query },
66+
new object[] { query, Settings.Inner },
5567
token);
5668

5769
var results = ParseResults(res);
@@ -88,12 +100,26 @@ async Task ReadErrorAsync()
88100

89101
public event ResultUpdatedEventHandler ResultsUpdated;
90102

103+
protected enum MessageHandlerType
104+
{
105+
HeaderDelimited,
106+
LengthHeaderDelimited,
107+
NewLineDelimited
108+
}
109+
110+
protected abstract MessageHandlerType MessageHandler { get; }
111+
91112

92113
private void SetupJsonRPC()
93114
{
94115
var formatter = new SystemTextJsonFormatter { JsonSerializerOptions = RequestSerializeOption };
95-
var handler = new NewLineDelimitedMessageHandler(ClientPipe,
96-
formatter);
116+
IJsonRpcMessageHandler handler = MessageHandler switch
117+
{
118+
MessageHandlerType.HeaderDelimited => new HeaderDelimitedMessageHandler(ClientPipe, formatter),
119+
MessageHandlerType.LengthHeaderDelimited => new LengthHeaderMessageHandler(ClientPipe, formatter),
120+
MessageHandlerType.NewLineDelimited => new NewLineDelimitedMessageHandler(ClientPipe, formatter),
121+
_ => throw new ArgumentOutOfRangeException()
122+
};
97123

98124
RPC = new JsonRpc(handler, new JsonRPCPublicAPI(Context.API));
99125

Flow.Launcher.Core/Plugin/NodePluginV2.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,21 @@ namespace Flow.Launcher.Core.Plugin
1010
/// <summary>
1111
/// Execution of JavaScript & TypeScript plugins
1212
/// </summary>
13-
internal class NodePluginV2 : ProcessStreamPluginV2
13+
internal sealed class NodePluginV2 : ProcessStreamPluginV2
1414
{
1515
public NodePluginV2(string filename)
1616
{
17-
StartInfo = new ProcessStartInfo
18-
{
19-
FileName = filename,
20-
UseShellExecute = false,
21-
CreateNoWindow = true,
22-
RedirectStandardOutput = true,
23-
RedirectStandardError = true
24-
};
17+
StartInfo = new ProcessStartInfo { FileName = filename, };
2518
}
2619

27-
public override string SupportedLanguage { get; set; }
2820
protected override ProcessStartInfo StartInfo { get; set; }
2921

3022
public override async Task InitAsync(PluginInitContext context)
3123
{
3224
StartInfo.ArgumentList.Add(context.CurrentPluginMetadata.ExecuteFilePath);
33-
StartInfo.ArgumentList.Add(string.Empty);
34-
StartInfo.WorkingDirectory = context.CurrentPluginMetadata.PluginDirectory;
3525
await base.InitAsync(context);
3626
}
27+
28+
protected override MessageHandlerType MessageHandler { get; } = MessageHandlerType.HeaderDelimited;
3729
}
3830
}

Flow.Launcher.Core/Plugin/ProcessStreamPluginV2.cs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
using System;
1+
#nullable enable
2+
3+
using System;
24
using System.Collections.Generic;
35
using System.Diagnostics;
46
using System.IO.Pipelines;
57
using System.Threading.Tasks;
68
using Flow.Launcher.Infrastructure;
79
using Flow.Launcher.Plugin;
810
using Meziantou.Framework.Win32;
11+
using Microsoft.VisualBasic.ApplicationServices;
912
using Nerdbank.Streams;
1013

1114
namespace Flow.Launcher.Core.Plugin
@@ -18,31 +21,37 @@ static ProcessStreamPluginV2()
1821
{
1922
_jobObject.SetLimits(new JobObjectLimits()
2023
{
21-
Flags = JobObjectLimitFlags.KillOnJobClose | JobObjectLimitFlags.DieOnUnhandledException
24+
Flags = JobObjectLimitFlags.KillOnJobClose | JobObjectLimitFlags.DieOnUnhandledException |
25+
JobObjectLimitFlags.SilentBreakawayOk
2226
});
23-
27+
2428
_jobObject.AssignProcess(Process.GetCurrentProcess());
2529
}
2630

27-
public override string SupportedLanguage { get; set; }
28-
protected sealed override IDuplexPipe ClientPipe { get; set; }
31+
protected sealed override IDuplexPipe ClientPipe { get; set; } = null!;
2932

3033
protected abstract ProcessStartInfo StartInfo { get; set; }
3134

32-
protected Process ClientProcess { get; set; }
35+
protected Process ClientProcess { get; set; } = null!;
3336

3437
public override async Task InitAsync(PluginInitContext context)
3538
{
3639
StartInfo.EnvironmentVariables["FLOW_VERSION"] = Constant.Version;
3740
StartInfo.EnvironmentVariables["FLOW_PROGRAM_DIRECTORY"] = Constant.ProgramDirectory;
3841
StartInfo.EnvironmentVariables["FLOW_APPLICATION_DIRECTORY"] = Constant.ApplicationDirectory;
3942

40-
StartInfo.ArgumentList.Add(context.CurrentPluginMetadata.ExecuteFilePath);
43+
StartInfo.RedirectStandardError = true;
44+
StartInfo.RedirectStandardInput = true;
45+
StartInfo.RedirectStandardOutput = true;
46+
StartInfo.CreateNoWindow = true;
47+
StartInfo.UseShellExecute = false;
4148
StartInfo.WorkingDirectory = context.CurrentPluginMetadata.PluginDirectory;
4249

43-
ClientProcess = Process.Start(StartInfo);
44-
ArgumentNullException.ThrowIfNull(ClientProcess);
45-
50+
var process = Process.Start(StartInfo);
51+
ArgumentNullException.ThrowIfNull(process);
52+
ClientProcess = process;
53+
_jobObject.AssignProcess(ClientProcess);
54+
4655
SetupPipe(ClientProcess);
4756

4857
ErrorStream = ClientProcess.StandardError;

Flow.Launcher.Core/Plugin/PythonPluginV2.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,25 @@ namespace Flow.Launcher.Core.Plugin
1818
{
1919
internal sealed class PythonPluginV2 : ProcessStreamPluginV2
2020
{
21-
public override string SupportedLanguage { get; set; } = AllowedLanguage.Python;
2221
protected override ProcessStartInfo StartInfo { get; set; }
23-
22+
2423
public PythonPluginV2(string filename)
2524
{
26-
StartInfo = new ProcessStartInfo
27-
{
28-
FileName = filename,
29-
UseShellExecute = false,
30-
CreateNoWindow = true,
31-
RedirectStandardOutput = true,
32-
RedirectStandardError = true,
33-
RedirectStandardInput = true
34-
};
25+
StartInfo = new ProcessStartInfo { FileName = filename, };
3526

3627
var path = Path.Combine(Constant.ProgramDirectory, JsonRpc);
3728
StartInfo.EnvironmentVariables["PYTHONPATH"] = path;
3829

3930
//Add -B flag to tell python don't write .py[co] files. Because .pyc contains location infos which will prevent python portable
4031
StartInfo.ArgumentList.Add("-B");
4132
}
33+
34+
public override async Task InitAsync(PluginInitContext context)
35+
{
36+
StartInfo.ArgumentList.Add(context.CurrentPluginMetadata.ExecuteFilePath);
37+
await base.InitAsync(context);
38+
}
39+
40+
protected override MessageHandlerType MessageHandler { get; } = MessageHandlerType.NewLineDelimited;
4241
}
4342
}

Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,12 @@
4949

5050
<ItemGroup>
5151
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
52+
<PackageReference Include="FastCache.Cached" Version="1.8.2" />
5253
<PackageReference Include="Fody" Version="6.5.5">
5354
<PrivateAssets>all</PrivateAssets>
5455
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5556
</PackageReference>
56-
<PackageReference Include="MemoryPack" Version="1.10.0" />
57+
<PackageReference Include="MemoryPack" Version="1.21.1" />
5758
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.7.30" />
5859
<PackageReference Include="NLog" Version="4.7.10" />
5960
<PackageReference Include="NLog.Schema" Version="4.7.10" />

0 commit comments

Comments
 (0)