mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 18:47:57 -05:00
Language service no longer binds on duplicate connections (#148)
This commit is contained in:
@@ -112,6 +112,17 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if a binding context already exists for the provided context key
|
||||||
|
/// </summary>
|
||||||
|
protected bool BindingContextExists(string key)
|
||||||
|
{
|
||||||
|
lock (this.bindingContextLock)
|
||||||
|
{
|
||||||
|
return this.BindingContextMap.ContainsKey(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool HasPendingQueueItems
|
private bool HasPendingQueueItems
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
@@ -61,6 +61,11 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
|||||||
|
|
||||||
// lookup the current binding context
|
// lookup the current binding context
|
||||||
string connectionKey = GetConnectionContextKey(connInfo);
|
string connectionKey = GetConnectionContextKey(connInfo);
|
||||||
|
if (BindingContextExists(connectionKey))
|
||||||
|
{
|
||||||
|
// no need to populate the context again since the context already exists
|
||||||
|
return connectionKey;
|
||||||
|
}
|
||||||
IBindingContext bindingContext = this.GetOrCreateBindingContext(connectionKey);
|
IBindingContext bindingContext = this.GetOrCreateBindingContext(connectionKey);
|
||||||
|
|
||||||
if (bindingContext.BindingLock.WaitOne())
|
if (bindingContext.BindingLock.WaitOne())
|
||||||
|
|||||||
Reference in New Issue
Block a user