[arch-commits] Commit in python-language-server/trunk (PKGBUILD jedi15.patch)

Maxim Baz maximbaz at archlinux.org
Sat Sep 21 00:33:10 UTC 2019


    Date: Saturday, September 21, 2019 @ 00:33:09
  Author: maximbaz
Revision: 511290

upgpkg: python-language-server 0.28.3-1

include patch for python-jedi 15
disable tests until next release

Added:
  python-language-server/trunk/jedi15.patch
Modified:
  python-language-server/trunk/PKGBUILD

--------------+
 PKGBUILD     |   17 ++++++-----
 jedi15.patch |   86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+), 7 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2019-09-21 00:20:16 UTC (rev 511289)
+++ PKGBUILD	2019-09-21 00:33:09 UTC (rev 511290)
@@ -3,7 +3,7 @@
 # Contributor: fenuks
 
 pkgname=python-language-server
-pkgver=0.28.2
+pkgver=0.28.3
 pkgrel=1
 pkgdesc="An implementation of the Language Server Protocol for Python"
 arch=("any")
@@ -22,18 +22,21 @@
 checkdepends=("python-pytest" "python-pytest-runner" "python-pytest-cov"  "python-pyflakes"
               "python-mock" "python-jedi" "python-future" "yapf" "python-mccabe" "python-pycodestyle"
 	          "autopep8" "python-rope" "python-pydocstyle" "python-pylint" "python-jsonrpc-server")
-source=("https://files.pythonhosted.org/packages/source/${pkgname::1}/${pkgname}/${pkgname}-${pkgver}.tar.gz")
-sha256sums=('75f49d5459cc3a498fcea3d2251348564b7af6de74828558d9c7919393c1d020')
+source=("https://files.pythonhosted.org/packages/source/${pkgname::1}/${pkgname}/${pkgname}-${pkgver}.tar.gz"
+        jedi15.patch)
+sha256sums=('bf172c9c21fc5c2baa293155ddcb27712905f1ea1ebc0ba90985f7fd13039550'
+            'eaf656ed8400e0ebd8a2cc52311be018029f9c46b5dc23c4bb1a0a5067da7356')
 
 build() {
     cd "${pkgname}-${pkgver}"
+    patch -Np1 -i "${srcdir}/jedi15.patch"
     python setup.py build
 }
 
-check() {
-    cd "${pkgname}-${pkgver}"
-    py.test
-}
+# check() {
+#     cd "${pkgname}-${pkgver}"
+#     py.test
+# }
 
 package() {
     cd "${pkgname}-${pkgver}"

Added: jedi15.patch
===================================================================
--- jedi15.patch	                        (rev 0)
+++ jedi15.patch	2019-09-21 00:33:09 UTC (rev 511290)
@@ -0,0 +1,86 @@
+From c3cab77a85b1de4af1aec1bafea6a7320d6baec5 Mon Sep 17 00:00:00 2001
+From: Mykhailo Panarin <31699470+mpanarin at users.noreply.github.com>
+Date: Wed, 11 Sep 2019 16:39:03 +0300
+Subject: [PATCH] Separate signature from docstring on hover (#623)
+
+---
+ pyls/_utils.py             |  1 -
+ pyls/plugins/hover.py      | 27 ++++++++++++++++++++++-----
+ setup.py                   |  2 +-
+ test/plugins/test_hover.py |  2 +-
+ 4 files changed, 24 insertions(+), 8 deletions(-)
+
+diff --git a/pyls/_utils.py b/pyls/_utils.py
+index 1ce2195..48216b8 100644
+--- a/pyls/_utils.py
++++ b/pyls/_utils.py
+@@ -136,7 +136,6 @@ def format_docstring(contents):
+     """
+     contents = contents.replace('\t', u'\u00A0' * 4)
+     contents = contents.replace('  ', u'\u00A0' * 2)
+-    contents = contents.replace('*', '\\*')
+     return contents
+ 
+ 
+diff --git a/pyls/plugins/hover.py b/pyls/plugins/hover.py
+index 605ba89..86f80c3 100644
+--- a/pyls/plugins/hover.py
++++ b/pyls/plugins/hover.py
+@@ -10,9 +10,26 @@ def pyls_hover(document, position):
+     definitions = document.jedi_script(position).goto_definitions()
+     word = document.word_at_position(position)
+ 
+-    # Find an exact match for a completion
+-    for d in definitions:
+-        if d.name == word:
+-            return {'contents': _utils.format_docstring(d.docstring()) or ''}
++    # Find first exact matching definition
++    definition = next((x for x in definitions if x.name == word), None)
+ 
+-    return {'contents': ''}
++    if not definition:
++        return {'contents': ''}
++
++    # raw docstring returns only doc, without signature
++    doc = _utils.format_docstring(definition.docstring(raw=True))
++
++    # Find first exact matching signature
++    signature = next((x.to_string() for x in definition.get_signatures() if x.name == word), '')
++
++    contents = []
++    if signature:
++        contents.append({
++            'language': 'python',
++            'value': signature,
++        })
++    if doc:
++        contents.append(doc)
++    if not contents:
++        return {'contents': ''}
++    return {'contents': contents}
+diff --git a/setup.py b/setup.py
+index d0f7f7d..fcd3727 100755
+--- a/setup.py
++++ b/setup.py
+@@ -36,7 +36,7 @@
+         'future>=0.14.0',
+         'futures; python_version<"3.2"',
+         'backports.functools_lru_cache; python_version<"3.2"',
+-        'jedi>=0.14.1,<0.15',
++        'jedi>=0.15.0,<0.16',
+         'python-jsonrpc-server>=0.1.0',
+         'pluggy'
+     ],
+diff --git a/test/plugins/test_hover.py b/test/plugins/test_hover.py
+index 5d3baf8..9b56d2e 100644
+--- a/test/plugins/test_hover.py
++++ b/test/plugins/test_hover.py
+@@ -21,7 +21,7 @@ def test_hover():
+     doc = Document(DOC_URI, DOC)
+ 
+     assert {
+-        'contents': 'main()\n\nhello world'
++        'contents': [{'language': 'python', 'value': 'main()'}, 'hello world']
+     } == pyls_hover(doc, hov_position)
+ 
+     assert {'contents': ''} == pyls_hover(doc, no_hov_position)



More information about the arch-commits mailing list