Skip to content

thorstenstark/open-in-xcode-vs-code-extension

Repository files navigation

Open File in Xcode

A VS Code extension that allows you to quickly open the current file in Xcode and jump to the same line number where your cursor is positioned.

Features

  • 🚀 Quick Access: Open any file in Xcode with a single command
  • 📍 Line Navigation: Automatically jumps to the current line number in Xcode
  • 🎯 Context Menu: Right-click on any file in the editor to open it in Xcode
  • Lightweight: Simple and fast, no configuration needed

Requirements

  • macOS (Xcode command-line tools required)
  • Xcode installed on your system
  • The xed command-line tool (included with Xcode)

Installation

  1. Open VS Code
  2. Go to the Extensions view (Cmd+Shift+X)
  3. Search for "Open File in Xcode"
  4. Click Install

Alternatively, you can install the .vsix file directly:

  1. Open the Command Palette (Cmd+Shift+P)
  2. Run "Extensions: Install from VSIX..."
  3. Select the .vsix file

Usage

Via Command Palette

  1. Open any file in VS Code
  2. Position your cursor on the line you want to jump to
  3. Open the Command Palette (Cmd+Shift+P)
  4. Type "Open File in Xcode (at line)"
  5. Press Enter

Via Context Menu

  1. Right-click anywhere in the editor
  2. Select "Open File at Line in Xcode" from the context menu

The file will open in Xcode and automatically navigate to the line where your cursor was positioned in VS Code.

How It Works

This extension uses Xcode's command-line tool xed to open files. It:

  • Captures the current file path and line number from VS Code
  • Converts VS Code's zero-based line indexing to Xcode's one-based indexing
  • Executes xed --line <lineNumber> <filePath> to open the file in Xcode

Troubleshooting

If you encounter errors:

  1. "Failed to open file in Xcode": Make sure Xcode is installed and the xed command is available in your PATH
  2. Command not found: Run xcode-select --install to install Xcode command-line tools
  3. File doesn't open: Ensure the file path is valid and accessible

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

A VS Code extension to open the current file in Xcode

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published