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.

fix(spelling): merge the two dictionary saves into one row (#1833)

arookieofc58f567c954e1
diff --git a/src/editor/lsp/spelling.test.ts b/src/editor/lsp/spelling.test.ts
index 6f93be8c2..62550c5de 100644
--- a/src/editor/lsp/spelling.test.ts
+++ b/src/editor/lsp/spelling.test.ts
@@ -77,15 +77,11 @@ describe("Typo inspection", () => {
expect(diagnosticMarks(lint)).toEqual([]);
view.dispatch({ selection: { anchor: 5 } });
- expect(spellingIntentions(view).map((i) => i.label)).toEqual([
- "Typo: Change to…",
- "Save 'mesage' to project-level dictionary",
- "Save 'mesage' to application-level dictionary",
- ]);
- // IDEA's → menu: the dictionaries and the inspection's controls.
+ expect(spellingIntentions(view).map((i) => i.label)).toEqual(["Typo: Change to…", "Save 'mesage' to dictionary"]);
+ // IDEA's → menu: each dictionary level and the inspection's controls.
expect(spellingIntentions(view)[0]!.submenu?.map((i) => ("label" in i ? i.label : "-"))).toEqual([
- "Save 'mesage' to project-level dictionary",
- "Save 'mesage' to application-level dictionary",
+ "Save to project-level dictionary",
+ "Save to application-level dictionary",
"-",
"Edit inspection profile setting",
"Disable inspection",
diff --git a/src/editor/lsp/spelling.ts b/src/editor/lsp/spelling.ts
index 89284b330..1a10926cc 100644
--- a/src/editor/lsp/spelling.ts
+++ b/src/editor/lsp/spelling.ts
@@ -142,26 +142,23 @@ export function spellingIntentions(view: EditorView): ListPopupItem[] {
const typo = typoAt(view.state, sel.head);
if (!typo) return [];
const hasProject = !!useProject.getState().project;
- const saves: ListPopupItem[] = [
+ // One row saves to the project dictionary (application-level without a project);
+ // its submenu still offers each level, then the inspection controls.
+ const saveSubmenu: MenuItem[] = [
...(hasProject
? [
{
id: "spelling.saveProject",
- label: tx`Save '${typo.word}' to project-level dictionary`,
- icon: "bulb-fix",
- run: () => saveToDictionary(typo.word, "project"),
+ label: "Save to project-level dictionary",
+ run: () => void saveToDictionary(typo.word, "project"),
},
]
: []),
{
id: "spelling.saveIde",
- label: tx`Save '${typo.word}' to application-level dictionary`,
- icon: "bulb-fix",
- run: () => saveToDictionary(typo.word, "ide"),
+ label: "Save to application-level dictionary",
+ run: () => void saveToDictionary(typo.word, "ide"),
},
- ];
- const submenu: MenuItem[] = [
- ...saves.map((s) => ({ id: s.id, label: s.label, verbatim: true, run: () => void s.run() })),
{ kind: "separator" },
...intentionControls({ id: SPELLING_INSPECTION, name: "Typo" }),
];
@@ -172,9 +169,15 @@ export function spellingIntentions(view: EditorView): ListPopupItem[] {
icon: "bulb-fix",
emphasis: true,
run: () => changeTo(view, typo),
- submenu,
+ submenu: saveSubmenu,
+ },
+ {
+ id: "spelling.save",
+ label: tx`Save '${typo.word}' to dictionary`,
+ icon: "bulb-fix",
+ run: () => saveToDictionary(typo.word, hasProject ? "project" : "ide"),
+ submenu: saveSubmenu,
},
- ...saves.map((s) => ({ ...s, submenu })),
];
}
diff --git a/src/platform/locales/text/es.json b/src/platform/locales/text/es.json
index 37333d489..c83127272 100644
--- a/src/platform/locales/text/es.json
+++ b/src/platform/locales/text/es.json
@@ -3966,8 +3966,6 @@
"Rename '{name}'": "Renombrar '{name}'",
"Change '{word}' to": "Cambiar '{word}' a",
"Rename '{word}' to": "Renombrar '{word}' a",
- "Save '{word}' to project-level dictionary": "Guardar '{word}' en el diccionario del proyecto",
- "Save '{word}' to application-level dictionary": "Guardar '{word}' en el diccionario de la aplicación",
"Typo: In word '{word}'": "Error tipográfico: en la palabra '{word}'",
"Choose Super Class or Interface ({count} found)": "Elegir superclase o interfaz ({count} encontradas)",
"Choose Super Method of {name} ({count} found)": "Elegir supermétodo de {name} ({count} encontrados)",
diff --git a/src/platform/locales/text/fr.json b/src/platform/locales/text/fr.json
index f5ff766d1..da2d181b6 100644
--- a/src/platform/locales/text/fr.json
+++ b/src/platform/locales/text/fr.json
@@ -3826,8 +3826,6 @@
"Rename '{name}'": "Renommer '{name}'",
"Change '{word}' to": "Remplacer '{word}' par",
"Rename '{word}' to": "Renommer '{word}' en",
- "Save '{word}' to project-level dictionary": "Enregistrer '{word}' dans le dictionnaire du projet",
- "Save '{word}' to application-level dictionary": "Enregistrer '{word}' dans le dictionnaire de l'application",
"Typo: In word '{word}'": "Faute de frappe : dans le mot '{word}'",
"Choose Super Class or Interface ({count} found)": "Choisir la classe parente ou l'interface ({count} trouvées)",
"Choose Super Method of {name} ({count} found)": "Choisir la méthode parente de {name} ({count} trouvées)",
diff --git a/src/platform/locales/text/ko.json b/src/platform/locales/text/ko.json
index 062ac14b4..14fa08924 100644
--- a/src/platform/locales/text/ko.json
+++ b/src/platform/locales/text/ko.json
@@ -3935,8 +3935,6 @@
"Rename '{name}'": "'{name}' 이름 변경",
"Change '{word}' to": "'{word}'을(를) 다음으로 변경",
"Rename '{word}' to": "'{word}'의 이름을 다음으로 변경",
- "Save '{word}' to project-level dictionary": "'{word}'을(를) 프로젝트 수준 사전에 저장",
- "Save '{word}' to application-level dictionary": "'{word}'을(를) 애플리케이션 수준 사전에 저장",
"Typo: In word '{word}'": "오타: 단어 '{word}'",
"Choose Super Class or Interface ({count} found)": "슈퍼 클래스 또는 인터페이스 선택({count}개 찾음)",
"Choose Super Method of {name} ({count} found)": "{name}의 슈퍼 메서드 선택({count}개 찾음)",
diff --git a/src/platform/locales/text/pl.json b/src/platform/locales/text/pl.json
index 3c9c5e5bf..34a27de5b 100644
--- a/src/platform/locales/text/pl.json
+++ b/src/platform/locales/text/pl.json
@@ -3926,8 +3926,6 @@
"Rename '{name}'": "Zmień nazwę '{name}'",
"Change '{word}' to": "Zmień '{word}' na",
"Rename '{word}' to": "Zmień nazwę '{word}' na",
- "Save '{word}' to project-level dictionary": "Zapisz '{word}' w słowniku poziomu projektu",
- "Save '{word}' to application-level dictionary": "Zapisz '{word}' w słowniku poziomu aplikacji",
"Typo: In word '{word}'": "Literówka: w słowie '{word}'",
"Choose Super Class or Interface ({count} found)": "Wybierz nadklasę lub interfejs (znaleziono: {count})",
"Choose Super Method of {name} ({count} found)": "Wybierz nadrzędną metodę dla {name} (znaleziono: {count})",
diff --git a/src/platform/locales/text/pt.json b/src/platform/locales/text/pt.json
index a531713b5..fc835b6d0 100644
--- a/src/platform/locales/text/pt.json
+++ b/src/platform/locales/text/pt.json
@@ -3932,8 +3932,6 @@
"Rename '{name}'": "Renomear '{name}'",
"Change '{word}' to": "Alterar '{word}' para",
"Rename '{word}' to": "Renomear '{word}' para",
- "Save '{word}' to project-level dictionary": "Salvar '{word}' no dicionário do projeto",
- "Save '{word}' to application-level dictionary": "Salvar '{word}' no dicionário do aplicativo",
"Typo: In word '{word}'": "Erro de digitação: na palavra '{word}'",
"Choose Super Class or Interface ({count} found)": "Escolher superclasse ou interface ({count} encontradas)",
"Choose Super Method of {name} ({count} found)": "Escolher supermétodo de {name} ({count} encontrados)",
diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json
index b81359cd4..c4017151c 100644
--- a/src/platform/locales/text/zh.json
+++ b/src/platform/locales/text/zh.json
@@ -4052,8 +4052,9 @@
"Rename '{name}'": "重命名 '{name}'",
"Change '{word}' to": "将 '{word}' 更改为",
"Rename '{word}' to": "将 '{word}' 重命名为",
- "Save '{word}' to project-level dictionary": "将 '{word}' 保存到项目级词典",
- "Save '{word}' to application-level dictionary": "将 '{word}' 保存到应用程序级词典",
+ "Save '{word}' to dictionary": "将 '{word}' 保存到词典",
+ "Save to project-level dictionary": "保存到项目级词典",
+ "Save to application-level dictionary": "保存到应用程序级词典",
"Typo: In word '{word}'": "拼写错误:单词 '{word}'",
"Choose Super Class or Interface ({count} found)": "选择超类或接口(找到 {count} 个)",
"Choose Super Method of {name} ({count} found)": "选择 {name} 的超方法(找到 {count} 个)",