Hi,
In my earlier post, I provided code to embed user content on headerTemplate comment. In this post, will provide the code to add developer comments whenever a (base)code is modified by any developer.For this, we need to add a new method to class EditorScripts. I created a new method by name Custom_InsertComments with the following code.
public void Custom_InsertComments(Editor _editor)
{
int startLine = _editor.selectionStartLine();
int endLine = _editor.selectionEndLine();
TempStr tab;
UserInfo userInfo;
#define.Start('Start ->>')
#define.End('<<-end')
#define.StartColumn(1)
#define.EndColumn(2)
#define.Comment('//')
#xppTexts
;
select Name from userInfo
where userInfo.Id == curUserId();
tab = _editor.selectionStartCol() == #StartColumn ? '' : #tab;
_editor.gotoCol(#StartColumn);
_editor.unmark();
_editor.gotoLine(startline);
_editor.insertLines(strFmt('%1%2 Developed by %3 %4 - Project:%5 %6 %7', tab, #Comment, UserInfo.name, DateTimeUtil::utcNow(), userInfo.StartupProject, #Start, #newline));
_editor.gotoLine(endline + #EndColumn);
_editor.insertLines(strFmt('%1%2 Developed by %3 %4 - Project:%5 %6 %7', tab, #Comment, UserInfo.name, DateTimeUtil::utcNow(), userInfo.StartupProject, #End, #newline));
}
Comment:
Output would be like:

Like
Report
*This post is locked for comments