Prevent debugger from stepping into unwanted functions in Visual Studio

When you’re in a debugging session, sometimes the debugger can visit a lot of trivial functions or code from third-party libraries. In Visual Studio and also in Visual Assist, there are ways to filter out call stack events so that you can focus just on the critical code path.

Read on to find out how.

Background

As you may already know, step into, step over, and step out functions are essential while debugging. However, it would be very time consuming to visit all of the functions. Sometimes debugger might lead you to methods that are not important from your perspective.

Let’s see an example:

#include <iostream>
#include <string>

class Param {
public:
    Param(const std::string& str, int val) : mStr(str), mVal(val) { }

    std::string GetStrVal() const {
        return mStr + "..." + std::to_string(mVal);
    }

private:
    std::string mStr;
    int mVal;
};

void CallBackFunction(Param p1, Param p2) {
    std::cout << p1.GetStrVal() << "\n";
    std::cout << p2.GetStrVal() << "\n";
}

int main() {
    CallBackFunction({ "Hello", 1 }, { "World", 2 });
}

In the above example you can find a simple code that creates a named integer parameter into a separate type: Param. When you run the code, it should output the following:

Hello...1
World...2

The problem is that we have an ellipsis ... rather than the colon : that we wanted in the first place. You can run the debugger and see where this output comes from.

Set a breakpoint at the line where CallBackFunction is called and then press F11 to try to step into the function. Since the code is relatively simple, we can just step into every procedure and investigate the program flow. Where will the debugger go at the start? I see something like this (assuming you have “Just My Code” disabled):

(Just My Code is available for C++ since Visual Studio 2017 15.8. See this post for more information: Announcing C++ Just My Code Stepping in Visual Studio | C++ Team Blog.)

In the above example, debugger goes to the next instruction after the breakpoint. In our case, it’s a constructor of std::string!

While sometimes it might be interesting to look into the internals of the Standard Library, it’s probably not the best place to look for the solution to our problem with the string output.

Imagine what happens if you have several parameters. When you want to step into a method, you’ll first need to visit all code related to the creation of the parameters. The whole process might be frustrating, and you would lose a lot of time before going into the target function. Of course, you might just set a breakpoint at the beginning of the destination code; this will skip all of the unwanted behavior. But there is a better option.

What if you could control and filter out unwanted functions?

Filtering in Visual Studio

Before VS 2012 it was relatively tricky to filter out the code. Usually, it involved playing with some registry values. Fortunately, since Visual Studio 2012, this useful feature has been much improved.

All you need to do is edit the default.natstepfilter XML file. It’s usually located in:

// VS 2015
Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Packages\Debugger\Visualizers

// VS 2019:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Packages\Debugger\Visualizers

This is the same for VS 2015, and for VS 2013 and VS 2012.

To add more functions that will be filtered out, you can use regex expressions:

In our example, when we want to skip all the functions from the std:: namespace, we can write the following:

std\:\:.*  

and add this line to default.natstepfilter:

<Function>
    <Name>std\:\:.* </Name>
    <Action>NoStepInto</Action>
</Function>

Please note that the file might be blocked for writing. The file default.natstepfilter is loaded each time a debugger session starts.

You can now set up the most common functions in your project that you don’t want to visit during debugging. Usually, those are trivial functions or from third-party code (std, boost?). Remember not to filter out too much!

In the latest versions of Visual Studio, you can also benefit from “Just My Code”, which won’t enter code that is not “your” module. That means system calls, the Standard Library, ATL, MFC, and others. You can even set your third-party libraries.

While each revision of Visual Studio makes it easier and easier to control the debugging flow, there’s an even faster and more straightforward solution.

See below:

Even more with Visual Assist

In Visual Assist, you have a separate window that allows you to see all debugger events and filter them during the debugging session!

You can show it from Visual Assist -> Debug -> VA Step Filter. You also have to have debugger integration enabled (turned on by default).

