✅ WORKING SOLUTION: Open Java Files in Obsidian

The Solution That Works

Install the VS Code Editor plugin for Obsidian. This embeds VS Code’s editor directly inside Obsidian with full syntax highlighting and code editing features.

Installation Steps

  1. Open Obsidian Settings (Cmd+,)
  2. Go to: Community Plugins
  3. Turn off Restricted Mode (if needed)
  4. Click: Browse
  5. Search for: “VS Code Editor”
  6. Install the plugin by Reorchestrate
  7. Enable the plugin

Plugin URL: obsidian://show-plugin?id=vscode-editor

What You Get

VS Code editor embedded in Obsidian

  • Full syntax highlighting for Java (and all languages)
  • Code completion/IntelliSense
  • Multiple cursors
  • Minimap
  • All VS Code editor features
  • No external app launches

Seamless workflow

  • Click .java file → Opens in VS Code editor inside Obsidian
  • Stay in one app
  • Can have markdown notes and code side-by-side

How It Works

When you click on a .java file in Obsidian:

  1. Opens in an embedded VS Code editor
  2. Full syntax highlighting
  3. Proper code formatting
  4. All VS Code keybindings work
  5. Stays within Obsidian window

Configuration

After installing, the plugin works automatically for:

  • Java (.java)
  • JavaScript/TypeScript (.js, .ts)
  • Python (.py)
  • C/C++ (.cpp, .c, .h)
  • And all other code files

No additional configuration needed!

Benefits for DS-Algo Practice

Perfect for studying patterns:

Left Pane: Session-01-TwoPointers.md (markdown)
Right Pane: TwoPointers.java (VS Code editor)

You can:

  • Read explanations in markdown
  • View code with syntax highlighting
  • Make notes alongside code
  • Copy code snippets easily
  • All in one Obsidian window

Plugin Settings (Optional)

In Obsidian Settings → VS Code Editor:

  • Configure theme
  • Set font size
  • Enable/disable minimap
  • Customize keybindings

Alternative Workflows

For Reading: Use VS Code editor in Obsidian ✅
For Coding: Still use IntelliJ IDEA

  • Right-click → “Open in default app” → IntelliJ
  • Or open directly in IntelliJ for compiling/debugging

Previous Solutions (Didn’t Work)

❌ Adding textFileExtensions to app.json - Didn’t work
❌ Changing system file associations - Didn’t work
❌ Right-click “Open in Obsidian” - Opens plain text editor without syntax highlighting

The Winning Solution

VS Code Editor Plugin - Full featured embedded editor


Now you can study patterns and write code comfortably in Obsidian! 🎯