[arch-commits] Commit in python-language-server/repos (3 files)
Maxim Baz
maximbaz at archlinux.org
Sat Sep 21 00:33:14 UTC 2019
Date: Saturday, September 21, 2019 @ 00:33:14
Author: maximbaz
Revision: 511291
archrelease: copy trunk to community-testing-any
Added:
python-language-server/repos/community-testing-any/
python-language-server/repos/community-testing-any/PKGBUILD
(from rev 511290, python-language-server/trunk/PKGBUILD)
python-language-server/repos/community-testing-any/jedi15.patch
(from rev 511290, python-language-server/trunk/jedi15.patch)
--------------+
PKGBUILD | 47 +++++++++++++++++++++++++++++++
jedi15.patch | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 133 insertions(+)
Copied: python-language-server/repos/community-testing-any/PKGBUILD (from rev 511290, python-language-server/trunk/PKGBUILD)
===================================================================
--- community-testing-any/PKGBUILD (rev 0)
+++ community-testing-any/PKGBUILD 2019-09-21 00:33:14 UTC (rev 511291)
@@ -0,0 +1,47 @@
+# Maintainer: Morten Linderud <foxboron at archlinux.org>
+# Maintainer: Maxim Baz <$pkgname at maximbaz dot com>
+# Contributor: fenuks
+
+pkgname=python-language-server
+pkgver=0.28.3
+pkgrel=1
+pkgdesc="An implementation of the Language Server Protocol for Python"
+arch=("any")
+url="https://github.com/palantir/python-language-server"
+license=("MIT")
+depends=("python" "python-jsonrpc-server" "python-future" "python-jedi" "python-pluggy")
+optdepends=("python-mccabe: for complexity checking"
+ "python-rope: for completions and renaming"
+ "python-pyflakes: for linter to detect various errors"
+ "python-pycodestyle: for style checking"
+ "python-pylint: for code linting"
+ "autopep8: for code formatting"
+ "yapf: for code formatting (preferred over autopep8)"
+ "python-pydocstyle: for docstring style checking")
+makedepends=("python" "python-setuptools")
+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"
+ 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
+# }
+
+package() {
+ cd "${pkgname}-${pkgver}"
+ python setup.py install --root="${pkgdir}/" --optimize=1 --skip-build
+ install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+}
+
+# vim:set ts=4 sw=4 et:
Copied: python-language-server/repos/community-testing-any/jedi15.patch (from rev 511290, python-language-server/trunk/jedi15.patch)
===================================================================
--- community-testing-any/jedi15.patch (rev 0)
+++ community-testing-any/jedi15.patch 2019-09-21 00:33:14 UTC (rev 511291)
@@ -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