Skip to content

Commit 7dc3e1c

Browse files
committed
Fix handling code fix.
See #158.
1 parent 398906e commit 7dc3e1c

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

rplugin/python3/LanguageClient/LanguageClient.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,20 +1251,27 @@ def textDocument_codeAction(
12511251

12521252
@neovim.function("LanguageClient_FZFSinkTextDocumentCodeAction")
12531253
def fzfSinkTextDocumentCodeAction(self, lines: str) -> None:
1254-
command, _ = lines[0].split(":")
1254+
command, title = lines[0].split(":")
1255+
command = command.strip()
1256+
title = title.strip()
1257+
logger.info("Selected action with command {} title {}".format(
1258+
json.dumps(command), json.dumps(title)))
12551259
entry = next((entry for entry in state["codeActionCommands"]
1256-
if entry["command"] == command), None)
1260+
if entry["command"] == command and entry["title"] == title),
1261+
None)
12571262

12581263
if entry is None:
1259-
msg = "Failed to find command: {}".format(command)
1264+
msg = "Failed to find action entry. Command: {}. Title: {}.".format(
1265+
json.dumps(command), json.dumps(title))
12601266
logger.error(msg)
12611267
echoerr(msg)
12621268
return
12631269

12641270
if self.try_handle_command_by_client(entry):
12651271
return
12661272

1267-
self.workspace_executeCommand(command=command, arguments=entry.get("arguments"))
1273+
self.workspace_executeCommand(command=command,
1274+
arguments=entry.get("arguments"))
12681275
update_state({
12691276
"codeActionCommands": [],
12701277
})
@@ -1277,6 +1284,8 @@ def try_handle_command_by_client(self, entry: Dict) -> bool:
12771284
command = CommandsClient(entry["command"])
12781285
except KeyError:
12791286
return False
1287+
except ValueError:
1288+
return False
12801289

12811290
if command == CommandsClient.JavaApplyWorkspaceEdit:
12821291
for edit in entry["arguments"]:

0 commit comments

Comments
 (0)