Insert Automatic Comments in Visual Studio Code

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
LVL 1
Vipin KumarSr. Network EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dirk StraussSenior Full Stack DeveloperCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vipin KumarSr. Network EngineerAuthor 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 DeveloperCommented:
hmm, pretty old school.. You should use a code repository with forced check-in messages instead.
peprCommented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.