From 01fd1aa9a8add68159d19866f30b53c8d73cb8fa Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Thu, 14 Feb 2019 13:07:20 +0000 Subject: [PATCH 1/8] Remove pep8 dependency since it is now replaced by pycodestyle. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0af39ce7..817c1111 100644 --- a/setup.py +++ b/setup.py @@ -58,7 +58,7 @@ def readme(): 'pyqode.qt', 'pyqode.core', 'jedi', - 'pep8', + 'pycodestyle', 'pyflakes', 'docutils' ] From 570117af6e0081248c12a23d379de5d0b10077d3 Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Thu, 14 Feb 2019 13:14:03 +0000 Subject: [PATCH 2/8] Fix jedi `defines_names` - see https://github.com/tkf/emacs-jedi/pull/296. --- test/test_backend/test_workers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_backend/test_workers.py b/test/test_backend/test_workers.py index e546cf5c..44021a18 100644 --- a/test/test_backend/test_workers.py +++ b/test/test_backend/test_workers.py @@ -72,7 +72,7 @@ def test_extract_def(): editor.show() app.exec() """ - for definition in jedi.defined_names(code): + for definition in jedi.names(code): result = workers._extract_def(definition, "") assert result From 821e000ea2e2638a82ce095a559e69afd9bd4f38 Mon Sep 17 00:00:00 2001 From: Nils Cedric Holle Date: Thu, 21 Feb 2019 22:01:18 +0100 Subject: [PATCH 3/8] Update version --- pyqode/python/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyqode/python/__init__.py b/pyqode/python/__init__.py index 754a4959..63769456 100644 --- a/pyqode/python/__init__.py +++ b/pyqode/python/__init__.py @@ -7,4 +7,4 @@ """ -__version__ = '2.11.1' +__version__ = '2.12.0' From 10597aac54d1af113ac0595e893ef4d7c757d65f Mon Sep 17 00:00:00 2001 From: Sebastiaan Mathot Date: Thu, 25 Jul 2019 09:50:17 +0200 Subject: [PATCH 4/8] Bump to 2.12.1a1 --- pyqode/python/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyqode/python/__init__.py b/pyqode/python/__init__.py index 63769456..75435a28 100644 --- a/pyqode/python/__init__.py +++ b/pyqode/python/__init__.py @@ -7,4 +7,4 @@ """ -__version__ = '2.12.0' +__version__ = '2.12.1a1' From 62ebd81e22d1d507c994f9cc046fe98fcba5e633 Mon Sep 17 00:00:00 2001 From: Sebastiaan Mathot Date: Thu, 25 Jul 2019 09:50:41 +0200 Subject: [PATCH 5/8] Catch Exceptions from jedi --- pyqode/python/backend/workers.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pyqode/python/backend/workers.py b/pyqode/python/backend/workers.py index 6ff02c27..e7e1aaa6 100644 --- a/pyqode/python/backend/workers.py +++ b/pyqode/python/backend/workers.py @@ -38,7 +38,14 @@ def calltips(request_data): # encoding = request_data['encoding'] encoding = 'utf-8' # use jedi to get call signatures - script = jedi.Script(code, line, column, path, encoding) + try: + script = jedi.Script(code, line, column, path, encoding) + except ValueError: + # Is triggered when an the position is invalid, for example if the + # column is larger or equal to the line length. This may be due to a + # bug elsewhere in PyQode, but this at least suppresses the error + # message, and does not seem to hve any adverse side effects. + return [] signatures = script.call_signatures() for sig in signatures: results = (str(sig.module_name), str(sig.name), @@ -315,7 +322,7 @@ def complete(code, line, column, path, encoding, prefix): script = jedi.Script(code, line + 1, column, path, encoding) completions = script.completions() print('completions: %r' % completions) - except jedi.NotFoundError: + except RuntimeError: completions = [] for completion in completions: ret_val.append({ From 0f096f361bb2d44825d4fd574d1a0e0943e71569 Mon Sep 17 00:00:00 2001 From: Sebastiaan Mathot Date: Thu, 25 Jul 2019 12:57:16 +0200 Subject: [PATCH 6/8] PyAutoIndentMode: don't assume space-based indentation --- pyqode/python/modes/autoindent.py | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pyqode/python/modes/autoindent.py b/pyqode/python/modes/autoindent.py index 4f6c0a21..69582b1c 100644 --- a/pyqode/python/modes/autoindent.py +++ b/pyqode/python/modes/autoindent.py @@ -60,7 +60,7 @@ def _get_indent(self, cursor): elif line.endswith("\\"): # if user typed \ and press enter -> indent is always # one level higher - post += self.editor.tab_length * " " + post += self._single_indent elif (fullline.endswith((')', '}', ']')) and lastword.endswith((')', '}', ']'))): post = self._handle_indent_after_paren(cursor, post) @@ -260,11 +260,11 @@ def _handle_indent_between_paren(self, column, line, parent_impl, tc): open_line_txt = self._helper.line_text(open_line) open_line_indent = len(open_line_txt) - len(open_line_txt.lstrip()) if prev_open: - post = (open_line_indent + self.editor.tab_length) * ' ' + post = open_line_indent * self._indent_char + self._single_indent elif next_close and prev_char != ',': - post = open_line_indent * ' ' + post = open_line_indent * self._indent_char elif tc.block().blockNumber() == open_line: - post = open_symbol_col * ' ' + post = open_symbol_col * self._indent_char # adapt indent if cursor on closing line and next line have same # indent -> PEP8 compliance @@ -272,12 +272,12 @@ def _handle_indent_between_paren(self, column, line, parent_impl, tc): txt = self._helper.line_text(close_line) bn = tc.block().blockNumber() flg = bn == close_line - next_indent = self._helper.line_indent(bn + 1) * ' ' + next_indent = self._helper.line_indent(bn + 1) * self._indent_char if flg and txt.strip().endswith(':') and next_indent == post: # | look at how the previous line ( ``':'):`` ) was # over-indented, this is actually what we are trying to # achieve here - post += self.editor.tab_length * ' ' + post += self._single_indent # breaking string if next_char in ['"', "'"]: @@ -319,19 +319,19 @@ def _handle_indent_inside_string(self, char, cursor, fullline, post): # break string with a '\' at the end of the original line, always # breaking strings enclosed by parens is done in the # _handle_between_paren method - n = self.editor.tab_length pre = '%s \\' % char - post += n * ' ' + post += self._single_indent if fullline.endswith(':'): - post += n * " " + post += self._single_indent post += char return post, pre def _handle_new_scope_indentation(self, cursor, fullline): try: - indent = (self._get_indent_of_opening_paren(cursor) + - self.editor.tab_length) - post = indent * " " + post = ( + self._get_indent_of_opening_paren(cursor) * self._indent_char + + self._single_indent + ) except TypeError: # e.g indent is None (meaning the line does not ends with ):, ]: # or }: @@ -349,15 +349,15 @@ def check_kw_in_line(kwds, lparam): while not check_kw_in_line(kw, l) and ln: ln -= 1 l = self._helper.line_text(ln) - indent = (len(l) - len(l.lstrip())) * " " - indent += self.editor.tab_length * " " + indent = (len(l) - len(l.lstrip())) * self._indent_char + indent += self._single_indent post = indent return post def _handle_indent_after_paren(self, cursor, post): indent = self._get_indent_of_opening_paren(cursor) if indent is not None: - post = indent * " " + post = indent * self._indent_char return post def _handle_indent_in_statement(self, fullline, lastword, post, pre): @@ -366,7 +366,7 @@ def _handle_indent_in_statement(self, fullline, lastword, post, pre): pre += " \\" else: pre += '\\' - post += self.editor.tab_length * " " + post += self._single_indent if fullline.endswith(':'): - post += self.editor.tab_length * " " + post += self._single_indent return post, pre From 94559775adc361cd735bbe4c1a0736e63cee4041 Mon Sep 17 00:00:00 2001 From: Sebastiaan Mathot Date: Tue, 30 Jul 2019 21:14:49 +0200 Subject: [PATCH 7/8] PyIndenterMode: treat unindent as single undo action --- pyqode/python/modes/indenter.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/pyqode/python/modes/indenter.py b/pyqode/python/modes/indenter.py index f9dcede4..3c89da3a 100644 --- a/pyqode/python/modes/indenter.py +++ b/pyqode/python/modes/indenter.py @@ -47,15 +47,7 @@ def indent(self): if cursor.hasSelection(): self.indent_selection(cursor) else: - # simply insert indentation at the cursor position - tab_len = self.editor.tab_length - cursor.beginEditBlock() - if self.editor.use_spaces_instead_of_tabs: - cursor.insertText(tab_len * " ") - else: - cursor.insertText('\t') - cursor.endEditBlock() - self.editor.setTextCursor(cursor) + cursor.insertText(self._single_indent) def unindent(self): """ @@ -63,9 +55,12 @@ def unindent(self): """ if self.tab_always_indent: cursor = self.editor.textCursor() + cursor.beginEditBlock() if not cursor.hasSelection(): cursor.select(cursor.LineUnderCursor) self.unindent_selection(cursor) + cursor.endEditBlock() + self.editor.setTextCursor(cursor) else: super(PyIndenterMode, self).unindent() From 1ad7ff57653642afcbe6d4ef7bed3a4c8b3ff7b2 Mon Sep 17 00:00:00 2001 From: Nils Cedric Holle Date: Sun, 4 Aug 2019 15:47:34 +0200 Subject: [PATCH 8/8] Bump version to 2.12.1 --- pyqode/python/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyqode/python/__init__.py b/pyqode/python/__init__.py index 75435a28..3dee597b 100644 --- a/pyqode/python/__init__.py +++ b/pyqode/python/__init__.py @@ -7,4 +7,4 @@ """ -__version__ = '2.12.1a1' +__version__ = '2.12.1'