Edit3
Component tabs for Angular & React in VS Code.
One file on disk. Three tabs in the editor.
Single-file components are pleasant to own and awkward to edit: the template is a string, the styles are a string, and the editor treats both as plain text. Edit3 keeps the component in one file and opens its markup and styles beside it as real editor tabs, each with the language support it deserves. Everything you type flows straight back into the source file, so your build, your Git history and your folder structure never change.
card.component.ts ← Angular: the only file on disk
├─ card.component.html ← tab for `template: `...``
└─ card.component.scss ← tab for `styles: `...``
Card.tsx ← React: the only file on disk
├─ Card.markup.tsx ← tab for the JSX the component returns
└─ Card.styles.scss ← tab for the file's styled-components / Emotion blocks
Features
- Three tabs, one file. Open a component and its template (or JSX) and styles open next to it, in the background, so the source stays in front. Close the source and they close too.
- Real language support per tab. HTML completions, Emmet, formatting and tag auto-close in template tabs; CSS, SCSS or Less in style tabs.
- Framework features carried over. Angular template tabs get completions, hover, go to definition, rename, quick fixes and template errors from the Angular Language Service. React markup tabs get the same from TypeScript, so props, local variables and hooks are known.
- Live, two-way sync. Edit the tab or the source; the other updates as you type. Escaping, indentation and line endings are handled, and undo stays sane.
- styled-components and Emotion. Every styled block in a React file appears in one SCSS tab, one section per block, with
${...} shown as editable #{...}.
Installation
From the VS Code Marketplace: search for Edit3 in the Extensions view.
From a release: download the .vsix, then in VS Code open the Extensions view, choose … → Install from VSIX…, and pick the file. Or from a terminal:
code --install-extension edit3-0.3.0.vsix
Requires desktop VS Code 1.90 or later. For Angular features in template tabs, also install the Angular Language Service extension.
Usage
Open any component. Its tabs open automatically:
| Framework |
Source |
Recognised as a component when it has… |
Tabs |
| Angular |
.ts |
@Component with inline template and/or styles |
.html, .css / .scss / .less |
| React |
.tsx, .jsx |
a function, arrow, memo, forwardRef or class component returning JSX, and/or styled blocks |
.markup.tsx, .styles.scss |
You can also use the CodeLens links above each component, the button in the editor title bar, the Component Parts view in the Explorer, or these commands:
| Command |
Shortcut |
| Edit3: Open Component in Tabs |
Ctrl+Alt+O / Cmd+Alt+O |
| Edit3: Go to Component Source |
Ctrl+Alt+O / Cmd+Alt+O from a tab |
| Edit3: Open Template / Markup |
|
| Edit3: Open Styles |
|
React styles tab
All styled blocks of a file share one tab, each under a header named after its variable:
@keyframes fade {
from { opacity: 0; }
}
.Wrapper {
padding: 1rem;
color: #{p => p.tone};
}
The header lines are generated and must stay as they are; if one is changed or removed, sync pauses with a warning until it is restored. ${...} substitutions appear as #{...}, the code inside is fully editable, and typing a new #{...} creates a new substitution. Global styles appear as @layer Name {, and blocks not assigned to a variable as .css1, .css2, and so on.
Settings
| Setting |
Default |
Description |
edit3.autoOpen |
true |
Open and close the tabs together with the component's source tab. |
edit3.styleLanguage |
auto |
Angular style language. auto follows inlineStyleLanguage in the nearest angular.json / project.json, else CSS. React styles always open as SCSS. |
edit3.codeLens |
true |
Show links above each component. |
edit3.forwardLanguageFeatures |
true |
Bring Angular and TypeScript features into template and markup tabs. |
edit3.saveTabsWithSource |
true |
Saving the source file also clears the modified marker on its tabs. |
How it works
The tabs are files of a virtual edit3: file system, addressed as if the source file were a folder (edit3:/app/Card.tsx/Card.markup.tsx). Because the editor sees real files, the tabs are editable and saveable and pick their language from the extension. Reads come from the live source document and writes go back into it; nothing is stored anywhere else.
Plain HTML and CSS support reaches the tabs on its own. Framework features need the project, which language servers only load for files on disk, so requests in a template or markup tab are translated to the matching position in the source file, answered by that file's providers, and mapped back. Errors inside mirrored regions are copied onto the tabs.
See CONTRIBUTING.md for the architecture and the development workflow.
Known limitations
- Angular templates built with
${...} interpolation or from a constant have no tab.
- React: only the component's final top-level
return gets a markup tab; early returns stay in the source. CSS Modules and Tailwind keep their styles outside the file, so there is nothing to split out.
- Completions that would add an import elsewhere in the source arrive without that edit; the import is offered as a quick fix instead.
- Virtual files cannot appear inside real folders in the Explorer, which is why the Component Parts view exists.
- Desktop VS Code only; not available in vscode.dev.
Contributing
Issues and pull requests are welcome. To get started:
npm install
npm run build
npm test
Then press F5 in VS Code to launch an Extension Development Host with the sample workspace. CONTRIBUTING.md has the details.
License
MIT © Charles Curtis Simpson III