Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -367,20 +367,30 @@ private async Task NotifyWithParametersAsync(string request, object parameters)
}

private LanguageServerSettings.PythonSettings GetSettings(Uri scopeUri = null) {
// guard on shutdown
if (_clientContexts.Count() == 0) {
return null;
}
IPythonLanguageClientContext context = null;
if (scopeUri == null) {
// REPL context has null RootPath
// REPL context has null RootPath
context = _clientContexts.Find(c => c.RootPath == null);
if (context == null) {
return null;
// use first clientcontext as default
try {
context = _clientContexts.FirstOrDefault();
} catch (InvalidOperationException) {
// no client context
return null;
}
}
} else {
var pathFromScopeUri = CommonUtils.NormalizeDirectoryPath(scopeUri.LocalPath).ToLower().TrimStart('\\');
// Find the matching context for the item, but ignore interactive window where "RootPath" is null.
context = _clientContexts.Find(c => scopeUri != null && c.RootPath != null && PathUtils.IsSamePath(c.RootPath.ToLower(), pathFromScopeUri));
}

if (context == null) {
if (context == null || context.InterpreterConfiguration == null) {
Debug.WriteLine(String.Format("GetSettings() scopeUri not found: {0}", scopeUri));
return null;
}
Expand Down