Repository: sublimelsp/LSP

Issue:
mdpopup popups are rendered tiny
**Describe the bug**
I use `lsp_hover` function very often with my Rust development. It shows a popup window which has super small max_width and max_height properties. By default (an example "Dispatch" type) it looks like this: http://s.verknowsys.com/80a79f0d3b423fd7a7fdd335e15b9a4a.png

I altered User/mdpopups.css to decrease default font sizes, but I can't alter the width or height of the popup window.

Workaround:

edit `Packages/mdpopups/st3/mdpopups/__init__.py` file on line 610, and change "max_width=320, max_height=240," to some bigger numbers. I did "max_width=2160, max_height=2160,", but after ST4 restart I still have the width limited. Looks like this: http://s.verknowsys.com/4de808d955af370e9da630125f7c1295.png
It's better, but still width is not 2160 max.

**To Reproduce**
Steps to reproduce the behavior:
1. Latest ST4 build (b4098)
2. Use Rust Enhanced with rust-analyzer
3. Hover mouse on fern Dispatch type (or any well documented type?)
4. See small popup

**Expected behavior**
Popup should get as large as screen or at least as large as ST4 workspace/ canvas.

**Screenshots**
Yes, above.

**Environment (please complete the following information):**
- OS: macOS 11.2.1
- Sublime Text version: [build 4098]
- LSP version: 1.2.10 (latest)
- Language servers used: rust-analyzer (last non-nightly build available)

**Additional context**
None


Discussion:

Resolving patch:
diff --git a/plugin/completion.py b/plugin/completion.py
--- a/plugin/completion.py
+++ b/plugin/completion.py
@@ -44,13 +44,11 @@ def get_content(self, documentation: str, detail: str) -> str:
         return content
 
     def show_popup(self, minihtml_content: str) -> None:
-        viewport_width = self.view.viewport_extent()[0]
         show_lsp_popup(
             self.view,
             minihtml_content,
             flags=sublime.COOPERATE_WITH_AUTO_COMPLETE,
             md=True,
-            max_width=viewport_width,
             on_navigate=self.on_navigate)
 
     def on_navigate(self, url: str) -> None:
diff --git a/plugin/core/views.py b/plugin/core/views.py
--- a/plugin/core/views.py
+++ b/plugin/core/views.py
@@ -359,7 +359,6 @@ def text_document_code_action_params(
 
 
 def show_lsp_popup(view: sublime.View, contents: str, location: int = -1, md: bool = False, flags: int = 0,
-                   max_width: int = 800, max_height: int = 800,
                    css: Optional[str] = None, wrapper_class: Optional[str] = None,
                    on_navigate: Optional[Callable] = None, on_hide: Optional[Callable] = None) -> None:
     css = css if css is not None else lsp_css().popups
@@ -373,8 +372,8 @@ def show_lsp_popup(view: sublime.View, contents: str, location: int = -1, md: bo
         flags=flags,
         location=location,
         wrapper_class=wrapper_class,
-        max_width=max_width,
-        max_height=max_height,
+        max_width=int(view.em_width() * 120.0),  # Around 120 characters per line
+        max_height=1000000,
         on_navigate=on_navigate)
 
 
@@ -396,6 +395,7 @@ def minihtml(view: sublime.View, content: Union[str, Dict[str, str], list], allo
     Formats provided input content into markup accepted by minihtml.
 
     Content can be in one of those formats:
+
      - string: treated as plain text
      - MarkedString: string or { language: string; value: string }
      - MarkedString[]


Test patch: