Skip to content

Commit 135b9b5

Browse files
authored
Merge branch 'dev' into empty_query
2 parents 28b8cb6 + e4ecea0 commit 135b9b5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,10 +1244,14 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
12441244
{
12451245
_updateSource?.Cancel();
12461246

1247+
App.API.LogDebug(ClassName, $"Start query with text: <{QueryText}>");
1248+
12471249
var query = await ConstructQueryAsync(QueryText, Settings.CustomShortcuts, Settings.BuiltinShortcuts);
12481250

12491251
if (query == null) // shortcut expanded
12501252
{
1253+
App.API.LogDebug(ClassName, $"Clear query results");
1254+
12511255
// Hide and clear results again because running query may show and add some results
12521256
Results.Visibility = Visibility.Collapsed;
12531257
Results.Clear();
@@ -1262,6 +1266,8 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
12621266
return;
12631267
}
12641268

1269+
App.API.LogDebug(ClassName, $"Start query with ActionKeyword <{query.ActionKeyword}> and RawQuery <{query.RawQuery}>");
1270+
12651271
var homeQuery = query.RawQuery == string.Empty;
12661272

12671273
_updateSource = new CancellationTokenSource();
@@ -1313,6 +1319,9 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
13131319
}
13141320
}
13151321

1322+
var validPluginNames = plugins.Select(x => $"<{x.Metadata.Name}>");
1323+
App.API.LogDebug(ClassName, $"Valid <{plugins.Count}> plugins: {string.Join(" ", validPluginNames)}");
1324+
13161325
// Do not wait for performance improvement
13171326
/*if (string.IsNullOrEmpty(query.ActionKeyword))
13181327
{
@@ -1386,6 +1395,8 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
13861395
// Local function
13871396
async Task QueryTaskAsync(PluginPair plugin, CancellationToken token)
13881397
{
1398+
App.API.LogDebug(ClassName, $"Wait for querying plugin <{plugin.Metadata.Name}>");
1399+
13891400
if (searchDelay && !homeQuery) // Do not delay for home query
13901401
{
13911402
var searchDelayTime = plugin.Metadata.SearchDelayTime ?? Settings.SearchDelayTime;
@@ -1426,6 +1437,8 @@ await PluginManager.QueryHomeForPluginAsync(plugin, query, token) :
14261437

14271438
if (token.IsCancellationRequested) return;
14281439

1440+
App.API.LogDebug(ClassName, $"Update results for plugin <{plugin.Metadata.Name}>");
1441+
14291442
if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(resultsCopy, plugin.Metadata, query,
14301443
token, reSelect)))
14311444
{
@@ -1442,6 +1455,8 @@ void QueryHistoryTask()
14421455

14431456
if (_updateSource.Token.IsCancellationRequested) return;
14441457

1458+
App.API.LogDebug(ClassName, $"Update results for history");
1459+
14451460
if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(results, _historyMetadata, query,
14461461
_updateSource.Token)))
14471462
{
@@ -1537,6 +1552,8 @@ private void RemoveOldQueryResults(Query query, bool homeQuery)
15371552
// If last and current query are not home query, we need to check action keyword
15381553
else if (_lastQuery?.ActionKeyword != query?.ActionKeyword)
15391554
{
1555+
App.API.LogDebug(ClassName, $"Remove old results");
1556+
15401557
Results.Clear();
15411558
}
15421559
}

0 commit comments

Comments
 (0)