Skip to content

Commit

Permalink
Remove preserve_whitespace
Browse files Browse the repository at this point in the history
Tabs as used in python docstrings are not Markdown, work with python
language server to improve hovers
  • Loading branch information
tomv564 committed Oct 16, 2017
1 parent f837c94 commit 761c2c5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
7 changes: 0 additions & 7 deletions plugin/core/popups.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,3 @@
font-family: system;
}
'''


def preserve_whitespace(contents: str) -> str:
"""Preserve indentation in (non-markdown) ascii docstrings (e.g. pyls)"""
contents = contents.replace('\t', '\u00A0' * 4)
contents = contents.replace(' ', '\u00A0' * 2)
return contents
4 changes: 2 additions & 2 deletions plugin/hover.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .core.protocol import Request
from .core.documents import get_document_position
from .core.logging import debug
from .core.popups import preserve_whitespace, popup_css, popup_class
from .core.popups import popup_css, popup_class

SUBLIME_WORD_MASK = 515
NO_HOVER_SCOPES = 'comment, constant, keyword, storage, string'
Expand Down Expand Up @@ -95,7 +95,7 @@ def show_hover(self, point, contents):
if language:
formatted.append("```{}\n{}\n```\n".format(language, value))
else:
formatted.append(preserve_whitespace(value))
formatted.append(value)

mdpopups.show_popup(
self.view,
Expand Down
4 changes: 2 additions & 2 deletions plugin/signature_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from .core.configurations import is_supported_syntax, config_for_scope
from .core.protocol import Request
from .core.logging import debug
from .core.popups import preserve_whitespace, popup_css, popup_class
from .core.popups import popup_css, popup_class


class SignatureHelpListener(sublime_plugin.ViewEventListener):
Expand Down Expand Up @@ -147,4 +147,4 @@ def _build_popup_content(self) -> str:
sigDocs = signature.get('documentation', None)
if sigDocs:
formatted.append(sigDocs)
return preserve_whitespace("\n".join(formatted))
return "\n".join(formatted)

0 comments on commit 761c2c5

Please sign in to comment.