Skip to content

Commit 16d6a8a

Browse files
committed
Better code completion list
Works correctly on python classes derivded from "object" mixes lower and upper attributes together sorted by name pushes all reserved names to the end of the list
1 parent 5b0dfa2 commit 16d6a8a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

PythonConsoleControl/PythonConsoleCompletionDataProvider.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@ public ICompletionData[] GenerateCompletionData(string line)
5757
//IList<string> members = commandLine.ScriptScope.Engine.Operations.GetMemberNames(value);
5858
Type type = TryGetType(name);
5959
// Use Reflection for everything except in-built Python types and COM pbjects.
60-
if (type != null && type.Namespace != "IronPython.Runtime" && (type.Name != "__ComObject"))
60+
if (type != null && type.Namespace != "IronPython.Runtime" && !type.FullName.Contains("IronPython.NewTypes") && (type.Name != "__ComObject"))
6161
{
6262
PopulateFromCLRType(items, type, name);
6363
}
6464
else
6565
{
66-
string dirCommand = "dir(" + name + ")";
66+
//string dirCommand = "dir(" + name + ")";
67+
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('__')])";
6768
object value = commandLine.ScriptScope.Engine.CreateScriptSourceFromString(dirCommand, SourceCodeKind.Expression).Execute(commandLine.ScriptScope);
6869
AutocompletionInProgress = false;
6970
foreach (object member in (value as IronPython.Runtime.List))

0 commit comments

Comments
 (0)