Skip to content

Improve update logic & Fix update logic issue & Input for Query #3502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 30 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
34c3cda
Improve update logic
Jack251970 May 2, 2025
381334f
Improve variable names
Jack251970 May 2, 2025
1381748
Merge branch 'dev' into improve_update
Jack251970 May 3, 2025
a2a4b5a
Merge branch 'dev' into improve_update
Jack251970 May 5, 2025
77b8749
Revert error change
Jack251970 May 5, 2025
07bcd5d
Merge branch 'dev' into improve_update
Jack251970 May 5, 2025
cf3fc6a
Fix build issue & Adjust indent
Jack251970 May 5, 2025
51714d5
Add Input for home query
Jack251970 May 6, 2025
ece9b96
Merge branch 'dev' into improve_update
Jack251970 May 7, 2025
8c48cbe
Use currentCancellationToken instead
Jack251970 May 7, 2025
4c5b5fb
Improve code quality
Jack251970 May 7, 2025
f599359
Improve code quality
Jack251970 May 7, 2025
16dc921
Merge branch 'dev' into improve_update
Jack251970 May 10, 2025
8450e68
Remove async
Jack251970 May 10, 2025
a47d8fe
Merge branch 'dev' into improve_update
Jack251970 May 10, 2025
bde7463
Fix build issue
Jack251970 May 10, 2025
23a2f88
Merge branch 'dev' into improve_update
Jack251970 May 14, 2025
8670461
Merge branch 'dev' into improve_update
Jack251970 May 19, 2025
7c12956
Clear results when there are no update tasks
Jack251970 May 19, 2025
a1df6a1
Merge branch 'dev' into improve_update
Jack251970 Jun 3, 2025
3bf6008
Update code comments
Jack251970 Jun 3, 2025
3786130
Merge branch 'dev' into improve_update
Jack251970 Jun 28, 2025
84e0193
Merge branch 'dev' into improve_update
Jack251970 Jul 5, 2025
2229db0
Merge branch 'dev' into improve_update
Jack251970 Jul 14, 2025
9136b19
Merge branch 'dev' into improve_update
Jack251970 Jul 19, 2025
81429d7
Merge branch 'dev' into improve_update
Jack251970 Jul 20, 2025
27ea2e4
Improve code quality
Jack251970 Jul 20, 2025
1c0c9e7
Await cancel async
Jack251970 Jul 21, 2025
5493e5c
Fix null exception
Jack251970 Jul 21, 2025
a545a40
Merge branch 'dev' into improve_update
Jack251970 Jul 24, 2025
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
4 changes: 3 additions & 1 deletion Flow.Launcher.Core/Plugin/QueryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ namespace Flow.Launcher.Core.Plugin
{
public static class QueryBuilder
{
public static Query Build(string text, Dictionary<string, PluginPair> nonGlobalPlugins)
public static Query Build(string input, string text, Dictionary<string, PluginPair> nonGlobalPlugins)
{
// home query
if (string.IsNullOrEmpty(text))
{
return new Query()
{
Search = string.Empty,
Input = string.Empty,
RawQuery = string.Empty,
SearchTerms = Array.Empty<string>(),
ActionKeyword = string.Empty,
Expand Down Expand Up @@ -52,6 +53,7 @@ public static Query Build(string text, Dictionary<string, PluginPair> nonGlobalP
return new Query()
{
Search = search,
Input = input,
RawQuery = rawQuery,
SearchTerms = searchTerms,
ActionKeyword = actionKeyword,
Expand Down
6 changes: 6 additions & 0 deletions Flow.Launcher.Plugin/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ namespace Flow.Launcher.Plugin
/// </summary>
public class Query
{
/// <summary>
/// Input text in query box.
/// We didn't recommend use this property directly. You should always use Search property.
/// </summary>
public string Input { get; internal init; }

/// <summary>
/// Raw query, this includes action keyword if it has.
/// It has handled buildin custom query shortkeys and build-in shortcuts, and it trims the whitespace.
Expand Down
6 changes: 3 additions & 3 deletions Flow.Launcher.Test/QueryBuilderTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using NUnit.Framework;
using NUnit.Framework.Legacy;

Check warning on line 3 in Flow.Launcher.Test/QueryBuilderTest.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`NUnit` is not a recognized word. (unrecognized-spelling)
using Flow.Launcher.Core.Plugin;
using Flow.Launcher.Plugin;

Expand All @@ -16,16 +16,16 @@
{">", new PluginPair {Metadata = new PluginMetadata {ActionKeywords = new List<string> {">"}}}}
};

Query q = QueryBuilder.Build("> ping google.com -n 20 -6", nonGlobalPlugins);
Query q = QueryBuilder.Build("> ping google.com -n 20 -6", "> ping google.com -n 20 -6", nonGlobalPlugins);

Check warning on line 19 in Flow.Launcher.Test/QueryBuilderTest.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`google` is not a recognized word. (unrecognized-spelling)

ClassicAssert.AreEqual("> ping google.com -n 20 -6", q.RawQuery);

Check warning on line 21 in Flow.Launcher.Test/QueryBuilderTest.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`google` is not a recognized word. (unrecognized-spelling)
ClassicAssert.AreEqual("ping google.com -n 20 -6", q.Search, "Search should not start with the ActionKeyword.");

Check warning on line 22 in Flow.Launcher.Test/QueryBuilderTest.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`google` is not a recognized word. (unrecognized-spelling)
ClassicAssert.AreEqual(">", q.ActionKeyword);

ClassicAssert.AreEqual(5, q.SearchTerms.Length, "The length of SearchTerms should match.");

ClassicAssert.AreEqual("ping", q.FirstSearch);
ClassicAssert.AreEqual("google.com", q.SecondSearch);

Check warning on line 28 in Flow.Launcher.Test/QueryBuilderTest.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`google` is not a recognized word. (unrecognized-spelling)
ClassicAssert.AreEqual("-n", q.ThirdSearch);

ClassicAssert.AreEqual("google.com -n 20 -6", q.SecondToEndSearch, "SecondToEndSearch should be trimmed of multiple whitespace characters");
Expand All @@ -39,7 +39,7 @@
{">", new PluginPair {Metadata = new PluginMetadata {ActionKeywords = new List<string> {">"}, Disabled = true}}}
};

Query q = QueryBuilder.Build("> ping google.com -n 20 -6", nonGlobalPlugins);
Query q = QueryBuilder.Build("> ping google.com -n 20 -6", "> ping google.com -n 20 -6", nonGlobalPlugins);

ClassicAssert.AreEqual("> ping google.com -n 20 -6", q.Search);
ClassicAssert.AreEqual(q.Search, q.RawQuery, "RawQuery should be equal to Search.");
Expand All @@ -51,7 +51,7 @@
[Test]
public void GenericPluginQueryTest()
{
Query q = QueryBuilder.Build("file.txt file2 file3", new Dictionary<string, PluginPair>());
Query q = QueryBuilder.Build("file.txt file2 file3", "file.txt file2 file3", new Dictionary<string, PluginPair>());

ClassicAssert.AreEqual("file.txt file2 file3", q.Search);
ClassicAssert.AreEqual("", q.ActionKeyword);
Expand Down
2 changes: 1 addition & 1 deletion Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
public MainWindow()
{
_settings = Ioc.Default.GetRequiredService<Settings>();
_theme = Ioc.Default.GetRequiredService<Theme>();

Check warning on line 83 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Ioc` is not a recognized word. (unrecognized-spelling)
_viewModel = Ioc.Default.GetRequiredService<MainViewModel>();

Check warning on line 84 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Ioc` is not a recognized word. (unrecognized-spelling)
DataContext = _viewModel;

InitializeComponent();
Expand All @@ -108,7 +108,7 @@
{
var handle = Win32Helper.GetWindowHandle(this, true);
_hwndSource = HwndSource.FromHwnd(handle);
_hwndSource.AddHook(WndProc);

Check warning on line 111 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Wnd` is not a recognized word. (unrecognized-spelling)
Win32Helper.HideFromAltTab(this);
Win32Helper.DisableControlBox(this);
}
Expand Down Expand Up @@ -333,7 +333,7 @@
{
try
{
_hwndSource.RemoveHook(WndProc);

Check warning on line 336 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Wnd` is not a recognized word. (unrecognized-spelling)
}
catch (Exception)
{
Expand Down Expand Up @@ -426,7 +426,7 @@
&& QueryTextBox.CaretIndex == QueryTextBox.Text.Length)
{
var queryWithoutActionKeyword =
QueryBuilder.Build(QueryTextBox.Text.Trim(), PluginManager.NonGlobalPlugins)?.Search;
QueryBuilder.Build(QueryTextBox.Text, QueryTextBox.Text.Trim(), PluginManager.NonGlobalPlugins)?.Search;

if (FilesFolders.IsLocationPathString(queryWithoutActionKeyword))
{
Expand Down Expand Up @@ -457,7 +457,7 @@
}
}

#pragma warning restore VSTHRD100 // Avoid async void methods

Check warning on line 460 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`VSTHRD` is not a recognized word. (unrecognized-spelling)

#endregion

Expand Down
Loading
Loading