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>
public virtual QueueItem QueueBindingOperation(
string key,
Func<IBindingContext, CancellationToken, object> bindOperation,
Func<IBindingContext, object> timeoutOperation = null,
Func<Exception, object> errorHandler = null,
Func<IBindingContext, CancellationToken, object?> bindOperation,
Func<IBindingContext, object>? timeoutOperation = null,
Func<Exception, object>? errorHandler = null,
int? bindingTimeout = null,
int? waitForLockTimeout = null)
{
// don't add null operations to the binding queue
if (bindOperation == null)
{
return null;
}
QueueItem queueItem = new QueueItem()
{
Key = key,

View File

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

View File

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