Occasionally, I’ve been caught where Visual Studio’s intellisense just seems not to work /correctly/. It shows a list of the possible options but then pressing enter, dot, or semi-column doesn’t auto-complete the word, e.g.
This is because intellisense has two modes:
- Suggestion Mode
- Completion Mode
In suggestion mode, intellisense only shows a list of possible values, and it’s up to the user to manually select the item with the arrow keys and then press enter, dot, tab etc.The tell here is that the word is not automatically highlighted.
When in Completion mode, intellisense changes to:
Great – now that we know what mode we’re in – how do I change it?
To switch between intellisense modes, press CTRL-ALT-SPACEBAR, or Edit/IntelliSense/Toggle Completion Mode.
When double-clicking on custom user control code, Visual Studio may open a window with the message, “To add components to your class, drag them from the Toolbox and use the Properties window to set their properties. To create methods and events for your class, click here to switch to code view.”
To go to code view, you either have to:
- Press F7
- Or click on the “Click here to switch to code view.”
Instead, you can change the default behaviour of opening a user control to go straight to code view by applying the DesignerCategory Attribute to your custom user control class, e.g.
public class MyUserControl : ...
You can customize the Assigned To field on a Visual Studio’s work item type to limit the values for the field to individuals who work on your team.
To do this, export the XML file and modify its content to customize the Assigned To field. Then import the XML file to start to use the updated work item type.
To perform this procedure you must be a member of the Team Foundation Administrators group or a member of the Project Administrators group for the project.
Customizing the Assigned To Field
- To modify a work item type on a single project, run witadmin exportwitd to export the XML file for the work item type you want to modify.
witadmin exportwitd /collection:[TFS] /p:[ProjectName] /n:[WorkItemType] /f:[FileOut]
[TFS] = Team Foundation Server URL
[ProjectName] = Name of TFS Project
[WorkItemType] = The work item type we want to export
[FileOut] = The name of the file to output to.
witadmin can be found in:
\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
witadmin exportwitd /collection:http://mytfs:8080/tfs/mytfs /p:ExampleProject /n:Task /f:C:\Users\TheSoftwareShrink\Desktop\Task.xml
- Open the exported file (*.xml) in an editor (e.g. Notepad)
- Find the section within the XML file that describes the Assigned To field (see example below). Notice the VALIDUSER rule that allows for any registered user on the Team Foundation Server as a field value.
<FIELD name="Assigned To" refname="System.AssignedTo" type="String" reportable="dimension">
- Change the XML as shown below in the following example. This limits the values of the Assigned To field to the members of the team project’s Contributorsgroup.
<FIELD name="Assigned To" refname="System.AssignedTo" type="String" syncnamechanges="true" reportable="dimension">
<HELPTEXT>The person currently working on this task</HELPTEXT>
<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
<LISTITEM value="[Project]\Contributors" />
- Save the changes.
- To import the new work item type to a single project, run witadmin importwitd
witadmin importwitd /collection:http://mytfs:8080/tfs/mytfs /p:ExampleProject /f:C:\Users\TheSoftwareShrinkDesktop\Task.xml
Verifying changes imported to a single project
- In Team Explorer, click Refresh to download the latest updates from the server.
These updates include the changes that you just imported. Wait several seconds until the Work Items node is loaded. Nodes that are still loading are labeled working.
- Create a new work item using the work item type you modified. To do this, right-click the Work Items node, point to Add Work Item, and then click the Task work item type.
- Select the Assigned To box. Notice that the list of allowed values has changed to include the group of users and values that you specified.
- Click Close to close the new work item. Click No when you are prompted to save the work item.
When reviewing the pending changes window within Microsoft Visual Studio 2010 the default action of double-clicking an item views the file. To diff the pending changes between the file and the latest version, you have to:
- Right Click the file
- Left Click “Compare”
- Left Click “With Latest Version…”
OUCH! There’s got to be an easier way! Well there is …
You can avoid the mouse dance, by performing a “Compare with Latest Version” by either:
- Holding Shift + Double-Clicking the file
- Highlighting the file and pressing Shift+Enter
You can also change the default behaviour of double-clicking a file to be Compare rather than View. To do this, just update the registry setting:
0 : View file
1 : Compare with Latest Version
In Visual Studio, the default check-in action is resolve, e.g.
This may be an issue as once a task has been implemented, a developer may wish to pass this task to another developer for code review prior to resolving the issue. Instead, when the code is checked-in, we want to associate the code with the task rather than resolve the task.
You can modify this behaviour by changing a registry setting. Change the following key’s value to False.