[gnome-builder] python: make comment continuation a setting
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] python: make comment continuation a setting
- Date: Sat, 3 Oct 2015 22:29:15 +0000 (UTC)
commit 86c5f885b843472a4a6575029107ac686e31aa57
Author: Christian Hergert <christian hergert me>
Date: Sat Oct 3 15:17:50 2015 -0700
python: make comment continuation a setting
plugins/python-pack/python_indenter.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/plugins/python-pack/python_indenter.py b/plugins/python-pack/python_indenter.py
index 9c86c20..3554238 100644
--- a/plugins/python-pack/python_indenter.py
+++ b/plugins/python-pack/python_indenter.py
@@ -422,6 +422,7 @@ class PythonSettings:
align_params = True
indent_width = 4
insert_spaces = True
+ continue_comments = True
class PythonIndenter(GObject.Object): #, Ide.Indenter):
settings = None
@@ -470,8 +471,13 @@ class PythonIndenter(GObject.Object): #, Ide.Indenter):
nearest = discoveries.nearest
+ # If we are in a comment, continue the comment on the new line,
+ # possibly adding the prefixing "# ".
if nearest.rank == Rank.COMMENT:
- return self.copy_indent(view, iter, suffix='# ')
+ suffix = ''
+ if self.settings.continue_comments:
+ suffix = '# '
+ return self.copy_indent(view, iter, suffix=suffix)
if self.settings.align_params \
and discoveries.select_tail(Rank.FUNCTION, Rank.TUPLE):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]