Add more logging to GetSignatureHelp (#1717)

* Add more logging to GetSignatureHelp

* cleanup

* cleanup
This commit is contained in:
Charles Gagnon
2022-10-05 12:26:16 -07:00
committed by GitHub
parent e1bec4d747
commit bbf65314d1
3 changed files with 8 additions and 13 deletions

View File

@@ -89,18 +89,12 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
/// </summary> /// </summary>
public virtual QueueItem QueueBindingOperation( public virtual QueueItem QueueBindingOperation(
string key, string key,
Func<IBindingContext, CancellationToken, object> bindOperation, Func<IBindingContext, CancellationToken, object?> bindOperation,
Func<IBindingContext, object> timeoutOperation = null, Func<IBindingContext, object>? timeoutOperation = null,
Func<Exception, object> errorHandler = null, Func<Exception, object>? errorHandler = null,
int? bindingTimeout = null, int? bindingTimeout = null,
int? waitForLockTimeout = null) int? waitForLockTimeout = null)
{ {
// don't add null operations to the binding queue
if (bindOperation == null)
{
return null;
}
QueueItem queueItem = new QueueItem() QueueItem queueItem = new QueueItem()
{ {
Key = key, Key = key,

View File

@@ -1551,11 +1551,12 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
} }
else else
{ {
Logger.Verbose($"GetSignatureHelp - Didn't get any method locations from parse result");
return null; return null;
} }
}); });
queueItem.ItemProcessed.WaitOne(); queueItem.ItemProcessed.WaitOne();
Logger.Verbose($"GetSignatureHelp - Got result {queueItem.Result}");
return queueItem.GetResultAsT<SignatureHelp>(); return queueItem.GetResultAsT<SignatureHelp>();
} }
finally finally

View File

@@ -29,12 +29,12 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
/// <summary> /// <summary>
/// Gets or sets the bind operation callback method /// Gets or sets the bind operation callback method
/// </summary> /// </summary>
public Func<IBindingContext, CancellationToken, object> BindOperation { get; set; } public Func<IBindingContext, CancellationToken, object?> BindOperation { get; set; }
/// <summary> /// <summary>
/// Gets or sets the timeout operation to call if the bind operation doesn't finish within timeout period /// Gets or sets the timeout operation to call if the bind operation doesn't finish within timeout period
/// </summary> /// </summary>
public Func<IBindingContext, object> TimeoutOperation { get; set; } public Func<IBindingContext, object>? TimeoutOperation { get; set; }
/// <summary> /// <summary>
/// Gets or sets the operation to call if the bind operation encounters an unexpected exception. /// Gets or sets the operation to call if the bind operation encounters an unexpected exception.
@@ -66,7 +66,7 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
/// <summary> /// <summary>
/// Converts the result of the execution to type T /// Converts the result of the execution to type T
/// </summary> /// </summary>
public T GetResultAsT<T>() where T : class public T? GetResultAsT<T>() where T : class
{ {
//var task = this.ResultsTask; //var task = this.ResultsTask;
return (this.Result != null) return (this.Result != null)