Skip to content

Commit 810ee36

Browse files
committed
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.
1 parent dfe1d3b commit 810ee36

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/editor/sagas.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,15 @@ function* runJedi(): Generator {
698698
}
699699

700700
if (pythonMessageDidComplete.matches(msg.data)) {
701-
const list = JSON.parse(msg.data.completionListJson);
701+
const list: monaco.languages.CompletionItem[] = JSON.parse(
702+
msg.data.completionListJson,
703+
);
704+
705+
// maintain sort order from jedi
706+
for (const [i, item] of list.entries()) {
707+
item.sortText = String(i).padStart(5, '0');
708+
}
709+
702710
console.debug(list);
703711
complete.resolve({ suggestions: list });
704712
console.debug(`${id}: resolved: ${msg.data.type}`);

0 commit comments

Comments
 (0)