开发者

CodeRush - Copying and commenting out sections of code

When I'm modifying code I like to comment out the old code, modify it, and keep the old code around for a short while.

Is it possible to create a CodeRush plugin to Comment the old code out, add the hyphenated line before, and after (including the date), and copy the original code select (Whole lines, whether the whole line is selected, or not), and put a line afterwards to mark the end of the change ?

See the following example.

        '------开发者_JAVA百科---- 
        'Build the Data Table.
        ''Add the PDF File Names to the Data Table.
        'rowPDF = dtPDF.NewRow
        'rowPDF("PDFDocument") = arPDFFiles(1)
        'dtPDF.Rows.Add(rowPDF)
        'rowPDF = dtPDF.NewRow
        'rowPDF("PDFDocument") = arPDFFiles(2)
        'dtPDF.Rows.Add(rowPDF)
        'rowPDF = dtPDF.NewRow
        'rowPDF("PDFDocument") = arPDFFiles(3)
        'dtPDF.Rows.Add(rowPDF)
        'rowPDF = dtPDF.NewRow
        'rowPDF("PDFDocument") = arPDFFiles(4)
        'dtPDF.Rows.Add(rowPDF)
        'rowPDF = dtPDF.NewRow
        'rowPDF("PDFDocument") = arPDFFiles(5)
        'dtPDF.Rows.Add(rowPDF)
        '------ 07/04/2011
        'Loop through the Array and Build the Data Table.
        For narCounter = 0 To UBound(arPDFFiles)

            'Add the PDF File Names to the Data Table.
            rowPDF = dtPDF.NewRow
            rowPDF("PDFDocument") = arPDFFiles(narCounter)
            dtPDF.Rows.Add(rowPDF)

        Next
        '----------


At the time of this answer, CodeRush contains no native way to perform this task.

However it does have a very large extensibility model allowing the creation of plugins for almost any purpose you can imagine.

This exact plugin was developed on the spot in a recent DevExpress Webinar

They entire Webinar is well worth watching but the construction of the plugin in question is detailed from around 1 hour and 6 minutes in. I believe the entire implementation was completed in around 13 minutes.

Update: This plugin is now part of the community plugin site and is available here

For those who are interested, these webinars are recorded live on a Tuesday evening at 20:00 BST (which translates to around 12:00 midday PDT)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