Skip to content

Commit

Permalink
Merge pull request revathskumar#12 from phts/trailing-empty-line
Browse files Browse the repository at this point in the history
Add an option to insert trailing line to comments
  • Loading branch information
revathskumar authored Jan 11, 2017
2 parents 7ce0045 + de734ac commit 151b45d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion yardoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class YardocCommand(sublime_plugin.TextCommand):
def load_config(self):
self.settings = {}
settings = sublime.load_settings('yardoc.sublime-settings')
for setting in ['trailing_spaces', 'initial_empty_line']:
for setting in ['trailing_spaces', 'initial_empty_line', 'trailing_empty_line']:
if settings.get(setting) is None:
continue
self.settings[setting] = settings.get(setting)
Expand Down Expand Up @@ -119,6 +119,8 @@ def method_doc(self, params_match, current_line, indent):

lines.append("#" + self.trailing_spaces)
lines.append("# @return [${1:type}] ${1:[description]}")
if(self.settings.get('trailing_empty_line')):
lines.append("#" + self.trailing_spaces)

return self.format_lines(indent, lines)

Expand All @@ -128,6 +130,8 @@ def module_doc(self, current_line, indent):
lines.append("#" + self.trailing_spaces)
lines.append("# ${1:[module description]}")
lines.extend(self.get_author())
if(self.settings.get('trailing_empty_line')):
lines.append("#" + self.trailing_spaces)
return self.format_lines(indent, lines)

def class_doc(self, params_match, current_line, indent):
Expand All @@ -136,6 +140,8 @@ def class_doc(self, params_match, current_line, indent):
lines.append("#" + self.trailing_spaces)
lines.append("# ${1:[class description]}")
lines.extend(self.get_author())
if(self.settings.get('trailing_empty_line')):
lines.append("#" + self.trailing_spaces)
return self.format_lines(indent, lines)

def compose_doc(self, current_line, edit):
Expand Down
4 changes: 3 additions & 1 deletion yardoc.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
// Determines if empty comment lines have a trailing space
"trailing_spaces": true,
// Add an initial empty line at the beginning of the comment
"initial_empty_line": true
"initial_empty_line": true,
// Add an empty line at the end of the comment
"trailing_empty_line": false
}

0 comments on commit 151b45d

Please sign in to comment.