Contents tagged with VS.Net 2003
-
Speeding up the C# Source Code Editor
Sometimes, the C# source code editor feels a bit sluggish, even on pretty fast systems. One way to speed it up a little is by turning off the navigation bar (the drop down lists above the code window).
- “Tools” menu -> “Options”
- “Text Editor” -> “C#”
- Uncheck “Navigation bar” under “Display”
Of course, the navigation bar is there for a reason and some people just can not live without it. But if you’re like me, and don’t use all the time, you may find the following macro for toggling the navigation bar helpful:
Sub ToggleCSharpNavigationBar()
Dim objShowNavigationBar As EnvDTE.Property
objShowNavigationBar = DTE.Properties("TextEditor", "CSharp").Item("ShowNavigationBar")
objShowNavigationBar.Value = Not objShowNavigationBar.Value
End SubInstallation:
- Open the Macros IDE (“Tools” -> “Macros” -> “Macros IDE”)
- Either create a new module or use an existing one (e.g. I have a module “Misc” where I collect all my small macros) and paste the code into it.
You could assign the macro to a hotkey (Tools -> Options -> Keyboard), but even though I use hotkeys a lot, for this macro I prefer an icon in a toolbar near the navigation bar:
- Right click the toolbar area -> “Customize”
- The “Customize” dialog opens
- On the “Toolbars” tab: Create a new toolbar (e.g. "My Macros")
- Drag the (floating) toolbar to the toolbar area and move it somewhere near the navigation bar.
- On the “Commands” tab: Click the category "Macros"
- Choose the macro (e.g. "MyMacros.Misc.ToggleCSharpNavigationBar") from the “Commands” list and drag it to the toolbar
The toolbar will look something like this:
- Copy the following image to the clipboard
- Back in Visual Studio, right click the macro name -> “Paste Button Image”
- Right click the macro name -> “Default Style”
- Right click the macro name -> “Name” -> Enter "Toggle Navigation Bar"
- Close the “Customize” dialog
The button on the toolbar is now ready to use and will look like this:
-
GhostDoc 1.3.0 Final Released
It took longer than expected, but the final of GhostDoc 1.3.0 has just been released (download on the GhostDoc homepage). Now that it’s out the door, I’m ready to move on to work on a VS2005 version.
What’s new in 1.3.0
Final compared to beta 2:
- Added: Some more "of the" trigger words and adjectives.
- Added: Command "RebuildDocumentation". It works like the "DocumentThis" command, but always creates the documentation from scratch. Note: The command was added pretty late in the release process; to minimize impact on the release date, it does not appear in any menu and can only be assigned to a hotkey via the Visual Studio options dialog.
- Added: Minor additions to the documentation.
1.3.0 beta 2 compared to beta 1:
- Added: New options for determining what should be the representation of the C# language keywords "true", "false" and "null" in a documentation comment.
- Added: New Macros $(True), $(False) and $(Null) to be used in text templates.
- Added: New Macros for the current date, the name of the current user, etc. ("environment macros").
- Added: New custom text that will be added once to a newly added documentation comment. As this text will not be updated, can be used for e.g. marking the date and time when a class member was added.
- Added: New summary template for default property rule (text generation was hard-coded in previous versions).
- Added: Template for methods with parameters for SingleWordMethodRule (text generation was hard-coded in previous versions).
- Added: Preliminary documentation for the dialogs.
- Changed: Default textual representation of "null", "true" and "false" back to the values of version 1.2.1 (<c>null</c>, <c>true</c> and <c>false</c>)
- Changed: Value text of the default property rule is no longer empty by default.
- Changed: Macros: Words.AsSentence -> Words.AllAsSentence
- Fixed: Various bugs related to customization features.
1.3.0 Beta 1 compared to 1.2.1:
- Added: New rules for using "inherited" documentation, including base class members and members of implemented interfaces. The inherited documentation will be cleaned from single <para> tags and the texts will be tweaked (e.g. when the summary for an interface method starts with "When implemented by a class....", and the summary is inherited by the method that is an implementation).
- Added: GhostDoc updates existing documentation. Empty tags (<summary>, <returns>, <param>) will be filled according to the generation rules, existing text remains unchanged. The update reorders the parameter documentation if the order of the parameter changes, and removes documentation for parameters that no longer exist.
- Added: User defined ("custom") rules using e.g. regular expressions for matching names and/or types.
- Added: New rule for "On..." methods -- no more "Ons the click" ;-)
- Added: Rule for static constructors.
- Added: Rule for the Finalize method (destructor syntax in C#).
- Added: Rule for event handler methods as they are created by the WinForms designer.
- Added: Rule for boolean properties.
- Added: Rules (both custom and built-in) can now be customized by editing templates that are used by the text generation rules.
- Added: Export of partial configurations is now possible (e.g. for exporting only a single custom rule).
- Changed: Summary text of the default constructor rule is now 'Initializes a new instance of the <see cref="ClassName" /> class.', i.e. uses the wording in the Microsoft documentation. The old "Creates a new <see cref="ClassName" /> instance" is debatable - is it the constructor that actually creates the instance, or is the constructor called when the instance is created? Thus the Microsoft wording is preferable.
- Changed: The configuration is now stored in the ApplicationData\Weigelt\GhostDoc directory. Old configurations in the installation directory (versions before 1.3.0) will be upgraded and stored in the new location.
- Fixed: <returns> tag no longer disappears if the return type is an array.
- Fixed: Overall handling of array types.
-
GhostDoc 1.3.0 Beta 2 Released
Beta 2 of GhostDoc 1.3.0 has been released, which in terms of features should be pretty close to the release version. The documentation has made a major step forward, but stills needs some work (proofreading, more and better Howtos, especially tutorials for defining custom rules).
What’s new in 1.3.0 beta 2 compared to beta 1:
- Added: New options for determining what should be the representation of the C# language keywords "true", "false" and "null" in a documentation comment.
- Added: New Macros $(True), $(False) and $(Null) to be used in text templates.
- Added: New Macros for the current date, the name of the current user, etc. ("environment macros").
- Added: New custom text that will be added once to a newly added documentation comment. As this text will not be updated, can be used for e.g. marking the date and time when a class member was added.
- Added: New summary template for default property rule (text generation was hard-coded in previous versions).
- Added: Template for methods with parameters for SingleWordMethodRule (text generation was hard-coded in previous versions).
- Added: Preliminary documentation for the dialogs.
- Changed: Default textual representation of "null", "true" and "false" back to the values of version 1.2.1 (<c>null</c>, <c>true</c> and <c>false</c>)
- Changed: Value text of the default property rule is no longer empty by default.
- Changed: Macros: Words.AsSentence -> Words.AllAsSentence
- Fixed: Various bugs related to customization features.
For those who missed the release of beta 1 and still work with 1.2.1:
1.3.0 Beta 1 compared to 1.2.1:
- Added: New rules for using "inherited" documentation, including base class members and members of implemented interfaces. The inherited documentation will be cleaned from single <para> tags and the texts will be tweaked (e.g. when the summary for an interface method starts with "When implemented by a class....", and the summary is inherited by the method that is an implementation).
- Added: GhostDoc updates existing documentation. Empty tags (<summary>, <returns>, <param>) will be filled according to the generation rules, existing text remains unchanged. The update reorders the parameter documentation if the order of the parameter changes, and removes documentation for parameters that no longer exist.
- Added: User defined ("custom") rules using e.g. regular expressions for matching names and/or types.
- Added: New rule for "On..." methods -- no more "Ons the click" ;-)
- Added: Rule for static constructors.
- Added: Rule for the Finalize method (destructor syntax in C#).
- Added: Rule for event handler methods as they are created by the WinForms designer.
- Added: Rule for boolean properties.
- Added: Rules (both custom and built-in) can now be customized by editing templates that are used by the text generation rules.
- Added: Export of partial configurations is now possible (e.g. for exporting only a single custom rule).
- Changed: Summary text of the default constructor rule is now 'Initializes a new instance of the <see cref="ClassName" /> class.', i.e. uses the wording in the Microsoft documentation. The old "Creates a new <see cref="ClassName" /> instance" is debatable - is it the constructor that actually creates the instance, or is the constructor called when the instance is created? Thus the Microsoft wording is preferrable.
- Changed: The configuration is now stored in the ApplicationData\Weigelt\GhostDoc directory. Old configurations in the installation directory (versions before 1.3.0) will be upgraded and stored in the new location.
- Fixed: <returns> tag no longer disappears if the return type is an array.
- Fixed: Overall handling of array types.
FAQ
- When is the final coming out?
Before the PDC. - What about VS2005 support?
After the PDC.
-
GhostDoc 1.3.0 Beta 1 Released
I’m pleased to announce that beta 1 of GhostDoc 1.3.0 has been released. A big “Thank You” to the steadily growing number of testers who helped me testing a couple of preview builds, pointed out a few minor issues and gave me an overall “Thumbs up”.
What’s New
- New: New rules for using "inherited" documentation, including base class members and members of implemented interfaces. The inherited documentation will be cleaned from single <para> tags and the texts will be tweaked (e.g. when the summar for an interface method starts with "When implemented by a class....", and the summary is inherited by the method that is an implementation).
- New: GhostDoc updates existing documentation. Empty tags (<summary>, <returns>, <param>) will be filled according to the generation rules, existing text remains unchanged. The update reorders the parameter documentation if the order of the parameter changes, and removes documentation for parameters that no longer exist.
- New: User defined ("custom") rules using e.g. regular expressions for matching names and/or types.
- New: New rule for "On..." methods -- no more "Ons the click" ;-)
- New: Rule for static constructors.
- New: Rule for the Finalize method (descructor syntax in C#).
- New: Rule for event handler methods as they are created by the WinForms designer.
- New: Rule for boolean properties.
- New: Rules (both custom and built-in) can now be customized by editing templates that are used by the text generation rules.
- New: Export of partial configurations is now possible (e.g. for exporting only a single custom rule).
What’s Missing
There are a couple of small features I’d like to see in 1.3.0 final. And then there’s a huge update of the help file waiting to be done.
FAQ
- When is the final coming out?
My personal deadline is end of August. - What about VS2005 support?
I guess i’ll wait for the PDC bits of VS2005
-
GhostDoc: Looking for Testers
I’m planning a first public beta of GhostDoc 1.3.0 towards the end of July. A couple of private builds have already been released to colleagues and people on the net who offered their help. So far feedback has been pretty good. People like the new features, some issues have been found, most of them could be fixed in the following builds.
Now I would like to have a couple more people to test the current build. If you’re interested, contact me via the contact form. Please tell me about your system (e.g. which other Add-ins are installed), since when you have been using GhostDoc and how often you use it. I’ll then send you an email with the download link (when waiting for a reply, please take time zone differences into account ;-).
Here are the new features you can try out in the preview:
- New rules for using "inherited" documentation, including base class members and members of implemented interfaces. The inherited documentation will be cleaned from single <para> tags and the texts will be tweaked (e.g. when the summary for an interface method starts with "When implemented by a class....", and the summary is inherited by the method that is actually the implementation).
- GhostDoc now updates existing documentation. Empty tags (<summary>, <returns>, <param>) will be filled according to the generation rules, existing text remains unchanged. The update reorders the parameter documentation if the order of the parameter changes, and removes documentation for parameters that no longer exist.
- User defined ("custom") rules using e.g. regular expressions for matching names and/or types.
- New rule for "On..." methods -- no more "Ons the click" ;-)
- Rule for static constructors.
- Rule for the Finalize method (destructor syntax in C#).
- Rule for event handler methods as they are created by the WinForms designer.
- Rule for boolean properties.
- Rules (both custom and built-in) can now be customized by editing templates that are used by the text generation rules.
A few words about the quality of this preview: Answering the obvious question “does it fry my data and/or my Visual Studio installation?”, I can say that the Visual Studio integration and installation/uninstallation are at least as good as in version 1.2.1, so I wouldn’t hesitate to run the setup on production machines. The current problems are mostly missing features, some usability issues and the online help that hasn’t been updated yet.
-
Cool: Bold Fonts in Visual Studio 2005's Text Editor
Sometimes it’s the simple things that can make you happy.
As I’ve already mentioned in my blog, I switched to a proportional font for editing source code long time ago, and I’m always looking how to improve my “source code viewing experience”. One thing I tried in Visual Studio .Net 2003 was bold text for keywords, but things were not working correctly. For example when typing “public”, you would see something like this:
- When you start typing, the keyword is not complete and thus the “publi” is rendered as normal text:
- After you type the “c”, Visual Studio detects the keyword “public” and renders it in bold text. Unfortunately, the cursor is not moved immediately…
- …but about 1 second later:
Well, maybe I could have lived with the delay, and the cursor position didn’t affect the typing of the next characters, but behind the bold keyword, the cursor display didn’t match the actual position. So I more or less forgot about it.
Now guess what I found out when I tried Visual Studio 2005: Not only that the bug regarding the cursor position is fixed, but “user types” (e.g. classes, interfaces) can now be styled individually, too. So now I’m able to have something like this:
Cool… The only problem is that I still have to use VS.Net 2003 for my daily work (man, I want that final out soooo bad!)
- When you start typing, the keyword is not complete and thus the “publi” is rendered as normal text:
-
"Visual Studio Hacks" Book: Excerpts Online
Excerpts from the “Visual Studio Hacks” book by James Avery have been published on the OnDotNet web site.
- Master the Command Window
- Create Comments Faster (this one is about GhostDoc and was written by me)
- Run Unit Tests Inside of Visual Studio
- Hack the Project and Solution Files
- Refactor Your Code
Unfortunately I didn’t have much time to read the book in the previous weeks. Yesterday was the first day of the year that the local “Freibad” (public outdoor swimming pool) was open, so I took it with me to read it while sunbathing. And I must say that “Visual Studio Hacks” passed my personal “Freibad test”, i.e. it was interesting enough to be read in a noisy environment, with interruptions (kids playing soccer in the sunbathing area), and without a computer nearby. Other books that passed this test in previous years are “C# Unleashed” by Joseph Mayo, “Code Complete 2” by Steve McConnell and the “Extreme Programming Pocket Guide” by chromatic.
Back to “Visual Studio Hacks”: I consider myself an advanced user of Visual Studio, so many of the hacks are not really new to me, but most of those hacks contained some bit of information I didn’t know yet or completely forgot about. What I really liked about the book is that it’s not a simple collection of tips that the author barely tried himself. You notice that in the little details like the solutions to problems you may not encounter immediately, but will run into sooner or later in your daily work (e.g. the infamous “Call rejected by callee” error). So far I’ve read the first half of the book and I couldn’t find anything that I would consider of little value – I wish could say that about many other computer books.
-
GhostDoc in Upcoming Book "Visual Studio Hacks" by James Avery
Ok, now that the book “Visual Studio Hacks” by James Avery has been announced officially, I’m finally allowed to talk about my (small) contribution to the book: My Visual Studio add-in GhostDoc is one of the “hacks”.
Shortly after GhostDoc won Roy Osherove’s Add-In contest in August 2004, James contacted me to write a quick run-down on using GhostDoc. He couldn’t offer any money (if you wonder why, you should read this), but hey – a few hours work for a free book isn’t too bad ;-)
Let’s see what the editors at O’Reilly thought of my English writing skills (or lack thereof?) and what’s left of my original text…
-
GhostDoc 1.2.1 released
While working on version 1.3.0, I ran across some minor issues in 1.2.0 that were pretty easy to fix. These fixes are now available in version 1.2.1.
Download: on the GhostDoc homepage
What's New:
- Fixed: Under certain circumstances, acronyms used in parameter names that are referenced in summary texts are not handled correctly (the first character of the acronym is shown in lowercase).
- Added: Better visual feedback after pressing "Import" and "Upgrade" buttons during setup, now the wait cursor appears while the determining the differences between the two configuration (current/imported or default/imported).
-
GhostDoc 1.2.0 released
Version 1.2.0 originally was planned to contain mostly new rules; but it turned out that many of the planned rules require some kind of individual customization/configuration, so this had to be taken care of first. Internally, this release now does use configuration settings for each rule (e.g. templates for the generated texts), but the dialogs for actually editing these settings have not been implemented yet (they will be part of a 1.3.0 release). From a user's point of view, version 1.2.0 contains some important bug fixes and new rules for handling properties and methods with names starting on "Is", "Has" and "Can".
Download: on the GhostDoc homepage
Note for users of version 1.1.2
During setup, GhostDoc upgrades configuration settings of previous version (stored in the file "Weigelt.GhostDoc.gdc"). Usually this file is located in the GhostDoc installation directory, but due to a bug in version 1.1.2 the file was stored in the root directory of one of your hard drives.
If you have made changes when using version 1.1.2 that you want to keep, you can import the old settings using the "import" feature on the configuration dialog (see the help file for more information), then delete the ".gdc" file in the root directory.
What's New:
- Added: New rules for handling method names starting with "Is", "Has" or "Can".
- Added: New rule for handling property names starting with "Is" or "Has".
- Added: Internal changes in preparation for rules to be configurable individually (affecting e.g. import/export) in future versions.
- Changed: During the setup phase, importing and upgrading configurations can now be distinguished(button and window title renamed).
- Fixed: Editing the adjectives for the "of the" reordering does not enable the "Apply" button; pressing the "OK" button does not store the changes. If anything else is modified in the configuration dialog, the changes will be stored correctly.
- Fixed: Configuration file is stored at the wrong location (root of the installation drive). This bug was introduced in 1.1.2.
- Fixed: GhostDoc can be affected by installing other add-ins, sometimes setup dialogs are shown again when Visual Studio is started.