谁能指出我的插件方向或其他格式化评论?
我使用的是coffeescript,注释与python 相同(#line,### 块###),尽管javascript 注释也直接通过编译器。
谁能指出我的插件方向或其他格式化评论?
我使用的是coffeescript,注释与python 相同(#line,### 块###),尽管javascript 注释也直接通过编译器。
好的,事实证明,Edit -> Wrap
评论保持不变 - 完整的 newby。
我没有插件,但我可以提供我编写的 python 脚本。在“用户输入的评论”(uec)变量中输入您的评论作为字符串,保存并运行。它将格式化一个由 80 个字符的井号包围的块引用。如果您需要更短或更长的块报价,则只需更改 80、78 和 76。
def first2lines(): return str(('#' * 80) + '\n' + '#' + (' ' * 78) + '#') # first two lines
def leftSide(): return '# ' # left side of border
def rightSide(): return ' #' # right side of border
def last2lines(): return str('#' + (' ' * 78) + '#' + '\n' + ('#' * 80)) # last two lines
# user entered comment
uec = "This program will neatly format a programming comment block so that it's surrounded by pound signs (#). It does this by splitting the comment into a list and then concatenating strings each no longer than 76 characters long including the correct amount of right side space padding. "
if len(uec) > 0:
eosm = '<<<EOSM>>>' # end of string marker
comment = uec + ' ' + eosm
wordList = comment.split() # load the comment into a list
tmpString = '' # temporarily holds loaded elements
loadComment = '' # holds the elements that will be printed
counter = 0 # keeps track of the number of elements/words processed
space = 0 # holds right side space padding
last = wordList.index(wordList[-1]) # numerical position of last element
print first2lines()
for word in wordList:
tmpString += word + ' ' # load the string until length is greater than 76
# processes and prints all comment lines except the last one
if len(tmpString.rstrip()) > 76:
tmpList = tmpString.split()
tmpString = tmpList[-1] + ' ' # before popping last element load it for the beginning of the next cycle
tmpList.pop()
for tmp in tmpList:
loadComment += tmp + ' '
loadComment = loadComment.rstrip()
space = 76 - len(loadComment)
print leftSide() + loadComment + (space * ' ') + rightSide()
loadComment = ''
# processes and prints the last comment line
elif len(tmpString.rstrip()) <= 76 and counter == last:
tmpList = tmpString.split()
tmpList.pop()
for tmp in tmpList:
loadComment += tmp + ' '
loadComment = loadComment.rstrip()
space = 76 - len(loadComment)
print leftSide() + loadComment + (space * ' ') + rightSide()
counter += 1
print last2lines()
else:
print first2lines()
print leftSide() + "The length of your comment is zero, it must be at least one character long. " + rightSide()
print last2lines()
您可以使用 netbeans,它具有自动格式化 Alt+Mayus+F