From fa4072cbe7a7061cdb218b9a3619979f7facba0e Mon Sep 17 00:00:00 2001 From: Evgeny Kurnevsky Date: Wed, 8 May 2024 09:27:15 +0300 Subject: [PATCH] Fix doctor client command when html is not passed. Metals doesn't always pass html argument. For instance, when bloop process dies and metals shows message with open doctor request. --- lsp-metals.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lsp-metals.el b/lsp-metals.el index fb1178a..7f1e890 100644 --- a/lsp-metals.el +++ b/lsp-metals.el @@ -593,12 +593,14 @@ for more information on the metals \"files-decode\" command." "Generate doctor buffer name for the WORKSPACE." (format "*Metals Doctor: %s*" (process-id (lsp--workspace-cmd-proc workspace)))) -(defun lsp-metals--doctor-run (workspace html) +(defun lsp-metals--doctor-run (workspace &optional html?) "Focus on a window displaying troubleshooting help from the Metals doctor. HTML is the help contents. WORKSPACE is the workspace the client command was received from." - (pop-to-buffer (lsp-metals--generate-doctor-buffer-name workspace)) - (lsp-metals--render-html html)) + (if (not html?) + (lsp-send-execute-command "doctor-run" ()) + (pop-to-buffer (lsp-metals--generate-doctor-buffer-name workspace)) + (lsp-metals--render-html html?))) (defun lsp-metals--doctor-reload (workspace html) "Reload the HTML contents of an open Doctor window, if any.