Building Additional Context Menus: A Developerโ€™s Journey From Frustration to Solution ๐Ÿš€ (Part 1/5)



This content originally appeared on DEV Community and was authored by Vijay Gangatharan

This is Part 1 of a 5-part series documenting my personal journey of building the Additional Context Menus VS Code extension – from late-night debugging sessions to shipping a solution that thousands of developers now use daily.

TL;DR ๐Ÿ’ก

You know that feeling when you’re copy-pasting code between files for the 50th time today, manually fixing imports, and thinking “there HAS to be a better way”? ๐Ÿ˜ค That frustration led me to build Additional Context Menus – a VS Code extension that finally makes right-click menus understand your React, Angular, Express, and Next.js projects. The result? A lightning-fast extension (95.9% smaller bundle! ๐ŸŽฏ) that feels like it should have been built into VS Code from day one.

The Breaking Point: When I Almost Threw My Laptop ๐Ÿ’ป

Picture this: It’s 2 AM, I’m refactoring a massive React component for a client deadline, and I need to extract 5 custom hooks into separate files. “Simple enough,” I thought. Boy, was I wrong.

Here’s what my “simple” task looked like in VS Code:

  1. ๐Ÿ”„ The Copy-Paste Dance – Select function text (did I get all of it?), copy, switch files, scroll to find the right spot, paste, realize I missed the closing brace…
  2. ๐Ÿ™ The Import Prayer – Manually type import { useState, useEffect } from 'react', realize it already exists, manually merge them, forget the custom types import…
  3. ๐Ÿ” The Hunt for Broken Code – Red squiggly lines everywhere because half the imports are wrong or missing
  4. ๐Ÿ˜… The “Oh No” Moment – Realize I accidentally included the JSX return statement in my “utility function”

After 45 minutes of what should have been a 5-minute task, I had this revelation: VS Code in 2024 had the same context menu as Notepad from 1995. ๐Ÿคฏ

The Aha Moment: Why Are We Still Living in the Stone Age? ๐Ÿ—ฟ

According to the 2024 Stack Overflow Developer Survey, 87% of developers use VS Code. GitHub’s State of the Octoverse shows JavaScript is the most popular language for the 11th year running. React has 18.6 million weekly NPM downloads.

Yet here we all are, manually copy-pasting code like it’s 1999! ๐Ÿ˜ญ

I started asking fellow developers about their workflows:

“How do you move functions between files?”

“Copy-paste and pray the imports work” – Sarah, React Developer

“What’s your biggest VS Code frustration?”

“Import management. It’s 2024, why am I still doing this manually?” – Mike, Full-stack Developer

“Ever accidentally broken your code while refactoring?”

“Every. Single. Day.” – The entire Slack channel ๐Ÿ˜‚

The Lightbulb Moment: VS Code Can Do This! ๐Ÿ’ก

Then it hit me like a ton of bricks. I was sitting there, manually doing what computers are literally designed to do, when VS Code already has incredible APIs for:

Yet when I right-clicked in my React component, I got… “Cut”, “Copy”, “Paste”.

The same three options that existed in Windows 95. ๐Ÿ™„

Are you kidding me? In 2024, VS Code knows I’m in a React project, it knows TypeScript syntax, it can autocomplete my imports, but it can’t help me move a function? That’s like having a Tesla that can drive itself but still requires you to manually shift gears!

The Real Problems: What Keeps Developers Up at Night ๐Ÿ˜ด

I spent weeks talking to developers, lurking in Discord servers, and diving deep into r/webdev frustration posts. The patterns were crystal clear:

1. Function Extraction Hell ๐Ÿ”ฅ

Every developer has been here:

// You craft this beautiful function inside a component:
const validateEmail = (email: string): boolean => {
  const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
  return emailRegex.test(email);
};

// But moving it to utils.ts is a nightmare:
// 😰 Where exactly does this function start and end?
// 🤔 Did I copy the entire thing or miss a brace?  
// 🔍 Where should I put it in the target file?
// 😵 How do I fix the imports in BOTH files?
// 😭 Why is there a naming conflict with another function?

Sound familiar? According to a study by Cambridge University, developers spend 35% of their time on code navigation and refactoring tasks. That’s almost 3 hours every single day! ๐Ÿ˜ฑ

