[gnome-builder/gnome-builder-3-18] python: make comment continuation a setting



commit 261c389d03c44e82ed8a676667fefb2fedf73808
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]