In this article we will create the simplest refactoring which will remove the active comment. Sometimes, there are comments left that are not utilized any longer, such as implemented TO-DO comments, UNDONE comment that is now complete, etc. We will use the RefactoringProvider control shipped in DevExpress Refactor! Pro for this purpose.
Read more…
Every programming language has its own language specification. There are numerous rules for each language that vary between programming languages. DXCore supports several programming languages and provides APIs to determine specific rules for them. These APIs are available primarly through the DXCore Language service. Let’s review the most important methods and properties of this service, comparing the CSharp (C#) and Visual Basic (VB) programming languages.
Read more…
Once you obtained an instance of a class, structure or an interface, for example, by using the DXCore SourceModel service:
CodeRush.Source.ActiveClass
CodeRush.Source.ActiveClassInterfaceOrStruct
CodeRush.Source.ActiveClassInterfaceStructOrModule
CodeRush.Source.ActiveStruct
CodeRush.Source.ActiveInterface
and would like to analyze its hierarchy by retrieving its base and/or derived types, you can use the following APIs:
Read more…
Recently, we have created a console application that parses an entire solution and shows summary information about declared types and the number of members in each type. Let’s tweak it a bit, so it provides more meaningful and useful information, such as a report of Maintenance Complexity (MC) code metric for a solution source code.
Read more…
Usually, simple edits of text files are accomplished using the TextDocument object, which represents an open source file inside the IDE. The text document object is easy to access through the Documents DXCore service. It has lots of useful methods for editing a text like InsertText, DeleteText and SetText, which take a source code coordinates and a new text for replacement as a parameters. However, to use a text document object, it is required for the file to be opened inside the Visual Studio environment. If a file is closed, there’s no TextDocument object assigned to the file and you simply can’t use its methods. In case you are going to edit closed and/or multiple files, there’s a better way – the FileChange object (in the DevExpress.CodeRush.Core.Replacement namespace).
Read more…
Actually, DXCore is not designed to be used outside of Visual Studio, but there are always workarounds… In this article I’m going to show you how to use the DXCore Framework inside the regular C# Console Application to parse an entire solution and work with the abstract parsed tree. The solution should be passed-in as an argument to the program as a full complete path to the *.sln file. If there’s no argument used, the hard-coded path to the test program is used, so the program will parse itself and print information about the solution, such as a list of all types used and the number of members inside of each class.
Read more…
The XML Doc Comments Painter feature of CodeRush Pro paints over XML documentation comments in the code editor, so they are easier to read in a nice-looking form. It visually replaces all XML doc tags and make them hidden, and leave the important information only:
Read more…
Occasionally you may need to note a place in a source file that needs to be revisited later for correction or improvements. There are three standard codes used to designate such places: TODO, HACK and UNDONE. Visual Studio has the built-in Task List tool window, which shows the list of such comments. To open the list, go to View menu -> Task List:
Read more…