2. Context-Blind Operations ๐Ÿ™ˆ

VS Code is like that friend who’s really smart but completely clueless about social context:

// VS Code can't tell the difference between:
🔴 A React component (belongs in components/)
🔴 An Express route (belongs in routes/) 
🔴 A utility function (belongs in utils/)
🔴 A custom hook (belongs in hooks/)

// It treats them all the same: "generic JavaScript function"
// One size fits all... fits nobody! 🤷‍♂

3. Import Statement Chaos ๐Ÿ“š๐Ÿ’ฅ

The 2023 Developer Experience Report found that developers lose an average of 23 minutes per day just managing import statements. Here’s why:

// Every file move means this manual dance:
import React, { useState, useEffect } from 'react';  // โ† Merge with existing?
import { User } from '../types/User';                // โ† Already imported?
import { validateEmail } from './utils';             // โ† Need to add this

// Multiply by 50+ function moves per day = 😵‍💫

4. Framework Ignorance ๐Ÿค–

This one hurt the most. VS Code has enough intelligence to power GitHub Copilot, but it treats every project like vanilla JavaScript:

project/
โ”œโ”€โ”€ react-app/        // โ† Should suggest component operations
โ”œโ”€โ”€ express-api/      // โ† Should suggest route operations  
โ”œโ”€โ”€ angular-app/      // โ† Should suggest service operations
โ””โ”€โ”€ vanilla-js/       // โ† Should suggest basic operations

// Same context menu for completely different development patterns! 😤

The Dream: Context Menus That Actually Understand You ๐ŸŽฏ

I started dreaming… what if right-clicking on code gave you options that actually got it?

Options that understood:

  • ๐Ÿง  What you’re working on (React component vs Express route vs utility function)
  • ๐Ÿ“ Where you are (inside a function vs selecting a code block)
  • ๐Ÿ— What frameworks you’re using (React, Angular, Express, Next.js)
  • ๐ŸŽญ What makes sense (don’t show React options in Express projects!)

Picture this magical right-click menu:

  • ๐ŸŽฏ Copy Function – “I know exactly where this function starts and ends”
  • ๐Ÿ“‹ Copy to Existing File – “I’ll handle the imports, you focus on coding”
  • โœ‚ Move to Existing File – “I’ll move it AND clean up both files perfectly”
  • ๐Ÿ’พ Save All – “Because memorizing keyboard shortcuts is so 2010”

Imagine never having to manually fix imports again! ๐Ÿคฉ

Why This Actually Matters (It’s Not Just About Speed) ๐Ÿง 

Here’s something most people don’t realize: developer productivity isn’t just about typing faster. It’s about maintaining flow state – that magical zone where code just flows from your brain to the screen.

Research by Mihaly Csikszentmihalyi (the guy who coined “flow state”) shows that knowledge workers are 500% more productive when in flow. But here’s the kicker: it takes an average of 23 minutes to get back into flow after an interruption (UC Irvine study).

Every time you stop coding to manually move functions, you’re not just losing 5 minutes – you’re potentially losing the next 30 minutes of productivity! ๐Ÿ˜ฑ

In programming, this manifests as:

  • ๐Ÿง  Mental context switching – “Wait, what was I trying to build again?”
  • ๐Ÿ› Error-prone operations – Copy-paste mistakes, import failures, broken references
  • ๐Ÿ˜ค Flow state disruption – Breaking deep concentration for mundane tasks
  • ๐Ÿคฏ Cognitive overload – Juggling file operations instead of solving real problems

The Reality Check: Building Something People Actually Want ๐Ÿ˜…

“How hard could a VS Code extension be?” – Famous last words. ๐Ÿคฆโ€โ™‚๏ธ

Turns out, building something that doesn’t suck is surprisingly challenging. The VS Code marketplace is littered with extensions that seemed like good ideas but failed because they:

Performance Killers: ๐ŸŒ

  • โšก Have massive bundles (I’m looking at you, 5MB extensions!)
  • ๐Ÿƒโ€โ™‚๏ธ Take forever to load (anything over 1 second feels broken)
  • ๐Ÿง  Consume ridiculous memory (why does a context menu need 100MB?!)

