Claude Code: Seamless Line Based Context with VS Code

I’ve been using Claude Code as my main coding tool and VS Code as a UI editor for things that are more convenient with a UI.

Claude Code provides integrations with VS Code and JetBrains IDEs. I haven’t explored this feature much until now.

I discovered a small gem that I want to share with you. When Claude Code is connected to VS Code, it can detect the lines that you are currently selecting. I find this feature is much more convenient than using the @ command to refer to specific lines in a file.

With the @ referencing command, I need to do something like this:

@src/main.py L10-20 do this do that

But with the VS Code integration, I can simply select the lines I want to refer to and start asking Claude right away. Claude Code will actually show “x lines selected” below the chat input. Very neat!

Claude Code Lines Selected

This even works for terminals outside of VS Code. To connect Claude Code to an existing VS Code instance, you can simply type /ide and select the instance you want to connect to. Now, when you select some lines in VS Code, Claude Code will know about it. You can start asking questions right away without using the @ command.

To enable this feature in VS Code, you can simply run claude inside a terminal of VS Code. Claude Code will automatically install the necessary extension for you.

Loading comments...