Skip to content

Commit

Permalink
fix: mutability bug
Browse files Browse the repository at this point in the history
format_completion index for the first completion item will be 0,
second 2,
third 4

after this PR the index will be 0,
second 1,
third 2
  • Loading branch information
predragnikolic committed Feb 24, 2021
1 parent 4281463 commit 60b8869
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugin/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,9 @@ def _on_all_settled(
response_items = sorted(response_items, key=lambda item: item.get("sortText") or item["label"])
LspResolveDocsCommand.completions.extend(response_items)
can_resolve_completion_items = session.has_capability('completionProvider.resolveProvider')
items_count = len(items)
items.extend(
format_completion(response_item, len(items) + index, can_resolve_completion_items, session.config.name)
format_completion(response_item, items_count + index, can_resolve_completion_items, session.config.name)
for index, response_item in enumerate(response_items))
if items:
flags |= sublime.INHIBIT_REORDER
Expand Down

0 comments on commit 60b8869

Please sign in to comment.