mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Adding more continuewithonfaulted handlers (#507)
This commit is contained in:
@@ -19,6 +19,7 @@ using Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection;
|
|||||||
using Microsoft.SqlTools.ServiceLayer.LanguageServices;
|
using Microsoft.SqlTools.ServiceLayer.LanguageServices;
|
||||||
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Contracts;
|
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Contracts;
|
||||||
using Microsoft.SqlServer.Management.Common;
|
using Microsoft.SqlServer.Management.Common;
|
||||||
|
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||||
using Microsoft.SqlTools.Utility;
|
using Microsoft.SqlTools.Utility;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Connection
|
namespace Microsoft.SqlTools.ServiceLayer.Connection
|
||||||
@@ -960,7 +961,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
|||||||
};
|
};
|
||||||
await ServiceHost.SendEvent(ConnectionCompleteNotification.Type, result);
|
await ServiceHost.SendEvent(ConnectionCompleteNotification.Type, result);
|
||||||
}
|
}
|
||||||
});
|
}).ContinueWithOnFaulted(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
|||||||
await serviceHost.SendEvent(CreateSessionCompleteNotification.Type, response);
|
await serviceHost.SendEvent(CreateSessionCompleteNotification.Type, response);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
});
|
}).ContinueWithOnFaulted(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,7 +537,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
|||||||
await serviceHost.SendEvent(ExpandCompleteNotification.Type, response);
|
await serviceHost.SendEvent(ExpandCompleteNotification.Type, response);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
});
|
}).ContinueWithOnFaulted(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<ObjectExplorerTaskResult> RunTaskWithTimeout(Task task, int timeoutInSec)
|
private async Task<ObjectExplorerTaskResult> RunTaskWithTimeout(Task task, int timeoutInSec)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using Microsoft.SqlTools.Utility;
|
|||||||
using Microsoft.SqlServer.Management.Smo;
|
using Microsoft.SqlServer.Management.Smo;
|
||||||
using Microsoft.SqlServer.Management.Common;
|
using Microsoft.SqlServer.Management.Common;
|
||||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||||
|
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
||||||
{
|
{
|
||||||
@@ -181,22 +182,19 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
private async void SendScriptingCompleteEvent<TParams>(RequestContext<ScriptingResult> requestContext, EventType<TParams> eventType, TParams parameters,
|
private async void SendScriptingCompleteEvent<TParams>(RequestContext<ScriptingResult> requestContext, EventType<TParams> eventType, TParams parameters,
|
||||||
ScriptingScriptOperation operation, string scriptDestination)
|
ScriptingScriptOperation operation, string scriptDestination)
|
||||||
{
|
{
|
||||||
await Task.Run(async () =>
|
await requestContext.SendEvent(eventType, parameters);
|
||||||
|
switch (scriptDestination)
|
||||||
{
|
{
|
||||||
await requestContext.SendEvent(eventType, parameters);
|
case "ToEditor":
|
||||||
if (scriptDestination == "ToEditor")
|
|
||||||
{
|
|
||||||
await requestContext.SendResult(new ScriptingResult { OperationId = operation.OperationId, Script = operation.ScriptText });
|
await requestContext.SendResult(new ScriptingResult { OperationId = operation.OperationId, Script = operation.ScriptText });
|
||||||
}
|
break;
|
||||||
else if (scriptDestination == "ToSingleFile")
|
case "ToSingleFile":
|
||||||
{
|
|
||||||
await requestContext.SendResult(new ScriptingResult { OperationId = operation.OperationId });
|
await requestContext.SendResult(new ScriptingResult { OperationId = operation.OperationId });
|
||||||
}
|
break;
|
||||||
else
|
default:
|
||||||
{
|
|
||||||
await requestContext.SendError(string.Format("Operation {0} failed", operation.ToString()));
|
await requestContext.SendError(string.Format("Operation {0} failed", operation.ToString()));
|
||||||
}
|
break;
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Urn BuildScriptingObjectUrn(
|
private Urn BuildScriptingObjectUrn(
|
||||||
@@ -301,7 +299,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
ScriptingOperation temp;
|
ScriptingOperation temp;
|
||||||
this.ActiveOperations.TryRemove(operation.OperationId, out temp);
|
this.ActiveOperations.TryRemove(operation.OperationId, out temp);
|
||||||
}
|
}
|
||||||
});
|
}).ContinueWithOnFaulted(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user