For our example, the first time I run a debugger and press F11, it will still step into the constructor of std::string. But the VA Step Filter window will show the following output:

As you can see in the Debug Events section, Visual Assist lists: breakpoints, step into, step out, and step over actions.

I can now click on std::string::basic_string... and then the next time debugger enters the same event, it will skip it and move forward. In our case, it will step into the constructor of our Param class.

By default, VA has several predefined filters for the shared Windows libraries. You can also control the filters on a global level (all projects) or per solution.

What are the main advantages?

  • It’s more visual than text files and XML files you have to edit for native debugger settings.
  • You can easily switch the event while you’re in a debugging session. In our case, I can enable it for the first argument evaluation for CallBackfunction but disable it for the second argument—no need to restart the session.
  • It has more control than “Just My Code” because sometimes you can skip an unwanted function from your application code. For one debugging session, you might want to get to the solution faster by skipping some places.
  • You can control the filter per solution level.

Try it out and see more information on the separate page: VA Step Filter

References

Fly over the IDE Gaps

Going Remote or Crazy?

If you’re like most, you’re reading this from the comfort (hopefully) of your home office. We hope whatever you’re doing, you’re being safe and smart about it. Our staff lucked out as most were already working from home when all this started. So the transition has been fairly easy, with the exception of having more distractions and noise. But, we know the transition for companies and teams can be difficult.

Over the last month we’ve been working on a way to make licensing for remote teams easier. Consider this our official launch of Concurrent Licensing for Standard License users!

Concurrent Licensing will allow companies to purchase a number of concurrent active user licenses and have teams or individuals access a license at any time. Licenses will be “checked out” upon startup and “returned” after closing Visual Assist, freeing up the license to be used by another employee. This is especially helpful when teams jump from one project to another that may or may not require Visual Assist.

We hope concurrent licensing will allow for easier management and greater flexibility for remote employees that may work different office hours or be traveling to hunker down with family.

For more information about making the switch or adding a concurrent pool to your existing licenses, contact your account manager today.

How to add notes and navigation metadata directly in source code in Visual Studio

Comments in code might not only be some text floating around the functions, variables and classes, but they might contain some extra semantic information. With this improvement, you can navigate through projects much faster or even organize your knowledge. In this blog post, I’ll show you two ways on how to add extra metadata to comments in Visual Studio.

Intro

Navigating through a large codebase might be a complicated task. It might be especially an issue when you have big projects (not to mention legacy systems) where logical parts are spread across many different files.

In Visual Studio offers many tools that help with moving between headers, declarations, class hierarchies or all references of a given symbol. But what if you’d like to put a “todo” item? Or some extra note? Such supplementary information can not only help with quick tasks but also might build knowledge about a system.

Here are the things you might want to use to help in Visual Studio

  • Task List
  • Hashtags (as an extra plugin)

Let’s start with the first one.

Task Lists

Visual Studio contains a feature that enables us to add metadata directly in comments; It’s called Task List. Take a look at this piece of code from my legacy project:

