Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Use VSCode Dimmer to Highlight Code when Teaching

    Steven MercatanteSteven Mercatante
    vscodeVS Code

    The VSCode Dimmer extension is great when you want to show and explain code to someone. It helpfully dims the code that's not relevant to the selected line, making it easier for your audience to focus on what you want them to.

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Discuss

    Discuss

    Transcript

    Transcript

    Instructor: Install the VS Code dimmer extension from the marketplace. I've got a demo file here we can use to test this new extension.

    Activate the dimmer by opening up the command palette and searching for ataco dimmer. Now that it's enabled, it'll dim all of the lines except for the current one.

    This is cool, but we can configure it to be more helpful. First, let's set a key binding so we can activate it via keyboard instead of the command palette. Open the keyboard shortcuts menu. Search for dimmer, and let's add a custom keybinding of Alt D.

    Back in our demo file, we can test our new keyboard shortcut to toggle the dimmer on and off. We can also change the number of lines that are dimmed as well as the opacity of the dimmed lines. Let's configure these in the settings.

    We can change the dimmer context value to control the number of lines above and below the current selected line that are not dimmed. Let's set that to two. Let's also change dimmer opacity so that the non-dimmed lines are easier to see.

    Coming back to our demo file, you can see that the dimmed lines are more transparent and more of the lines surrounding the currently selected line are visible.