Skip to content

Commit

Permalink
editor/sagas: maintain jedi sort order
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dlech committed Dec 28, 2022
1 parent dfe1d3b commit 810ee36
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/editor/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down

0 comments on commit 810ee36

Please sign in to comment.