Open rgpublic opened 6 years ago
This is also the case for error messages, making getting rid of them difficult as the 'x' to close is at the right side of the window, which might require scrolling the text editor window to close.
turns out the fix is really simple
remove the last 'replace' call in escape_html of {package}\typescript\libs\text_helpers.py should be:
def escape_html(raw_string):
"""Escape html content
Note: only use for short strings
"""
return raw_string.replace('&', '&').replace('<', '<').replace('>', '>').replace('\n', '<br>')
Sublime text will automatically wrap things, but the use of ' ' confuses their parsing I guess
EDIT: I also changed the max size of the tooltip to be the same as the current viewport (open file), but this probably isn't the best way to handle it for everyone.
As of right now, the default is to set the max-size as 1500, which I wasn't a huge fan of.
to do something similar, replace line 69 in typescript/commands/quick_info.py with
size = self.view.viewport_extent()
self.view.show_popup(html, flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY, location=display_point, max_width=size[0], max_height=size[1])
@stweedie I couldn't get your fix to work :/ Then again I have never python'ed before lol Maybe a PR if you get it working?
@stweedie's solution didn't quite work for me (possibly a difference across OS?):
For the text_helpers.py
fix, it's definitely an improvement (and the original code definitely seems wrong—why would you replace all space characters with non-breakable spaces??) and does cause auto-wrapping, but it leads to strange/arbitrary line-breaks:
For the quick_info.py
fix, I think size
is not defined (as the popup does not appear at all when using it, and size
does not appear anywhere else within the file). Instead, I just set the values to 400 and 800 respectively.
His solutions at least make it useable 🎉
Yeah it's been awhile since I've looked into this issue. The changes to 'escape html' might be pretty far reaching, but they seemed to work in my setup. Granted, to really fix the issue I assume one would have to inspect the formatting of the response from the integrated tsc server and make changes according to that.
the 'size' variable was one I added myself, to get the size of the current viewport and use that for max width and height
It should wrap properly instead of having to scroll horizontally. Making the font size smaller with "typescript_popup_font_size" doesnt seem to work either.