can't decorate comment on last line of file
WickyNilliams opened this issue · comments
to reproduce: place comment on last line of file, hit ctrl+enter
expected: decorated comment
actual: new line inserted
if there is a single line underneath the comment then a decorated comment is created as expected
Can confirm, exactly as described. I can also add that the same is also true for double-slash comment extension on the last line of a file.
So, to reiterate:
to reproduce: place comment on last line of file, hit enter
expected: extended double-slash inserted to new line
actual: plain new line inserted
A real edge case, huh? (Bad-dum tssss).
Actually, I think this is a bug in Sublime Text. Looking at the commands executed (sublime.log_commands(True)
), it's running the Add Line macro. However, look at the keybinding which triggers Add Line, and the binding which triggers comment decoration:
// Add Line
{ "keys": ["ctrl+enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line.sublime-macro"} },
// comment decoration
{ "keys": ["ctrl+enter"], "command": "jsdocs_decorate",
"context": [
{ "key": "selector", "operator": "equal", "operand": "comment.line.double-slash"}
]
},
If you press Alt+Ctrl+Shift+P with your cursor at the end of the file in a double-slash comment, it also shows the scope to be 'comment.line.double-slash.js', so the criteria for the decorate context should be met.
Given this underlying behaviour, and the edge case-iness of this issue, I'm going close with wontfix, sorry.