From b47dfc3987a7af8d44737006a6d9e4d98d84a21a Mon Sep 17 00:00:00 2001 From: Koen Lageveen Date: Fri, 15 Sep 2017 14:27:38 +0200 Subject: [PATCH 1/3] need a space before concatting --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index ef320c640..ead0e8f69 100644 --- a/main.py +++ b/main.py @@ -1518,8 +1518,8 @@ def start_client(window: sublime.Window, config: ClientConfig): client = start_server(expanded_args, project_path) if not client: - window.status_message("Could not start" + config.name + ", disabling") - debug("Could not start", config.binary_args, ", disabling") + window.status_message("Could not start " + config.name + ", disabling") + debug("Could not start ", config.binary_args, ", disabling") return initializeParams = { From 5456f519f8f382a8f967b49a54863659760292f7 Mon Sep 17 00:00:00 2001 From: Koen Lageveen Date: Fri, 15 Sep 2017 21:23:32 +0200 Subject: [PATCH 2/3] No extra space needed at debug message --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index ead0e8f69..b639770d5 100644 --- a/main.py +++ b/main.py @@ -1519,7 +1519,7 @@ def start_client(window: sublime.Window, config: ClientConfig): client = start_server(expanded_args, project_path) if not client: window.status_message("Could not start " + config.name + ", disabling") - debug("Could not start ", config.binary_args, ", disabling") + debug("Could not start", config.binary_args, ", disabling") return initializeParams = { From f6afca19844ee07641f62aa062e0b177c5e17500 Mon Sep 17 00:00:00 2001 From: Koen Lageveen Date: Sun, 8 Oct 2017 17:50:29 +0200 Subject: [PATCH 3/3] improve whitespace in diagnostics popup --- main.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 550dfaf57..2e6193e07 100644 --- a/main.py +++ b/main.py @@ -1983,6 +1983,7 @@ def handle_response(self, response, point): # Flow returns None sometimes # See: https://github.com/flowtype/flow-language-server/issues/51 contents = response.get('contents') or contents + print(contents) self.show_hover(point, contents) def show_diagnostics_hover(self, point, diagnostics): @@ -2022,14 +2023,35 @@ def show_hover(self, point, contents): value = item.get("value") language = item.get("language") if language: - formatted.append("```{}\n{}\n```".format(language, value)) + formatted.append("```{}\n{}\n```\n".format(language, value)) else: - formatted.append(value) + formatted.append("
{}
".format(value)) + # print(formatted) mdpopups.show_popup( self.view, preserve_whitespace("\n".join(formatted)), - css=".mdpopups .lsp_hover { margin: 4px; } .mdpopups p { margin: 0.1rem; }", + css=''' + .mdpopups .lsp_hover { + margin: 0.25rem; + } + .mdpopups .lsp_hover div.highlight, + .mdpopups .lsp_hover pre.highlight { + margin: 0; + } + .mdpopups .lsp_hover .text, + .mdpopups .lsp_hover p { + margin: 0; + padding: 0; + } + .mdpopups .lsp_hover p .text { + position: relative; + top: -0.5rem; + margin: 0 .5rem; + padding: 1px; + font-family: sans-serif; + } + ''', md=True, flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY, location=point, @@ -2040,6 +2062,8 @@ def show_hover(self, point, contents): def preserve_whitespace(contents: str) -> str: """Preserve empty lines and whitespace for markdown conversion.""" contents = contents.strip(' \t\r\n') + contents = contents.replace('\r\n', '\n') + contents = contents.replace('\n