editor/sagas: maintain jedi sort order

Now that jedi returns names that start with `_`, we need to make sure
they don't end up at the top of the list for completions.
This commit is contained in:
David Lechner
2022-12-28 17:23:59 -06:00
parent dfe1d3b721
commit 810ee362c6
+9 -1
View File
@@ -698,7 +698,15 @@ function* runJedi(): Generator {
}
if (pythonMessageDidComplete.matches(msg.data)) {
const list = JSON.parse(msg.data.completionListJson);
const list: monaco.languages.CompletionItem[] = JSON.parse(
msg.data.completionListJson,
);
// maintain sort order from jedi
for (const [i, item] of list.entries()) {
item.sortText = String(i).padStart(5, '0');
}
console.debug(list);
complete.resolve({ suggestions: list });
console.debug(`${id}: resolved: ${msg.data.type}`);