Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

feat(app): import settings straight from an installed JetBrains IDE (#2380)

ntbang0901bc048e241383
diff --git a/crates/ide-host/src/plugins/intellij.rs b/crates/ide-host/src/plugins/intellij.rs
index 3fda40fac..4ca022a6e 100644
--- a/crates/ide-host/src/plugins/intellij.rs
+++ b/crates/ide-host/src/plugins/intellij.rs
@@ -78,6 +78,25 @@ pub fn read_source(path: &Path) -> IdeResult<IntellijThemeSource> {
/// The theme plugins of the JetBrains IDEs (and Android Studio) of this user,
/// the themes their IDEs are set to first.
pub fn installed_themes() -> Vec<InstalledIntellijTheme> {
+ find_installed(&local_ide_dirs())
+}
+
+/// The settings folder of a JetBrains IDE (or Android Studio) of this user.
+#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub struct InstalledIdeSettings {
+ /// The IDE and its version: `IntelliJ IDEA 2025.2`.
+ pub ide: String,
+ /// What Import Settings reads.
+ pub path: IpcPath,
+}
+
+/// The settings folders of the JetBrains IDEs of this user, newest first, one per product.
+pub fn installed_ide_settings() -> Vec<InstalledIdeSettings> {
+ settings_folders(&local_ide_dirs())
+}
+
+fn local_ide_dirs() -> Vec<IdeDir> {
let Some(home) = dirs::home_dir() else { return Vec::new() };
let layout = if cfg!(target_os = "macos") {
Layout::Mac
@@ -86,7 +105,15 @@ pub fn installed_themes() -> Vec<InstalledIntellijTheme> {
} else {
Layout::Xdg
};
- find_installed(&ide_dirs(layout, &home, |key| std::env::var_os(key)))
+ ide_dirs(layout, &home, |key| std::env::var_os(key))
+}
+
+/// An IDE that was installed but never run has no `options/` yet: nothing to import.
+fn settings_folders(ides: &[IdeDir]) -> Vec<InstalledIdeSettings> {
+ ides.iter()
+ .filter(|ide| ide.config.join("options").is_dir())
+ .map(|ide| InstalledIdeSettings { ide: ide.label.clone(), path: ide.config.clone().into() })
+ .collect()
}
fn read(path: &Path) -> Result<IntellijThemeSource, String> {
@@ -881,4 +908,23 @@ mod tests {
assert_eq!(found, [theme("shallow-id", "Shallow", false, true), theme("deep-sea-id", "Deep Sea", true, false)]);
assert!(find_installed(&[]).is_empty());
}
+
+ #[test]
+ fn lists_the_settings_folders_of_ides_that_have_been_run() {
+ let tmp = tempfile::tempdir().unwrap();
+ let ide = |label: &str, product: &str, version: (u32, u32)| {
+ let config = tmp.path().join(format!("{product}{}.{}", version.0, version.1));
+ IdeDir { label: label.into(), product: product.into(), version, config: config.clone(), plugins: config }
+ };
+ let used = ide("IntelliJ IDEA 2025.2", "IntelliJIdea", (2025, 2));
+ let fresh = ide("PyCharm 2025.1", "PyCharm", (2025, 1));
+ let used_config = used.config.clone();
+ write(&used_config.join("options/editor.xml"), b"<application/>");
+ std::fs::create_dir_all(&fresh.config).unwrap();
+ assert_eq!(
+ settings_folders(&[used, fresh]),
+ [InstalledIdeSettings { ide: "IntelliJ IDEA 2025.2".into(), path: used_config.into() }]
+ );
+ assert!(settings_folders(&[]).is_empty());
+ }
}
diff --git a/crates/ide-workspace/src/settings.rs b/crates/ide-workspace/src/settings.rs
index 66f88f3f2..3bcab9fa4 100644
--- a/crates/ide-workspace/src/settings.rs
+++ b/crates/ide-workspace/src/settings.rs
@@ -355,7 +355,7 @@ impl SettingsStore {
}
}
-/// A JetBrains IDE's File › Manage IDE Settings › Export Settings… archive: every
+/// A JetBrains IDE's settings folder or exported archive: every
/// entry name, and the text of the entries OpenIDEA maps (the frontend does the mapping).
#[derive(serde::Serialize, specta::Type)]
#[serde(rename_all = "camelCase")]
@@ -370,7 +370,61 @@ const JETBRAINS_OPTIONS: [&str; 4] =
["options/editor-font.xml", "options/colors.scheme.xml", "options/editor.xml", "options/ide.general.xml"];
const JETBRAINS_MAX_TEXT: u64 = 4 << 20;
+/// The settings of a JetBrains IDE: an exported `settings.zip`, or the IDE's own settings folder
+/// (`options/`, `colors/`, … as an installed IDE keeps them).
pub fn read_jetbrains_settings(path: &Path) -> IdeResult<JetBrainsSettings> {
+ if path.is_dir() { read_jetbrains_folder(path) } else { read_jetbrains_archive(path) }
+}
+
+fn is_mapped_jetbrains_file(name: &str) -> bool {
+ JETBRAINS_OPTIONS.contains(&name)
+ || name.strip_prefix("colors/").is_some_and(|n| !n.contains('/') && n.ends_with(".icls"))
+}
+
+/// Folders of the settings folder whose files are listed (their names say what the user customised).
+const JETBRAINS_LISTED_DIRS: [&str; 6] = ["options", "colors", "keymaps", "codestyles", "templates", "inspection"];
+
+fn read_jetbrains_folder(dir: &Path) -> IdeResult<JetBrainsSettings> {
+ use std::io::Read;
+ let real_dir = |path: &Path| path.symlink_metadata().is_ok_and(|m| m.is_dir());
+ if !real_dir(dir) || !real_dir(&dir.join("options")) {
+ return Err(IdeError::invalid("not a JetBrains settings folder"));
+ }
+ let mut entries = Vec::new();
+ let mut files = BTreeMap::new();
+ for sub in JETBRAINS_LISTED_DIRS {
+ if !real_dir(&dir.join(sub)) {
+ continue;
+ }
+ let mut names: Vec<String> = std::fs::read_dir(dir.join(sub))
+ .into_iter()
+ .flatten()
+ .flatten()
+ .filter(|e| e.file_type().is_ok_and(|t| t.is_file()))
+ .map(|e| e.file_name().to_string_lossy().into_owned())
+ .collect();
+ names.sort();
+ for file in names {
+ let name = format!("{sub}/{file}");
+ if is_mapped_jetbrains_file(&name) {
+ let mut text = String::new();
+ std::fs::File::open(dir.join(sub).join(&file))?
+ .take(JETBRAINS_MAX_TEXT)
+ .read_to_string(&mut text)
+ .map_err(|e| IdeError::invalid(format!("{name}: {e}")))?;
+ files.insert(name.clone(), text);
+ }
+ entries.push(name);
+ }
+ }
+ // An exported archive lists `installed.txt` when plugins came along; here they sit in `plugins/`.
+ if real_dir(&dir.join("plugins")) && std::fs::read_dir(dir.join("plugins")).is_ok_and(|mut d| d.next().is_some()) {
+ entries.push("installed.txt".into());
+ }
+ Ok(JetBrainsSettings { entries, files })
+}
+
+fn read_jetbrains_archive(path: &Path) -> IdeResult<JetBrainsSettings> {
use std::io::Read;
let not_jetbrains = || IdeError::invalid("not a JetBrains settings archive");
let mut archive = zip::ZipArchive::new(std::fs::File::open(path)?).map_err(|_| not_jetbrains())?;
@@ -379,9 +433,7 @@ pub fn read_jetbrains_settings(path: &Path) -> IdeResult<JetBrainsSettings> {
for i in 0..archive.len() {
let entry = archive.by_index(i).map_err(|_| not_jetbrains())?;
let name = entry.name().map_err(|_| not_jetbrains())?.into_owned();
- let wanted = JETBRAINS_OPTIONS.contains(&name.as_str())
- || name.strip_prefix("colors/").is_some_and(|n| !n.contains('/') && n.ends_with(".icls"));
- if wanted {
+ if is_mapped_jetbrains_file(&name) {
let mut text = String::new();
entry
.take(JETBRAINS_MAX_TEXT)
@@ -659,6 +711,77 @@ mod tests {
assert!(read_jetbrains_settings(&tmp.path().join("plain.zip")).is_err());
}
+ #[test]
+ fn reads_a_jetbrains_ides_own_settings_folder_like_an_exported_archive() {
+ let tmp = tempfile::tempdir().unwrap();
+ let config = tmp.path().join("IntelliJIdea2025.2");
+ let put = |name: &str, text: &str| {
+ let path = config.join(name);
+ std::fs::create_dir_all(path.parent().unwrap()).unwrap();
+ std::fs::write(path, text).unwrap();
+ };
+ put("colors/_@user_Darcula.icls", "<scheme name=\"_@user_Darcula\"/>");
+ put("colors/nested/ignored.icls", "<scheme/>");
+ put("options/editor-font.xml", "<application/>");
+ put("options/vcs.xml", "<application/>");
+ put("keymaps/macOS.xml", "<keymap/>");
+ put("plugins/Tools/lib/tools.jar", "jar");
+
+ let read = read_jetbrains_settings(&config).unwrap();
+ assert_eq!(read.files.keys().collect::<Vec<_>>(), ["colors/_@user_Darcula.icls", "options/editor-font.xml"]);
+ assert_eq!(
+ read.entries,
+ [
+ "options/editor-font.xml",
+ "options/vcs.xml",
+ "colors/_@user_Darcula.icls",
+ "keymaps/macOS.xml",
+ "installed.txt"
+ ]
+ );
+
+ assert!(read_jetbrains_settings(&tmp.path().join("missing")).is_err());
+ let empty = tmp.path().join("empty");
+ std::fs::create_dir_all(&empty).unwrap();
+ assert!(read_jetbrains_settings(&empty).is_err(), "a folder without options/ is not a settings folder");
+ }
+
+ #[cfg(unix)]
+ #[test]
+ fn jetbrains_folder_does_not_follow_symlinks() {
+ use std::os::unix::fs::symlink;
+
+ let tmp = tempfile::tempdir().unwrap();
+ let config = tmp.path().join("config");
+ let outside = tmp.path().join("outside");
+ std::fs::create_dir_all(&config).unwrap();
+ std::fs::create_dir_all(&outside).unwrap();
+ std::fs::write(outside.join("editor-font.xml"), "outside").unwrap();
+ std::fs::write(outside.join("theme.icls"), "outside").unwrap();
+ symlink(&outside, config.join("options")).unwrap();
+ assert!(read_jetbrains_settings(&config).is_err(), "options/ must be a real directory");
+
+ std::fs::remove_file(config.join("options")).unwrap();
+ std::fs::create_dir(config.join("options")).unwrap();
+ symlink(outside.join("editor-font.xml"), config.join("options/editor-font.xml")).unwrap();
+ for sub in ["colors", "keymaps", "codestyles", "templates", "inspection", "plugins"] {
+ symlink(&outside, config.join(sub)).unwrap();
+ }
+ let read = read_jetbrains_settings(&config).unwrap();
+ assert!(read.entries.is_empty());
+ assert!(read.files.is_empty());
+ }
+
+ #[test]
+ fn jetbrains_folder_bounds_mapped_text_like_an_archive() {
+ let tmp = tempfile::tempdir().unwrap();
+ std::fs::create_dir(tmp.path().join("options")).unwrap();
+ std::fs::write(tmp.path().join("options/editor-font.xml"), vec![b'x'; JETBRAINS_MAX_TEXT as usize + 1])
+ .unwrap();
+ let read = read_jetbrains_settings(tmp.path()).unwrap();
+ assert_eq!(read.files["options/editor-font.xml"].len(), JETBRAINS_MAX_TEXT as usize);
+ }
+
#[test]
fn main_toolbar_can_be_set_and_reset() {
let tmp = tempfile::tempdir().unwrap();
diff --git a/src-tauri/src/commands/app.rs b/src-tauri/src/commands/app.rs
index 662f0a2f7..8da7c5513 100644
--- a/src-tauri/src/commands/app.rs
+++ b/src-tauri/src/commands/app.rs
@@ -252,7 +252,8 @@ pub async fn settings_import(window: Window, state: State<'_, AppState>, path: P
Ok(SettingsImport { settings, storage })
}
-/// Import Settings… with a JetBrains `settings.zip`: reads it; the frontend maps and applies it.
+/// Import Settings… with a JetBrains `settings.zip` or an IDE's settings folder: reads it; the
+/// frontend maps and applies it.
#[tauri::command]
#[specta::specta]
pub async fn settings_read_jetbrains(path: PathBuf) -> IdeResult<ide_workspace::settings::JetBrainsSettings> {
@@ -261,6 +262,15 @@ pub async fn settings_read_jetbrains(path: PathBuf) -> IdeResult<ide_workspace::
.map_err(|e| IdeError::internal(e.to_string()))?
}
+/// The settings folders of the JetBrains IDEs installed for this user, to import from.
+#[tauri::command]
+#[specta::specta]
+pub async fn settings_list_jetbrains_ides() -> IdeResult<Vec<ide_host::plugins::intellij::InstalledIdeSettings>> {
+ tauri::async_runtime::spawn_blocking(|| Ok(ide_host::plugins::intellij::installed_ide_settings()))
+ .await
+ .map_err(|e| IdeError::internal(e.to_string()))?
+}
+
/// Effective source / test / resource / excluded roots of the window's project:
/// auto-detected from build files, overridden by Settings › Project Structure.
#[tauri::command]
diff --git a/src-tauri/src/commands/mod.rs b/src-tauri/src/commands/mod.rs
index 17c38cb22..e76c72980 100644
--- a/src-tauri/src/commands/mod.rs
+++ b/src-tauri/src/commands/mod.rs
@@ -107,6 +107,7 @@ pub fn builder() -> tauri_specta::Builder<tauri::Wry> {
app::settings_export,
app::settings_import,
app::settings_read_jetbrains,
+ app::settings_list_jetbrains_ides,
app::project_rename,
app::project_roots,
app::cancel_request,
diff --git a/src-tauri/src/menu.rs b/src-tauri/src/menu.rs
index a3c59654c..bf026749c 100644
--- a/src-tauri/src/menu.rs
+++ b/src-tauri/src/menu.rs
@@ -251,7 +251,11 @@ pub fn spec(os: Os) -> Vec<Entry> {
sub(
"manageIdeSettings",
"Manage IDE Settings",
- vec![act("file.exportSettings", "Export Settings…"), act("file.importSettings", "Import Settings…")],
+ vec![
+ act("file.exportSettings", "Export Settings…"),
+ act("file.importSettings", "Import Settings…"),
+ act("file.importJetBrainsSettings", "Import Settings from JetBrains IDE…"),
+ ],
),
sub(
"newProjectsSetup",
@@ -2229,6 +2233,7 @@ mod tests {
"file.reloadAllFromDisk",
"file.exportSettings",
"file.importSettings",
+ "file.importJetBrainsSettings",
"file.togglePowerSave",
"macro.startRecording",
"macro.stopRecording",
diff --git a/src/bindings.ts b/src/bindings.ts
index 05c44b505..40a0aa667 100644
--- a/src/bindings.ts
+++ b/src/bindings.ts
@@ -94,8 +94,13 @@ export const commands = {
settingsExport: (path: string, storage: { [key in string]: string }) => typedError<null, IdeError>(__TAURI_INVOKE("settings_export", { path, storage })),
/** Import Settings…: replaces the global settings with the file's; every window re-reads them. */
settingsImport: (path: string) => typedError<SettingsImport_Serialize, IdeError>(__TAURI_INVOKE("settings_import", { path })),
- /** Import Settings… with a JetBrains `settings.zip`: reads it; the frontend maps and applies it. */
+ /**
+ * Import Settings… with a JetBrains `settings.zip` or an IDE's settings folder: reads it; the
+ * frontend maps and applies it.
+ */
settingsReadJetbrains: (path: string) => typedError<JetBrainsSettings, IdeError>(__TAURI_INVOKE("settings_read_jetbrains", { path })),
+ /** The settings folders of the JetBrains IDEs installed for this user, to import from. */
+ settingsListJetbrainsIdes: () => typedError<InstalledIdeSettings[], IdeError>(__TAURI_INVOKE("settings_list_jetbrains_ides")),
/**
* File › Rename Project…: the project's display name (title bar, recent
* projects); an empty `name` restores the folder name. Stored in the project's settings.
@@ -5196,6 +5201,14 @@ export type InstallPreview = {
needsConsent: boolean,
};
+/** The settings folder of a JetBrains IDE (or Android Studio) of this user. */
+export type InstalledIdeSettings = {
+ /** The IDE and its version: `IntelliJ IDEA 2025.2`. */
+ ide: string,
+ /** What Import Settings reads. */
+ path: IpcPath,
+};
+
/** A theme of a plugin installed in a JetBrains IDE. */
export type InstalledIntellijTheme = {
/** The IDE and its version: `IntelliJ IDEA 2025.2`. */
@@ -5339,7 +5352,7 @@ export type JdkVendor = {
};
/**
- * A JetBrains IDE's File › Manage IDE Settings › Export Settings… archive: every
+ * A JetBrains IDE's settings folder or exported archive: every
* entry name, and the text of the entries OpenIDEA maps (the frontend does the mapping).
*/
export type JetBrainsSettings = {
diff --git a/src/features/app/__tests__/importFromJetBrainsIde.test.ts b/src/features/app/__tests__/importFromJetBrainsIde.test.ts
new file mode 100644
index 000000000..a1cc5e3fd
--- /dev/null
+++ b/src/features/app/__tests__/importFromJetBrainsIde.test.ts
@@ -0,0 +1,73 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+const listIdes = vi.fn();
+const ask = vi.fn();
+const importJetBrainsSettings = vi.fn();
+const notify = vi.fn();
+
+vi.mock("@/platform/ipc", async (original) => ({
+ ...(await original<typeof import("@/platform/ipc")>()),
+ call: <T>(result: Promise<T>) => result,
+ commands: { settingsListJetbrainsIdes: () => listIdes() },
+}));
+vi.mock("@/workbench/messages", async (original) => ({
+ ...(await original<typeof import("@/workbench/messages")>()),
+ ask: (request: unknown) => ask(request),
+}));
+vi.mock("../jetbrainsSettings", () => ({ importJetBrainsSettings: (path: string) => importJetBrainsSettings(path) }));
+vi.mock("@/workbench/contributions", async (original) => ({
+ ...(await original<typeof import("@/workbench/contributions")>()),
+ notifications: () => ({ notify }),
+}));
+
+const { importFromJetBrainsIde } = await import("../projectActions");
+
+const idea = {
+ ide: "IntelliJ IDEA 2025.2",
+ path: "/Users/me/Library/Application Support/JetBrains/IntelliJIdea2025.2",
+};
+const studio = {
+ ide: "Android Studio 2024.3",
+ path: "/Users/me/Library/Application Support/Google/AndroidStudio2024.3",
+};
+
+beforeEach(() => {
+ vi.clearAllMocks();
+});
+
+describe("Manage IDE Settings › Import Settings from JetBrains IDE…", () => {
+ it("offers each installed IDE and imports the folder of the one chosen", async () => {
+ listIdes.mockResolvedValue([idea, studio]);
+ ask.mockResolvedValue({ button: "1" });
+ await importFromJetBrainsIde();
+ const request = ask.mock.calls[0]![0] as { buttons: { id: string; label: string; primary?: boolean }[] };
+ expect(request.buttons).toEqual([
+ { id: "0", label: "IntelliJ IDEA 2025.2", primary: true },
+ { id: "1", label: "Android Studio 2024.3", primary: false },
+ ]);
+ expect(importJetBrainsSettings).toHaveBeenCalledExactlyOnceWith(studio.path);
+ });
+
+ it("imports nothing when the dialog is cancelled", async () => {
+ listIdes.mockResolvedValue([idea]);
+ ask.mockResolvedValue({ button: "cancel" });
+ await importFromJetBrainsIde();
+ expect(importJetBrainsSettings).not.toHaveBeenCalled();
+ expect(notify).not.toHaveBeenCalled();
+ });
+
+ it("says so, without a dialog, when no JetBrains IDE has settings on this computer", async () => {
+ listIdes.mockResolvedValue([]);
+ await importFromJetBrainsIde();
+ expect(ask).not.toHaveBeenCalled();
+ expect(notify).toHaveBeenCalledWith(
+ expect.objectContaining({ level: "warning", title: "No JetBrains IDE settings were found on this computer" }),
+ );
+ });
+
+ it("reports a failure to list or read the folders", async () => {
+ listIdes.mockRejectedValue(new Error("denied"));
+ await importFromJetBrainsIde();
+ expect(notify).toHaveBeenCalledWith(expect.objectContaining({ level: "error", title: "Cannot import settings" }));
+ });
+});
diff --git a/src/features/app/__tests__/jetbrainsSettingsImport.test.tsx b/src/features/app/__tests__/jetbrainsSettingsImport.test.tsx
new file mode 100644
index 000000000..49ece2a43
--- /dev/null
+++ b/src/features/app/__tests__/jetbrainsSettingsImport.test.tsx
@@ -0,0 +1,84 @@
+import { beforeEach, expect, it, vi } from "vitest";
+import { act, fireEvent, render, screen } from "@testing-library/react";
+
+const read = vi.fn();
+const set = vi.fn();
+const notify = vi.fn();
+const editor = { fontSize: 13, customSchemes: {}, colorOverrides: {} };
+
+vi.mock("@/platform/ipc", async (original) => {
+ const actual = await original<typeof import("@/platform/ipc")>();
+ return {
+ ...actual,
+ commands: {
+ ...actual.commands,
+ settingsReadJetbrains: (path: string) => read(path),
+ settingsGetGlobal: async () => ({ editor }),
+ settingsSet: (scope: string, key: string, value: string) => set(scope, key, value),
+ },
+ };
+});
+vi.mock("@/workbench/contributions", async (original) => ({
+ ...(await original<typeof import("@/workbench/contributions")>()),
+ notifications: () => ({ notify }),
+}));
+
+const { importJetBrainsSettings } = await import("../jetbrainsSettings");
+const { MessagesHost } = await import("@/workbench/messages");
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ read.mockResolvedValue({
+ status: "ok",
+ data: {
+ entries: ["keymaps/custom.xml", "installed.txt"],
+ files: {
+ "options/editor-font.xml":
+ '<application><component name="DefaultFont"><option name="FONT_FAMILY" value="Monaco" />' +
+ '<option name="FONT_SIZE" value="17" /></component></application>',
+ "colors/custom.icls": '<scheme name="Custom" version="142" parent_scheme="Darcula"><attributes /></scheme>',
+ "options/colors.scheme.xml":
+ '<application><component name="EditorColorsManagerImpl"><global_color_scheme name="Custom" />' +
+ "</component></application>",
+ },
+ },
+ });
+ set.mockResolvedValue({ status: "ok", data: { editor } });
+});
+
+it.each(["Cancel", "Import"])("confirms folder settings before applying them: %s", async (button) => {
+ render(<MessagesHost />);
+ let done!: Promise<void>;
+ await act(async () => {
+ done = importJetBrainsSettings("/settings/PyCharm2026.1");
+ });
+ expect(read).toHaveBeenCalledExactlyOnceWith("/settings/PyCharm2026.1");
+ expect(screen.getByText("Monaco")).toBeInTheDocument();
+ expect(screen.getByText("17")).toBeInTheDocument();
+ expect(screen.getAllByText("Custom")).toHaveLength(2);
+ expect(screen.getByText(/Not imported:/)).toHaveTextContent("Keymap, Plugins");
+ expect(set).not.toHaveBeenCalled();
+ await act(async () => {
+ fireEvent.click(screen.getByRole("button", { name: button }));
+ await done;
+ });
+ if (button === "Cancel") {
+ expect(set).not.toHaveBeenCalled();
+ expect(notify).not.toHaveBeenCalled();
+ } else {
+ const writes = Object.fromEntries(
+ set.mock.calls.map(([scope, key, value]) => {
+ expect(scope).toBe("global");
+ return [key, JSON.parse(value)];
+ }),
+ );
+ const [id] = Object.keys(writes["editor.customSchemes"]);
+ expect(writes).toEqual({
+ "editor.customSchemes": expect.objectContaining({ [id!]: expect.objectContaining({ name: "Custom" }) }),
+ "editor.colorScheme": id,
+ "editor.fontFamily": "Monaco",
+ "editor.fontSize": 17,
+ });
+ expect(notify).toHaveBeenCalledWith(expect.objectContaining({ title: "Settings imported" }));
+ }
+});
diff --git a/src/features/app/jetbrainsSettings.tsx b/src/features/app/jetbrainsSettings.tsx
index c7a3d109b..0375beb8e 100644
--- a/src/features/app/jetbrainsSettings.tsx
+++ b/src/features/app/jetbrainsSettings.tsx
@@ -178,7 +178,7 @@ export async function importJetBrainsSettings(path: string) {
if (!plan.writes.length) {
notifications().notify({
level: "warning",
- title: "No settings OpenIDEA can import were found in this archive",
+ title: "No settings OpenIDEA can import were found",
key: "app.settingsImport",
});
return;
diff --git a/src/features/app/projectActions.ts b/src/features/app/projectActions.ts
index 7392c7f03..85499970e 100644
--- a/src/features/app/projectActions.ts
+++ b/src/features/app/projectActions.ts
@@ -9,6 +9,7 @@ import { call, commands, isTauri } from "@/platform/ipc";
import { useProject } from "@/platform/project";
import { notifications, registerEditorBanner } from "@/workbench/contributions";
import { promptInput } from "@/workbench/inputDialogs";
+import { ask } from "@/workbench/messages";
import { importJetBrainsSettings } from "./jetbrainsSettings";
import { showNewProject } from "./NewProject";
import { tx } from "@/platform/i18n";
@@ -114,6 +115,35 @@ async function importSettings() {
}
}
+/** Import Settings from a JetBrains IDE installed on this computer, without exporting a `settings.zip` first. */
+export async function importFromJetBrainsIde() {
+ try {
+ const ides = await call(commands.settingsListJetbrainsIdes());
+ if (!ides.length) {
+ notifications().notify({
+ level: "warning",
+ title: "No JetBrains IDE settings were found on this computer",
+ key: "app.settingsImport",
+ });
+ return;
+ }
+ const { button } = await ask({
+ title: tx("Import Settings from JetBrains IDE"),
+ body: tx("Choose the IDE to import settings from:"),
+ buttons: ides.map((ide, i) => ({ id: String(i), label: ide.ide, primary: i === 0 })),
+ });
+ const chosen = ides[Number(button)];
+ if (chosen) await importJetBrainsSettings(chosen.path);
+ } catch (e) {
+ notifications().notify({
+ level: "error",
+ title: "Cannot import settings",
+ body: errorText(e),
+ key: "app.settingsImport",
+ });
+ }
+}
+
async function renameProject() {
const project = useProject.getState().project;
if (!project) return;
@@ -184,6 +214,13 @@ export function projectActions(): Action[] {
keywords: ["restore settings", "keymap", "templates", "manage ide settings"],
run: desktop(importSettings),
},
+ {
+ id: "file.importJetBrainsSettings",
+ title: "Import Settings from JetBrains IDE…",
+ category: "File",
+ keywords: ["intellij", "pycharm", "webstorm", "android studio", "migrate", "manage ide settings"],
+ run: desktop(importFromJetBrainsIde),
+ },
{
id: "file.togglePowerSave",
title: "Power Save Mode",
diff --git a/src/platform/locales/en.json b/src/platform/locales/en.json
index 3d4db1359..8bdf026c6 100644
--- a/src/platform/locales/en.json
+++ b/src/platform/locales/en.json
@@ -385,6 +385,7 @@
"menu.manageIdeSettings": "Manage IDE Settings",
"menu.file.exportSettings": "Export Settings…",
"menu.file.importSettings": "Import Settings…",
+ "menu.file.importJetBrainsSettings": "Import Settings from JetBrains IDE…",
"menu.file.togglePowerSave": "Power Save Mode",
"menu.macros": "Macros",
"menu.macro.startRecording": "Start Macro Recording",
diff --git a/src/platform/locales/text/en.json b/src/platform/locales/text/en.json
index a4fc9cdc6..82a19c9cc 100644
--- a/src/platform/locales/text/en.json
+++ b/src/platform/locales/text/en.json
@@ -132,10 +132,14 @@
"Enter a value for each variable": "Enter a value for each variable",
"OpenIDEA or JetBrains settings": "OpenIDEA or JetBrains settings",
"Import JetBrains Settings": "Import JetBrains Settings",
+ "Import Settings from JetBrains IDE": "Import Settings from JetBrains IDE",
+ "Import Settings from JetBrains IDE…": "Import Settings from JetBrains IDE…",
+ "Choose the IDE to import settings from:": "Choose the IDE to import settings from:",
+ "No JetBrains IDE settings were found on this computer": "No JetBrains IDE settings were found on this computer",
"These settings will be imported:": "These settings will be imported:",
"Not imported:": "Not imported:",
"Current color scheme": "Current color scheme",
- "No settings OpenIDEA can import were found in this archive": "No settings OpenIDEA can import were found in this archive",
+ "No settings OpenIDEA can import were found": "No settings OpenIDEA can import were found",
"Overwrite existing branch": "Overwrite existing branch",
"Unset upstream branch": "Unset upstream branch",
"Branch '{n}' already exists": "Branch '{n}' already exists",
diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json
index cdee202e2..81073bc33 100644
--- a/src/platform/locales/text/zh.json
+++ b/src/platform/locales/text/zh.json
@@ -3146,10 +3146,14 @@
"Cannot import settings": "无法导入设置",
"OpenIDEA or JetBrains settings": "OpenIDEA 或 JetBrains 设置",
"Import JetBrains Settings": "导入 JetBrains 设置",
+ "Import Settings from JetBrains IDE": "从 JetBrains IDE 导入设置",
+ "Import Settings from JetBrains IDE…": "从 JetBrains IDE 导入设置…",
+ "Choose the IDE to import settings from:": "选择要从中导入设置的 IDE:",
+ "No JetBrains IDE settings were found on this computer": "此电脑上没有找到 JetBrains IDE 的设置",
"These settings will be imported:": "将导入以下设置:",
"Not imported:": "不导入:",
"Current color scheme": "当前配色方案",
- "No settings OpenIDEA can import were found in this archive": "此压缩包中没有 OpenIDEA 可以导入的设置",
+ "No settings OpenIDEA can import were found": "没有找到 OpenIDEA 可以导入的设置",
"Rename Project": "重命名项目",
"Rename Project…": "重命名项目…",
"New project name:": "新项目名称:",
diff --git a/src/platform/locales/zh.json b/src/platform/locales/zh.json
index f89e2edc2..0ab51cabb 100644
--- a/src/platform/locales/zh.json
+++ b/src/platform/locales/zh.json
@@ -385,6 +385,7 @@
"menu.manageIdeSettings": "管理 IDE 设置",
"menu.file.exportSettings": "导出设置…",
"menu.file.importSettings": "导入设置…",
+ "menu.file.importJetBrainsSettings": "从 JetBrains IDE 导入设置…",
"menu.file.togglePowerSave": "省电模式",
"menu.macros": "宏",
"menu.macro.startRecording": "开始录制宏",