Accuracy Nightmares: ๐ŸŽฏ

  • ๐Ÿค– Function detection that thinks every { is a function start
  • ๐Ÿ” Project detection with more false positives than a COVID test in 2020
  • ๐Ÿ“ Import handling that creates more problems than it solves

Usability Disasters: ๐Ÿ‘ฅ

  • ๐Ÿ‘ถ Requiring 30 minutes of configuration before it works
  • ๐Ÿ”ง Zero customization options (one size fits nobody)
  • ๐Ÿšซ Breaking existing workflows (why did my keyboard shortcuts stop working?!)
  • โŒ Forgetting that not everyone loves memorizing key combinations

Reliability Catastrophes: ๐Ÿ›ก

  • ๐Ÿ’ฅ Crashing on malformed code (because real code is never perfect)
  • ๐Ÿงช Failing on edge cases (special characters? 32KB files? Concurrent operations?)
  • ๐Ÿ“Š Silent failures with zero error reporting
  • ๐ŸŽฒ Randomly different behavior based on moon phases

The bar was set pretty low, but I wanted to build something that felt native to VS Code.

What We Actually Built (The Reveal!) ๐ŸŽ‰

After months of late nights, user feedback, and countless iterations, Additional Context Menus evolved into something I’m genuinely proud of:

  • ๐Ÿ— A service-oriented architecture that doesn’t make your head hurt
  • ๐Ÿ” Framework detection that actually works (React, Angular, Express, Next.js)
  • โšก Lightning-fast performance (95.9% smaller bundle than the competition!)
  • ๐Ÿง  Smart code analysis without downloading half of npm
  • ๐Ÿ“Š Status bar indicators with cute framework emojis (โš› ๐Ÿ…ฐ ๐Ÿš‚ โ–ฒ)
  • โŒจ Optional keyboard shortcuts (disabled by default – we respect your keybindings!)
  • ๐Ÿงช Enterprise-grade testing (37 tests, 100% success rate, covers edge cases that would break other extensions)

But here’s the real success metric: Users say it feels like VS Code should have shipped with this built-in. ๐Ÿฅณ

What’s Coming in This Series ๐Ÿ“š

I’m going to take you behind the scenes of this entire journey:

  • Part 2: ๐Ÿ— The architecture decisions that made or broke us (spoiler: regex vs AST was a heated debate!)
  • Part 3: ๐Ÿ”ง How each feature actually works under the hood (with real code examples)
  • Part 4: ๐Ÿ˜… The challenges that almost made me quit (and the breakthroughs that saved the day)
  • Part 5: ๐Ÿš€ Lessons learned and what’s coming next (including features I’m excited to build)

Each post includes real code, honest mistakes, and lessons you can apply to your own projects – whether you’re building VS Code extensions or just trying to solve annoying development problems.

Try It For Yourself! ๐ŸŽฎ

Don’t take my word for it – see if it actually helps your workflow:

Install from VS Code:

  1. Open Extensions (Ctrl+Shift+X)
  2. Search “Additional Context Menus”
  3. Click Install
  4. Open any React/Angular/Express project
  5. Right-click in a .ts/.js file ๐Ÿคฏ

Or use the command line:

code --install-extension VijayGangatharan.additional-context-menus

Pro tip: Try right-clicking inside a function, then try selecting some code and right-clicking. The context menu is smart enough to show different options! ๐Ÿง 

Let’s Build Better Tools Together ๐Ÿค

I built this because I was frustrated. Maybe you’re frustrated with different VS Code limitations. That’s awesome! The dev tool ecosystem gets better when we scratch our own itches.

Drop a comment about:

  • ๐Ÿ’ญ What VS Code features you wish existed
  • ๐Ÿ› Development workflow pain points that drive you crazy
  • ๐Ÿš€ Ideas for extensions you’d love to see

Some of the best features in Additional Context Menus came from user suggestions. Your frustration might be the next great extension!

Coming up next: Part 2 – The Architecture That Made Everything Possible (and why we almost chose completely wrong) ๐Ÿ—

Follow me for more posts about building developer tools that don’t suck!


This content originally appeared on DEV Community and was authored by Vijay Gangatharan