class ShaderProgram
{
private:
    GLuint mId;
    std::vector<Shader *> mShaders; // refactor: 
                                    // convert to 
                                    // smart pointers!
public:
    // todo: implement other special member functions!
    ShaderProgram();
    ~ShaderProgram();

As you can see above, I put keywords like refactor: or todo: inside comments.

Visual Studio builds an index of all comments with those special keywords and shows them in a separate window:

Visual Studio task list

This is a handy way of managing simple activities or just taking some small notes for the future. What’s more, the refactor keyword is a custom marker. Visual Studio adds flexibility to set it in the environment settings.

Here’s the link to the documentation Use the Task List – Visual Studio | Microsoft Docs

The task list is a nice improvement! The metadata lives inside comments so that other developers can pick up the same information. Still, you cannot easily transfer custom keywords, and the task window offers only basic support. For example, it doesn’t group things (like grouping all of the to-do lines).

Is there anything better?

Hashtags in Visual Assist

For several years I’ve been a happy user of Visual Assist – which is an excellent tool for enhancing various aspects of Visual Studio (have a look at my previous blog posts here or here). The tool also has a powerful feature called Hashtags. This is a combination of named bookmarks, task list and tags that you might know from social networks.

Take a look at the example from my project with extra notes:

/// creates and can build GLSL programs, #shadersSystem
class ShaderProgram
{
private:
    GLuint mId;
    std::vector<Shader *> mShaders; // #refactor
                                    // convert to 
                                    // smart pointers 
public:
    // #refactor #ruleOfZero implement 
    // other special member functions!
    ShaderProgram();
    ~ShaderProgram();

As you can see, this is just regular source code, but please notice those words proceeded with #. I’m using them to mark places that might be worth refactoring. For example, notes about refactoring:

std::vector<Shader *> mShaders; // #refactor 
                                // convert to smart pointers

Or another example:

/// creates and can build GLSL programs, #shadersSystem

This time I’ve used #shadersSystem which groups elements that are crucial to the handling of OpenGL Shaders in my animation application.

Below you can see all of the tags that are displayed in the VA Hashtags window. Similarly to Visual Studio, Visual Assist scans the source code and presents the indexed data.

Hash Tags Window

In the picture above, you can see lots of different tags that I put throughout the code, for example:

  • #GlutCallbacks – they refer to all callbacks that I passed to the GLUT framework (for my OpenGL Windows Application). With all of the tags grouped under one item, I can quickly move between those functions.
  • #refactoror #modernize – things to improve later.
  • Other “notes” that refer to some subsystems like #uiTweaks, #mainLoop and others.

The screenshot also shows a considerable difference compared to the task window. The hashtags are grouped, you can also filter them, or hide according to the project name, directory or even a filename.

Tags are created “on the fly”, there’s no need to predefine them in some configuration window. You just type # and some extra text (you can configure the minimum length of a tag, it’s 3 by default).

Tags are stored directly in the source code, so other developers can immediately see the same information (assuming they also use Visual Assist). Such functionality can be used to create even some simple task manager when you can assign a task by the name of a developer:

// #bartekToDo: please improve this code! don't use goto!

Here are some more things you can do with them

  • Cross-reference other tags. You can write see:#otherTag and Visual Assist will build an extra list per tag that you can check.
  • When you type # Visual Assist with autocomplete tags, so you can easily refer to existing hashtags
  • When you hover over a hashtag in the hashtags window, you’ll see a tooltip with the source code that’s near the tag; this allows to get a better orientation without actually moving to the code.
  • And many more!

Here’s a great video that summarises the tool:

Summary

In this short blog post, I wanted to describe two tools that you can use to add extra information to comments. Having little todo: comments or additional notes can enhance your daily work and build a handy list of actions for the future, or even build up the knowledge about the system.

Depending on your preferences, you can keep those extra notes permanently in your code or just temporarily and gradually move the knowledge and todo actions into external documentation or task manager.

In my daily work, I prefer VA hashtags over regular bookmarks, as they are easier to use in most cases and shows that extra information and structure. You can read more about VA Hashtags on their documentation page: Visual Assist Hashtags.

Back to you

  • Do you use some extra tools that help you with code navigation?
  • Do you use Visual Studio task window and task comments?
  • Have you tried VA hashtags?

This blog was brought to you by Bartlomiej Filipek, you can check out his C++ blog at bfilipek.com

Tools for Tuesday

While we hope Visual Assist is your favorite dev tool, we know we can’t (and won’t) do everything for you. As we continue developing solutions, we’ll also showcase tools or tips for other problems you may face in other parts of development. This week, you’ll hear from our friends at Ranorex:

How to continue to test in Visual Studio in a post Coded UI world. 

Producing powerful on-time releases demands high-quality code and thorough testing. This is why developers have been encouraged to continuously inspect their code for errors and to shift their testing left.  Visual studio is far and away the most popular IDE on the planet with an estimated market share of 39%, and there are some great code inspection tools that extend Visual Studio functionality out there, but what about left-shifted test automation? 

For users of Visual Studio, Coded UI facilitated a shift-left approach to development by enabling automated UI-driven functional testing from within the IDE. However, earlier this year Microsoft announced that Coded UI was deprecated. Visual Studio 2019 would be the last version to support Coded UI.

Does this mean that left-shifted developers and technical testers are bereft of a testing framework that operates from within Visual Studio? The answer my friends is “not on your nelly”. The Ranorex testing framework provides an API for C# and VB.Net that completely replaces Coded UI.

Migration from Coded UI to the Ranorex testing framework is as easy as one, two, three. Once you have downloaded and installed Ranorex Studio simply follow the instructions below:

1. Create a new Visual Studio project 

Open Visual Studio, go to File > New Project. Next, you will need to select .Net Framework 4.5.2 or higher, you will be prompted to choose your programing language, you can select either C# or VB.Net. All that is now left to do in this first step is to select Console Application and hit OK.   

New project window

2. Add Ranorex core assemblies as references

To ensure a seamless migration away from Coded UI you will next need to add the Ranorex core assemblies. To do so navigate to the project’s Solution Explorer, right mouse click on the References Folder and select Add Reference… 

Solution explorer

Click browse and then navigate to the Bin folder of your Ranorex installation, (the default location is C:\Program Files (x86)Ranorex Bin). 

Add the following:

  • Ranorex.Bootstrapper
  • Ranorex.Common
  • Ranorex.Core
  • Ranorex.Core.Resolver
  • All Ranorex.Plugin assemblies
https://miro.medium.com/max/846/1*H3t63DTmK-_Gg9AITVokEA.png

Set the Copy Local option to False for all Ranorex assemblies except for Ranorex.Core.Resolver

3. Over to you 

Start writing code and continue with left-shifted testing in Visual Studio. 

Before you go

Not only are you able to continue to test in your preferred IDE you can also benefit from the best object recognition on the market. Ranorex Spy is the tool developers and technical testers love. Use it to analyze your AUT, its element structure, available object properties and attributes, and build the most robust and reliable XPaths for use in Visual Studio.

Be in full control of your XPaths. Increase or decrease dynamism in line with the complexity your tests require. Add variables to your XPaths and customize how you uniquely identify UI elements even when testing mixed technology applications. 

You can also benefit from all the functionality associated with Ranorex. Have a better understanding of failed tests with fully customizable reports. Get built-in object repository access and organize your tests in logical hierarchical structures. 

Conclusion

Left-shifted developers and technical testers who have used Coded UI need not mourn its passing, rather they should see the deprecation as an opportunity to increase the speed and quality of their releases. The Ranorex testing framework offers an API that completely replaces Coded UI, has far superior object recognition, and increased functionality. But don’t take my word for it download you full featured 30-day free trial and find out for yourself. 

Visual Assist build 2358 is available!

New Year, New Build! Welcome to 2020 and 2358. This release was driven largely to fix an issue with our licensing server and some corruption that may have been experienced by Unity users, but why stop there?

  • NEW Added C++ modernization refactoring: Convert Unscoped Enum to Scoped Enum (execute on the enum definition). See the documentation.
  • NEW Goto Related now allows hopping between *_Implementation and *_Validate implementations in UE4.
  • FIX Goto from a method declaration will now list *_Validate as a target in UE4.
  • NEW Added option (on the Goto page of Visual Assist Options dialog) to prefer implementations when executing Goto (Alt+G) (execution on the implementation will continue to go to the declaration as before).

Take a look at the full list of features and bug fixes here. And of course be sure to update!

Getting Started with UE4 and Visual Assist

Whether you’re new to Visual Assist and UE4 or a seasoned vet, we thought you might appreciate a little more insight into what you can expect and how to get started. Thanks to our resident UE4 wizards for putting this together.

1. Install Visual Assist

