Skip to content

Commit 6b5ec0b

Browse files
committed
setting for indentation, fixes #21
1 parent 7fc51a0 commit 6b5ec0b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@
3838
"ignore" : ["SettingsProjectScope", "SettingsResourceScope"]
3939
}
4040
""")
41+
Settings().register_setting("snippets.indentation", """
42+
{
43+
"title" : "Indentation Syntax highlighting for snippets",
44+
"type" : "string",
45+
"default" : " ",
46+
"description" : "String to use for indentation in snippets (tip: to use a tab, copy/paste a tab from another text field and paste here)",
47+
"ignore" : ["SettingsProjectScope", "SettingsResourceScope"]
48+
}
49+
""")
4150

4251

4352
snippetPath = os.path.realpath(os.path.join(user_plugin_path(), "..", "snippets"))
@@ -191,10 +200,11 @@ def __init__(self, context, parent=None):
191200
self.browseButton.setIcon(QIcon.fromTheme("edit-undo"))
192201
self.deleteSnippetButton = QPushButton("Delete")
193202
self.newSnippetButton = QPushButton("New Snippet")
203+
indentation = Settings().get_string("snippets.indentation")
194204
if Settings().get_bool("snippets.syntaxHighlight"):
195-
self.edit = QCodeEditor(SyntaxHighlighter=Pylighter)
205+
self.edit = QCodeEditor(SyntaxHighlighter=Pylighter, delimeter = indentation)
196206
else:
197-
self.edit = QCodeEditor(SyntaxHighlighter=None)
207+
self.edit = QCodeEditor(SyntaxHighlighter=None, delimeter = indentation)
198208
self.edit.setPlaceholderText("python code")
199209
self.resetting = False
200210
self.columns = 3

0 commit comments

Comments
 (0)