Skip to content
lazycodertools edited this page Jan 20, 2022 · 1 revision

What is Code Filter

Code Filter is a productivity tool that provides a way to look at subsets of code, defined in terms of syntax elements.

The idea boils down to: "See less code, when you can".

Main use cases:

Narrow full-text search when you know what code elements are relevant. Watch a demo.

Hide irrelevant details when you are focused on architecture or code maintenance tasks.

Current state

Currently the tool is in preview stage, a free edition is available, a pro version is work in progress.

Supports C# as it's first language.

Deployed as an extension to Visual Studio (2017, 2019 or 2022).

Installation

To install the free edition, open Extensions Manager dialog in Visual Studio and search for 'Code Filter (Free)' extension in the Visual Studio Marketplace.

Visual Studio 2017 is supported starting from version 15.7

Getting Started

  1. Open a C# project.
  2. Open a C# file in the editor.
  3. Press Ctrl + 2 to show the Code Filter tool window (or through 'View' and 'Other Windows' menu).
  4. Type a keyword to initiate a search.
  5. Type '=' to switch between views, '=+' to combine, '=-' to exclude.
  6. Type '==' to change search scope.
  7. Type '===' to repeat any of your previous searches.
  8. To hide the tool window press Shift + Esc.

Introduction

Terminology

View - a subset of code described in terms of syntax elements.

A view applied to a source file results in a list of code elements.

Examples of views:

strings view shows a list of all string literals found in the source file.

comments lists all comments.

text is the default view, shows all lines of code.

Filter - a phrase, usually split into keywords, used to filter results of a view.

For example:

  1. 'Hello World' filter applied to the text view, will show all lines that contain both words 'Hello' and 'World'.

  2. 'Hello World' filter applied to the comments view, will show all comments that contain both 'Hello' and 'World'.

If a comment is a multiline one, and the words 'Hello' and 'World' happen to be on different lines, then in the first example they won't be found, but in the second they would.

Search - one or more views combined

Certain views can be added together and result in a union of code elements from all the views.

For example:

strings and comments views can be combined, when it makes sense to search both.

Some views can be subtracted from other views, with their results excluded.

For example:

The comments view can be subtracted from the text view to exclude all comments from the code.

Scope - a set of files a search is applied to. Available scopes are:

  • Solution
  • One or more projects
  • One or more files