Insert Automatic Comments in Visual Studio Code

Vipin Kumar
Vipin Kumar used Ask the Experts™
on
Hi,

I am working on the Visual Studio Code editor, I want to achieve is that whenever i make changes to my code and save the file the date, time and a variable string(to be used to summarize what changes done) should be automatically created in the header section of my file where my comments are already inserted. A sample is provided below.

/***************************************************************************************************
Procedure:          dbo.usp_DoSomeStuff
Create Date:        2018-01-25
Author:             Joe Expert
Description:        Verbose description of what the query does goes here. Be specific and don't be
                    afraid to say too much. More is better, than less, every single time. Think about
                    "what, when, where, how and why" when authoring a description.
Call by:            [schema.usp_ProcThatCallsThis]
                    [Application Name]
                    [Job]
                    [PLC/Interface]
Affected table(s):  [schema.TableModifiedByProc1]
                    [schema.TableModifiedByProc2]
Used By:            Functional Area this is use in, for example, Payroll, Accounting, Finance
Parameter(s):       @param1 - description and usage
                    @param2 - description and usage
Usage:              EXEC dbo.usp_DoSomeStuff
                        @param1 = 1,
                        @param2 = 3,
                        @param3 = 2
                    Additional notes or caveats about this object, like where is can and cannot be run, or
                    gotchas to watch for when using it.
****************************************************************************************************
SUMMARY OF CHANGES
Date(yyyy-mm-dd)    Author              Comments
------------------- ------------------- ------------------------------------------------------------
2012-04-27          John Usdaworkhur    Move Z <-> X was done in a single step. Warehouse does not
                                        allow this. Converted to two step process.
                                        Z <-> 7 <-> X
                                            1) move class Z to class 7
                                            2) move class 7 to class X

2018-03-22          Maan Widaplan       General formatting and added header information.
2018-03-22          Maan Widaplan       Added logic to automatically Move G <-> H after 12 months.
***************************************************************************************************/

Open in new window


i have found many extensions that helps insert comments on the header of the file or where ever the cursor is, but none of them insert what I want to achieve.

Kindly let me know if any more information is required.

Thanks in advance
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Full Stack Developer
Distinguished Expert 2017
Commented:
I don't know of anything that would work straight out of the box. One product comes to mind that would require you to create templates. It's called CodeSmith. You might be familiar with it. I am sure that you would be able to generate a template that could create that level of file header comments.
Vipin KumarSr. Network Engineer

Author

Commented:
@Dirk, I have found an extension that creates file header comments, but what I want to achieve is when I save my file it should insert date, time and a string (which I can enter to summarize the changes). In the sample that I entered earlier, I am able to create the template for the section above SUMMARY OF CHANGES. I want to automate insertion for section of SUMMARY OF CHANGES.

Kindly let me know if any more information is required.
ste5anSenior Developer

Commented:
hmm, pretty old school.. You should use a code repository with forced check-in messages instead.
To add to ste5ah's comment, this attempt goes against using the version control systems. The reason is that the generated header would change the file content again -- unless the version control system is able to ignore it. It was partly possible in old version control systems like CVS (see the keywords http://www.badgertronics.com/writings/cvs/keywords.html , including the $Log: $). Anyway, it was problematic even in that time.

However, modern version control systems (like Git) are based on SHA code made of the content of each file. It is impossible (to simplify) to include there any part excluded from SHA processing. On the other hand, it is quite easy to generate nicely formatted log text to display it or to save it into a file.

For the call graphs and the like things that help to document the project structure for programmers, have a look at www.doxygen.org, for example.

Update


It seems you need it for SQL, that is not supported by doxygen. (There were some attempts to transform the SQL to a faked C to pass it through doxygen for generating a usefull documentation. Anyway...) Look for other tools tailored for SQL, like the https://github.com/IzzySoft/HyperSQL is.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial