[gnome-builder/gnome-builder-3-18] jedi: be more careful with G-I param descriptions
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-3-18] jedi: be more careful with G-I param descriptions
- Date: Tue, 13 Oct 2015 07:33:15 +0000 (UTC)
commit e2323a4b3fadeda3a5d9aaa944bcdccdc8224a8c
Author: Christian Hergert <christian hergert me>
Date: Fri Oct 2 13:55:24 2015 -0700
jedi: be more careful with G-I param descriptions
plugins/jedi/jedi_plugin.py | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/plugins/jedi/jedi_plugin.py b/plugins/jedi/jedi_plugin.py
index b9c3361..29430db 100644
--- a/plugins/jedi/jedi_plugin.py
+++ b/plugins/jedi/jedi_plugin.py
@@ -327,7 +327,7 @@ class JediCompletionProvider(Ide.Object,
for param in params[:-1]:
tab_stop += 1
chunk = Ide.SourceSnippetChunk()
- chunk.set_text(param.description.replace('\n',''))
+ chunk.set_text(get_param_description(param))
chunk.set_text_set(True)
chunk.set_tab_stop(tab_stop)
snippet.add_chunk(chunk)
@@ -339,7 +339,7 @@ class JediCompletionProvider(Ide.Object,
tab_stop += 1
chunk = Ide.SourceSnippetChunk()
- chunk.set_text(params[-1].description.replace('\n',''))
+ chunk.set_text(get_param_description(params[-1]))
chunk.set_text_set(True)
chunk.set_tab_stop(tab_stop)
snippet.add_chunk(chunk)
@@ -400,10 +400,7 @@ class JediCompletionProposal(Ide.CompletionItem, GtkSource.CompletionProposal):
else:
params = self.completion.params
if params:
- for param in params[:-1]:
- parts.append(param.description.replace('\n',''))
- parts.append(', ')
- parts.append(params[-1].description.replace('\n',''))
+ parts.append(', '.join(get_param_description(p) for p in params))
parts.append(')')
return ''.join(parts)
@@ -436,3 +433,8 @@ class JediCompletionProposal(Ide.CompletionItem, GtkSource.CompletionProposal):
def is_completable_char(ch):
return ch in ('_', '.') or ch.isalnum()
+
+def get_param_description(param):
+ if hasattr(param, 'description'):
+ return param.description.replace('\n', '')
+ return param.name
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]