Skip to content

Commit

Permalink
Merge pull request #52 from eirannejad/master
Browse files Browse the repository at this point in the history
Better Code Completion Results
  • Loading branch information
daren-thomas authored Apr 19, 2017
2 parents 72c10dc + 16d6a8a commit 2b1264f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions PythonConsoleControl/PythonConsoleCompletionDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ public ICompletionData[] GenerateCompletionData(string line)
//IList<string> members = commandLine.ScriptScope.Engine.Operations.GetMemberNames(value);
Type type = TryGetType(name);
// Use Reflection for everything except in-built Python types and COM pbjects.
if (type != null && type.Namespace != "IronPython.Runtime" && (type.Name != "__ComObject"))
if (type != null && type.Namespace != "IronPython.Runtime" && !type.FullName.Contains("IronPython.NewTypes") && (type.Name != "__ComObject"))
{
PopulateFromCLRType(items, type, name);
}
else
{
string dirCommand = "dir(" + name + ")";
//string dirCommand = "dir(" + name + ")";
string dirCommand = "sorted([m for m in dir(" + name + ") if not m.startswith('__')], key = str.lower) + sorted([m for m in dir(" + name + ") if m.startswith('__')])";
object value = commandLine.ScriptScope.Engine.CreateScriptSourceFromString(dirCommand, SourceCodeKind.Expression).Execute(commandLine.ScriptScope);
AutocompletionInProgress = false;
foreach (object member in (value as IronPython.Runtime.List))
Expand Down

0 comments on commit 2b1264f

Please sign in to comment.