Warning
Ember Source Lens is currently in early development, some aspects may still be unstable or incomplete. Please report any issues you encounter on the GitHub Issues page. Failing tests would be much appreciated to help us improve the project. Thank you for your understanding and support!
Click-to-source developer tool for Ember.js applications
Ember Source Lens is a powerful development tool that lets you navigate your Ember codebase by clicking on any rendered component to jump directly to its source file in your editor. Perfect for large codebases where finding component definitions can be tricky.
- ๐ฏ Precise Navigation - Click any component to jump directly to its source file, line, and column
- โก IDE Integration - Open the precise line in your editor. Supports VSCode, WebStorm, Atom, Sublime Text, Cursor, and Windsurf.
- ๐ฅ Inline Editing - Edit components in the inline editor
- ๐จ Visual Overlay - Hover over elements to see highlighted component boundaries
- โจ๏ธ Keyboard Shortcut - Quick toggle with
Cmd+Shift+L(orCtrl+Shift+Lon Windows/Linux) - ๐พ State Persistence - Remembers your last selected component across page reloads
- Ember.js v5.8 or above
- Usage of template tags for templates
- Vite for inline editing support
pnpm add -D ember-source-lens
# or
npm install --save-dev ember-source-lens
# or
yarn add -D ember-source-lensIn your babel.config.js:
const { sourceLens } = require('ember-source-lens/babel');
module.exports = {
plugins: [
// ...
[
'babel-plugin-ember-template-compilation',
{
transforms: [
sourceLens.template(), // Add Source Lens Babel template plugin
],
},
],
sourceLens(), // add source lens babel plugin
// ...
],
};Add the <SourceLens> component to your application template:
// app/templates/application.gjs
import { SourceLens } from 'ember-source-lens';
<template>
{{outlet}}
<SourceLens
@editor="vscode"
@projectRoot="/absolute/path/to/your/project"
/>
</template>The vite plugin allows inline editing by acting as a bridge between Source Lens and your file system.
In your vite.config.mjs:
import { defineConfig } from 'vite';
import { sourceLens } from 'ember-source-lens/vite';
export default defineConfig({
plugins: [
// ... other plugins
sourceLens(),
],
});| Option | Type | Default | Description |
|---|---|---|---|
@editor |
string |
'vscode' |
Your preferred code editor |
@projectRoot |
string |
'' |
Absolute path to your project root |
- VS Code -
@editor="vscode"or@editor="code" - WebStorm / IntelliJ -
@editor="webstorm"or@editor="intellij" - Sublime Text -
@editor="sublime"or@editor="sublimetext" - Atom -
@editor="atom" - Cursor -
@editor="cursor" - Windsurf -
@editor="windsurf"
Cmd+Shift+L(Mac) orCtrl+Shift+L(Windows/Linux) - Toggle Source Lens panel on/off
- Activate Source Lens - Press
Cmd+Shift+Lto enable the Source Lens panel - Enable Inspect Mode - Click the ๐ inspect button in the Source Lens panel
- Hover Over Components - Move your mouse over any component to see its source location
- Click to Select - Click on a component to select it and view details
- Open in Editor - Click "Open in IDE" to jump to the source file in your editor
- Edit Inline (optional) - If inline editing is enabled, use the inline editor to make changes
The Source Lens panel shows:
- Current component's file path and location (
file.gts:line:column) - Inspect button - Toggle hover overlay on/off
- Open in IDE button - Opens selected component in your editor
- Inline Editor button - Edit component source in inline editor
Ember Source Lens is setup to remove itself automatically in production builds, ensuring no performance impact or unnecessary code is shipped to end users. Simply include it as described above, and it will only be active in development mode. This uses NODE_ENV checks to exclude the code during production builds.
- Ensure Babel plugins are installed and enabled
- Check that
@projectRootis set correctly - Verify you're running in development mode
- Make sure your editor is configured to handle custom URL schemes
- Check that
@editormatches your installed editor
Check out the demo app in this repository for a complete working example.
git clone https://github.com/ember-tooling/ember-source-lens.git
cd ember-source-lens
pnpm install
pnpm devVisit http://localhost:4200 and press Cmd+Shift+L to try it out!
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
git clone https://github.com/ember-tooling/ember-source-lens.git
cd ember-source-lens
pnpm install
pnpm devpnpm test
pnpm test:ui # Visual test UIThis project is licensed under the MIT License.
- React Source Lens for inspiration
- All contributors and users of this project