Add more debug log info for query

This commit is contained in:
Jack251970 2025-05-04 22:04:01 +08:00
parent a2a8c5081e
commit 51fb1515a0

View file

@ -1215,10 +1215,14 @@ namespace Flow.Launcher.ViewModel
{
_updateSource?.Cancel();
App.API.LogDebug(ClassName, $"Start query with text: {QueryText}");
var query = await ConstructQueryAsync(QueryText, Settings.CustomShortcuts, Settings.BuiltinShortcuts);
if (query == null) // shortcut expanded
{
App.API.LogDebug(ClassName, $"Clear query results");
// Hide and clear results again because running query may show and add some results
Results.Visibility = Visibility.Collapsed;
Results.Clear();
@ -1233,6 +1237,8 @@ namespace Flow.Launcher.ViewModel
return;
}
App.API.LogDebug(ClassName, $"Start query with ActionKeyword <{query.ActionKeyword}> and RawQuery <{query.RawQuery}>");
_updateSource = new CancellationTokenSource();
ProgressBarVisibility = Visibility.Hidden;
@ -1253,6 +1259,9 @@ namespace Flow.Launcher.ViewModel
var plugins = PluginManager.ValidPluginsForQuery(query);
var validPluginNames = plugins.Select(x => $"<{x.Metadata.Name}>");
App.API.LogDebug(ClassName, $"Valid <{plugins.Count}> plugins: {string.Join(" ", validPluginNames)}");
if (plugins.Count == 1)
{
PluginIconPath = plugins.Single().Metadata.IcoPath;
@ -1321,6 +1330,8 @@ namespace Flow.Launcher.ViewModel
// Local function
async Task QueryTaskAsync(PluginPair plugin, CancellationToken token)
{
App.API.LogDebug(ClassName, $"Wait for querying plugin <{plugin.Metadata.Name}>");
if (searchDelay)
{
var searchDelayTime = plugin.Metadata.SearchDelayTime ?? Settings.SearchDelayTime;
@ -1359,6 +1370,8 @@ namespace Flow.Launcher.ViewModel
if (token.IsCancellationRequested) return;
App.API.LogDebug(ClassName, $"Update results for plugin <{plugin.Metadata.Name}>");
if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(resultsCopy, plugin.Metadata, query,
token, reSelect)))
{
@ -1448,6 +1461,8 @@ namespace Flow.Launcher.ViewModel
{
if (_lastQuery?.ActionKeyword != query?.ActionKeyword)
{
App.API.LogDebug(ClassName, $"Remove old results");
Results.Clear();
}
}