Skip to content

Commit

Permalink
Fix issue #681, filter candidates don't care isIncomplete is True or …
Browse files Browse the repository at this point in the history
…False.
  • Loading branch information
manateelazycat committed Jul 19, 2023
1 parent 9c4112b commit 4758674
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions core/handler/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,11 @@ def process_response(self, response: dict) -> None:
if response is not None:
item_index = 0

try:
# If LSP Sever return `isIncomplete` is False, we need pick value of option `incomplete-fuzzy-match`.
filter = self.prefix if not response.get("isIncomplete") else None
except:
filter = None

fuzzy = False
if filter:
for server in self.file_action.get_match_lsp_servers("completion"):
if server.server_name.endswith("#" + self.method_server_name):
fuzzy = server.server_info.get("incomplete-fuzzy-match")
break
for server in self.file_action.get_match_lsp_servers("completion"):
if server.server_name.endswith("#" + self.method_server_name):
fuzzy = server.server_info.get("incomplete-fuzzy-match")
break

# Some LSP server, such as Wen, need assign textEdit/newText to display-label.
display_new_text = False
Expand All @@ -112,8 +105,9 @@ def process_response(self, response: dict) -> None:
label = item["label"]
detail = item.get("detail", "")

# If LSP Sever return `isIncomplete` is False, need filter some candidate.
if filter and not string_match(label.lower(), filter.lower(), fuzzy=fuzzy):
# We always need filter label with input prefix and don't care isIncomplete whether is True or False.
# If some LSP server's `incomplete-fuzzy-match` option is True, we filter label with fuzzy algorithm.
if not string_match(label.lower(), self.prefix.lower(), fuzzy=fuzzy):
continue

annotation = kind if kind != "" else detail
Expand Down

0 comments on commit 4758674

Please sign in to comment.