Skip to content

🎥 Make videos programmatically with React

`@remotion/studio-server`: Fix Zed editor support (#7959)

Jonny Burger49b2288e9105
diff --git a/packages/create-video/src/open-in-editor.ts b/packages/create-video/src/open-in-editor.ts
index 9ae65af296..21d9aaf009 100644
--- a/packages/create-video/src/open-in-editor.ts
+++ b/packages/create-video/src/open-in-editor.ts
@@ -108,8 +108,15 @@ const editorNames = [
'windsurf',
'Windsurf.exe',
'Zed.exe',
- 'Cursor.exe',
'zed',
+ 'zedit',
+ 'zeditor',
+ 'zed-editor',
+ '/Applications/Zed.app/Contents/MacOS/zed',
+ '/Applications/Zed.app/Contents/MacOS/cli',
+ '/Applications/Zed Preview.app/Contents/MacOS/zed',
+ '/Applications/Zed Preview.app/Contents/MacOS/cli',
+ '/Applications/Zed Preview.app/Contents/MacOS/Zed Preview',
] as const;
const displayNameForEditor: {[key in Editor]: string} = {
@@ -165,6 +172,14 @@ const displayNameForEditor: {[key in Editor]: string} = {
emacs: 'emacs',
windsurf: 'Windsurf',
zed: 'Zed',
+ zedit: 'Zed',
+ zeditor: 'Zed',
+ 'zed-editor': 'Zed',
+ '/Applications/Zed.app/Contents/MacOS/zed': 'Zed',
+ '/Applications/Zed.app/Contents/MacOS/cli': 'Zed',
+ '/Applications/Zed Preview.app/Contents/MacOS/zed': 'Zed Preview',
+ '/Applications/Zed Preview.app/Contents/MacOS/cli': 'Zed Preview',
+ '/Applications/Zed Preview.app/Contents/MacOS/Zed Preview': 'Zed Preview',
gvim: 'GVim',
idea: 'IDEA',
mvim: 'mvim',
@@ -212,6 +227,12 @@ const COMMON_EDITORS_OSX: Record<string, Editor> = {
'code-insiders',
'/Applications/VSCodium.app/Contents/MacOS/Electron': 'vscodium',
'/Applications/Cursor.app/Contents/MacOS/Cursor': 'cursor',
+ '/Applications/Zed.app/Contents/MacOS/zed':
+ '/Applications/Zed.app/Contents/MacOS/cli',
+ '/Applications/Zed Preview.app/Contents/MacOS/zed':
+ '/Applications/Zed Preview.app/Contents/MacOS/cli',
+ '/Applications/Zed Preview.app/Contents/MacOS/Zed Preview':
+ '/Applications/Zed Preview.app/Contents/MacOS/cli',
'/Applications/AppCode.app/Contents/MacOS/appcode':
'/Applications/AppCode.app/Contents/MacOS/appcode',
'/Applications/CLion.app/Contents/MacOS/clion':
@@ -242,6 +263,11 @@ const COMMON_EDITORS_LINUX: Record<string, Editor> = {
'code-insiders': 'code-insiders',
vscodium: 'vscodium',
cursor: 'cursor',
+ windsurf: 'windsurf',
+ zed: 'zed',
+ zedit: 'zedit',
+ zeditor: 'zeditor',
+ 'zed-editor': 'zed-editor',
emacs: 'emacs',
gvim: 'gvim',
'idea.sh': 'idea',
@@ -261,6 +287,8 @@ const COMMON_EDITORS_WIN: Editor[] = [
'Code - Insiders.exe',
'VSCodium.exe',
'Cursor.exe',
+ 'Windsurf.exe',
+ 'Zed.exe',
'atom.exe',
'sublime_text.exe',
'notepad++.exe',
@@ -295,6 +323,18 @@ function getArgumentsForLineNumber(
colNumber: number,
) {
const editorBasename = path.basename(editor).replace(/\.(exe|cmd|bat)$/i, '');
+ const isZedEditor =
+ editor === 'zed' ||
+ editor === 'zedit' ||
+ editor === 'zeditor' ||
+ editor === 'zed-editor' ||
+ editor === 'Zed.exe' ||
+ editor.endsWith('/Zed.app/Contents/MacOS/cli') ||
+ editor.endsWith('/Zed Preview.app/Contents/MacOS/cli');
+ if (isZedEditor) {
+ return [fileName + ':' + lineNumber + ':' + colNumber];
+ }
+
switch (editorBasename) {
case 'atom':
case 'Atom':
@@ -328,6 +368,9 @@ function getArgumentsForLineNumber(
case 'VSCodium':
case 'Cursor.exe':
case 'cursor':
+ case 'windsurf':
+ case 'Windsurf':
+ case 'Windsurf.exe':
return ['-g', fileName + ':' + lineNumber + ':' + colNumber];
case 'appcode':
case 'clion':
diff --git a/packages/studio-server/src/helpers/open-in-editor.ts b/packages/studio-server/src/helpers/open-in-editor.ts
index 6434414eea..be7d7768cb 100644
--- a/packages/studio-server/src/helpers/open-in-editor.ts
+++ b/packages/studio-server/src/helpers/open-in-editor.ts
@@ -115,6 +115,15 @@ const editorNames = [
'/Applications/Windsurf.app/Contents/MacOS/Windsurf',
'Windsurf.exe',
'zed',
+ 'zedit',
+ 'zeditor',
+ 'zed-editor',
+ '/Applications/Zed.app/Contents/MacOS/zed',
+ '/Applications/Zed.app/Contents/MacOS/cli',
+ '/Applications/Zed Preview.app/Contents/MacOS/zed',
+ '/Applications/Zed Preview.app/Contents/MacOS/cli',
+ '/Applications/Zed Preview.app/Contents/MacOS/Zed Preview',
+ 'Zed.exe',
] as const;
const displayNameForEditor: {[key in Editor]: string} = {
@@ -142,6 +151,7 @@ const displayNameForEditor: {[key in Editor]: string} = {
'Code.exe': 'VS Code',
'Cursor.exe': 'Cursor',
'Windsurf.exe': 'Windsurf',
+ 'Zed.exe': 'Zed',
'VSCodium.exe': 'VS Codium',
'atom.exe': 'Atom',
'clion.exe': 'CLion',
@@ -169,6 +179,14 @@ const displayNameForEditor: {[key in Editor]: string} = {
cursor: 'Cursor',
windsurf: 'Windsurf',
zed: 'Zed',
+ zedit: 'Zed',
+ zeditor: 'Zed',
+ 'zed-editor': 'Zed',
+ '/Applications/Zed.app/Contents/MacOS/zed': 'Zed',
+ '/Applications/Zed.app/Contents/MacOS/cli': 'Zed',
+ '/Applications/Zed Preview.app/Contents/MacOS/zed': 'Zed Preview',
+ '/Applications/Zed Preview.app/Contents/MacOS/cli': 'Zed Preview',
+ '/Applications/Zed Preview.app/Contents/MacOS/Zed Preview': 'Zed Preview',
emacs: 'emacs',
goland: 'GoLand',
gvim: 'GVim',
@@ -226,6 +244,12 @@ const COMMON_EDITORS_OSX: Record<string, Editor> = {
'/Applications/VSCodium.app/Contents/MacOS/Electron': 'vscodium',
'/Applications/Cursor.app/Contents/MacOS/Cursor': 'cursor',
'/Applications/Windsurf.app/Contents/MacOS/Electron': 'windsurf',
+ '/Applications/Zed.app/Contents/MacOS/zed':
+ '/Applications/Zed.app/Contents/MacOS/cli',
+ '/Applications/Zed Preview.app/Contents/MacOS/zed':
+ '/Applications/Zed Preview.app/Contents/MacOS/cli',
+ '/Applications/Zed Preview.app/Contents/MacOS/Zed Preview':
+ '/Applications/Zed Preview.app/Contents/MacOS/cli',
'/Applications/AppCode.app/Contents/MacOS/appcode':
'/Applications/AppCode.app/Contents/MacOS/appcode',
'/Applications/CLion.app/Contents/MacOS/clion':
@@ -257,6 +281,9 @@ const COMMON_EDITORS_LINUX: Record<string, Editor> = {
cursor: 'cursor',
windsurf: 'windsurf',
zed: 'zed',
+ zedit: 'zedit',
+ zeditor: 'zeditor',
+ 'zed-editor': 'zed-editor',
vscodium: 'vscodium',
emacs: 'emacs',
gvim: 'gvim',
@@ -278,6 +305,7 @@ const COMMON_EDITORS_WIN: Editor[] = [
'VSCodium.exe',
'Cursor.exe',
'Windsurf.exe',
+ 'Zed.exe',
'atom.exe',
'sublime_text.exe',
'notepad++.exe',
@@ -312,8 +340,20 @@ function getArgumentsForLineNumber(
colNumber: number,
) {
const editorBasename = path.basename(editor).replace(/\.(exe|cmd|bat)$/i, '');
+ const isZedEditor =
+ editor === 'zed' ||
+ editor === 'zedit' ||
+ editor === 'zeditor' ||
+ editor === 'zed-editor' ||
+ editor === 'Zed.exe' ||
+ editor.endsWith('/Zed.app/Contents/MacOS/cli') ||
+ editor.endsWith('/Zed Preview.app/Contents/MacOS/cli');
const isFolder =
fs.existsSync(fileName) && fs.lstatSync(fileName).isDirectory();
+ if (isZedEditor) {
+ return [fileName + ':' + lineNumber + ':' + colNumber];
+ }
+
switch (editorBasename) {
case 'atom':
case 'Atom':
@@ -352,8 +392,6 @@ function getArgumentsForLineNumber(
case 'windsurf':
case 'Windsurf':
return ['-g', fileName + ':' + lineNumber + ':' + colNumber];
- case 'zed':
- return ['--new', fileName + ':' + lineNumber + ':' + colNumber];
case 'appcode':
case 'clion':
case 'clion64':