  1. Exit all instances of Visual Studio.
  2. Run the .exe installer you downloaded.
  3. Select the IDE(s) you want to install to.

2. Open your game solution

Visual Assist will come alive after it finishes parsing.

3. Look around

Open the Extensions > VAssistX menu. You will use the menu primarily to open tool windows, review keyboard shortcuts, and access the options dialog.

Appreciate the understated UI to Visual Assist. There are just a few visible changes.

4. Change a few settings

If you like meaningful syntax coloring, open the options dialog for Visual Assist and apply coloring to more of the UI.

If you highlight the current line, choose a thin frame that doesn’t obscure your code.

Visual Assist can add important information to tooltips when hovering over a symbol, such as comments from base classes. This is very helpful in UE4, as base class comments are the documentation.

Visual Assist can analyze your code and suggest improvements. Enable Code Inspections to see blue underlines where code might be improved. Visual Assist can even modernize your code for you! We will show how later.

Then, open the options dialog to Visual Studio and eliminate the redundant navigation bar. The version in Visual Assist includes the functionality of the built-in one.

Disable built-in navigation bar

After making the changes, Visual Studio is ready to use.

5. Navigation in UE4

Search for and open files using Alt + Shift + O. Precede a search filter with a hyphen to exclude symbols (negative filtering).

Understand and navigate the inheritance hierarchies of UE4 by using Alt + Shift + G on a class name. The Alt + Shift + G shortcut works on many types of symbols, try using it on a virtual method.

Source files in UE4 can be thousands of lines long. Use Alt + M to search for and navigate to methods inside the current file.

Find references to a symbol using Alt + Shift + F. Visual Assist’s find references is fast and accurate inside huge solutions like UE4. Try cloning your results to save them by clicking the Clone Results button or using the right-click menu.

Hover over a virtual method to see comments from base classes. Base class comments often contain useful documentation.

6. Refactoring in UE4

Access refactoring tools using the keyboard shortcut Alt + Shift + Q, or by hovering over a symbol and clicking the tomato icon that appears. The contents of the Alt + Shift + Q menu depend on the symbol.

It is common in UE4 to override virtual methods, such as Tick or SetupPlayerInputComponent. Visual Assist can implement these methods for you. Click on your class name and then use Alt + Shift + Q.

The Implement Methods dialog is searchable, and you can implement more than one method at once.

Visual Assist will intelligently add a call to the Super class version of the method for you when appropriate.

You will see blue underlines below code which could be modernized. This is Code Inspection.

Visual Assist can refactor the code for you! Use Alt + Shift + Q on the underlined symbol.

If you need to change the return type, parameters, or the name of a method you can use Change Signature. Edit the method definition in the window. References and call-sites to the method will be updated, so you won’t miss anything.

7. Tips

There is a lot of special functionality built into Visual Assist for UE4, such as suggestions for U* macros. The more you can use Visual Assist, the more opportunities to make your life a little easier in UE4.

You may find the built in IntelliSense to be unusably slow, or that it often adds red underlines to correct code in UE4. IntelliSense can be disabled. Visual Assist provides all the intelligent tooling expected in a modern C++ development environment.

You can throttle the initial parse in the Performance tab of the Visual Assist options dialog. By default, the one-time parse uses all available resources to finish as fast as possible.

For more information or support check out our forum and documentation.

Some features mentioned above require the latest build, check here for updates.

Developer Showcase: Visual Assist in Action

If you follow our blog, you’ve seen the features that our team is putting in place and likely felt their impact in your development. Instead of hearing more of the same, we thought we would share thoughts from one of our users. Meet Distalsoft, two brothers, one who can’t stop gaming and one with ideas. We’re not sure which one wrote this post, but either way check them out when you want to hunt for treasure or lose it all attempting Brexit.

C++ with Visual Assist, Visual Studio and Unreal Engine

It’s inspiring that software like Microsoft’s Visual Studio IDE and Epic’s Unreal Engine have been “free” for so long now. It pains me to think about where indie developers would be without the forward thinking force of these larger companies and their seemingly never-ending generosity. Helping start-ups and the like to get their feet on the ground is something I will forever be grateful for.

Although the tools come close to it, it would be naive to think that they can fulfil the job of every requirement. I want to point out a few problems we were facing at Distalsoft when it came to developing in Visual Studio using Unreal Engine and the solution we ended up going with.

Unreal Engine at its core uses the C++ language. Visual Studio – being a Microsoft product – makes development in C# very enjoyable. On the other hand, development in C++ has been a point of frustration for many years. From VS 2010 to VS 2017, improvements have been made to the overall speed of compilation, Intellisense, file searching and the like, but it has taken until 2019 for them to really make a dent in the problem. I must say that VS 2019 has done an excellent job of addressing the aforementioned issues but the question still stands – could it be better?

A few years ago when I was using VS 2015, I’d had enough. I’d sometimes be waiting several minutes for Intellisense to bring back a list of methods or properties that belonged to an object. I’m pretty sure we’ve all done it – smashing the heck out of the ctrl+shift+space keys and cursing at the screen while waiting for the Intellisense to pop up. Or simple searches in the solution explorer that end up taking longer to resolve than simply finding the file yourself. Perhaps even trying to navigate to the definition of a method only to be waiting minutes for the document to load up. Something had to change. I went searching on the internet for a solution. It didn’t take long to stumble across a piece of software called Visual Assist by Whole Tomato. It had been recommended many times on various parts of the AnswerHub forum for Unreal Engine and StackOverflow. Due to it having a trial version, I downloaded a copy to give it a try.

The expression “night and day”, really doesn’t do the software justice but it’ll have to do for now. I was extremely relieved. Searching for files, definitions, even just including header files were now as you would expect from an IDE. The additional dialog menu that is available when right clicking on bits of code you want to perform actions against, has a variety of options that make you realise what was/is missing from the ootb VS. To be honest, I don’t use half of them, but it’s the baseline mechanics that just work so much better. And, to address my biggest issue – the speed of Intellisense – type-ahead now loaded within seconds and sometimes even instantly. What a relief!

Unreal Engine have improved their documentation, but unfortunately it’s still not quite there. I would always see people answer questions in AnswerHub with “Look through the Unreal Engine code, it’s open source”. I always assumed they were joking. Pressing F12 to go to method definitions without Visual Assist would take forever. Thanks to my new found friend Visual Assist, I finally had the ability to go find the answers to some of the most annoying questions. It’s hard to really communicate just how irritating it used to be. Seriously, Visual Assist has made me a happy C++ coder again.

I suppose the last thing to make note of is that Visual Assist is not currently free, but the trial is sufficient to make you realise just how much happier you can be when using it. I would be interested to see Visual Assist introduce a subscription based payment plan, but you can’t complain. They have done a stellar job at creating a brilliant tool.

So in conclusion, go check it out. See for yourself. You won’t be disappointed.

This blog was brought to you by Distalsoft. If you’d like for us to showcase what you’re building (better and faster) with Visual Assist contact us.

Visual Studio 2019 moves VAssistX to Extensions menu

Microsoft Visual Studio 2019 moved all extension menus, including the VAssistX menu of Visual Assist, to a new, top-level Extensions menu. According to Mads Kristensen, a Senior Program Manager at Microsoft, the menus were moved to “give the ecosystem more prominence and declutter the top-level menu when you have a lot of extensions installed“. That reasoning might be solid, but it does require an extra keystroke or click to reach extension commands.

In prior versions of Visual Studio, the VAssistX menu is opened via a single Alt+X. That shortcut, fortuitously, now opens the Extensions menu. In Visual Studio 2019, a subsequent X opens the VAssistX menu within the Extensions menu.

If you are a keyboard user of Visual Studio 2019, use Alt+X, X to reach any VAssistX command previously reached with Alt+X. And when you in the documentation for Visual Assist, know that you must use Alt+X, X every time you read Alt+X.

Those looking to restore old behavior in Visual Studio 2019 might find Extensions in Main menu useful. If you try the extension and want a single Alt+X to open VAssistX, use ‘Tools | Customize |Commands’ to change the accelerator key for Extensions, e.g. from &x to &i.

Speed up opening of editors when using Visual Assist in Windows 10 (Fall Creators Update)

Microsoft tightened security in the Windows 10 Version 1709 Fall Creators Update (FCU), but unfortunately, the tightening adversely affects the performance of applications that use the Win32 GetPixel API. Visual Assist is one such application so initial opening of editor windows in Visual Studio, when Visual Assist is active, can be extremely slow.

You can speed up the opening of edtor windows when using Visual Assist to pre-FCU levels by disabling Control Flow Guard for Visual Studio. Navigate to:

Windows Defender Security Center | App & browser control | Exploit protection settings | Program settings | Add program to customize | Add by program name

Be cautious and choose the exact file path(s) for Visual Studio, or disable protection for any application named “devenv.exe”.

Scroll to disable Control Flow Guard (CFG).

You might improve the performance other aspects of Visual Assist in Visual Studio, at least with respect to the effects of tighter security in the FCU, by disabling all 21 program security settings specific to the application.

Apply, and restart your PC.

You can improve performance of all affected applications in the FCU by disabling CFG at the system level:

App & browser control | Exploit protection settings | System Settings

Obviously, disabling a security feature has its own cost, i.e. less security. You can learn more about the slowness of the API at TenForums and in the Visual Studio Developer Community.

Filter using logical “or”

Many of the dialogs and drop-downs of Visual Assist allow efficient lookups via filtering. For example, filtering within Open File in Solution—a dialog with all files in a solution—lets one find a file quickly if only portions of a name are known. This means one can find veryLongFilenameInProjectTomato.cpp if he knows only “long” and “toma”.

Filtering takes many shapes. Aside from substrings, one can filter using simple expressions. Our expression syntax isn’t full regex but it is tailored to the content being searched.

In this blog post, I introduce searching using logical “or”.

Filtering using logical “or” is often applicable when searching VA Hashtags, where tags are created on-the-fly and often without standards. For example, developers might annotate code with VA Hashtags of the format “todo” followed by the name of the teammate who needs to review or fix the code, but names are entered as first names, last names, or misspelled variants thereof.

For tasks related to developer John Smith, we might find VA Hashtags in either of the following forms.

// #todoJohnSmith
// #todoJSmith

Filtering for “smith” in the VA Hashtags tool window easily finds both.

logicalOrSmithDialog

But a teammate might annotate code with only John’s first name.

// #todoJohn

In this case, filtering for “smith” won’t find the new hashtag. We need to search for “smith or john”, and we use a comma in our expression to do that.

logicalOrSmithJohnDialog

Then, our code might also include unrelated hashtags for John, e.g., a comment directed only at him.

// #John, I fixed this for you.

The previous filtering for “smith or john” will include the unwanted entry.

logicalOrSmithJohnDialog2

To omit the unwanted entry, we need to search for “todo and smith” or “todo and John”. We do that with multiple substrings and a comma.

logicalOrSmithJohnDialog3

This final expression using logical “or” gives us exactly what we want.

You can use expressions in all dialogs and drop-downs that support filtering, including the several that support logical “or”:

If you want to know more about expressions, study one of the features that supports logical “or”, then experiment in all the dialogs and drop-downs you encounter.

Logical “or” requires Visual Assist build 2062 or newer.