fix(java): name reserved Windows device files that abort the Java import (#1032)

On Windows, a project file named after a device (nul, con, aux, prn, com1-9, lpt1-9; nul is typically left by a 2>nul redirect in Git Bash) aborts the Java import: Files.exists reports it missing, Eclipse's refresh builds a child path with an empty name and throws "Path must include project and resource name", so m2e never creates the Java project.

When JDT LS reports that failure on Windows, the server root is scanned for reserved device names (bounded, ignore files not honoured) and a one-time error notification lists them with how to recover. The name check covers COM0-9/LPT0-9 including superscript digits, case-insensitive, with or without extension or trailing spaces. Backend notification texts now go through txTemplate so templated catalog entries translate; zh text added.

Refs #976
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-11-03 21:09:03 +08:00
1 джерело a3b6780823
коміт dcd8ecc5ae
6 files changed
+253 -3

No files matched your search

+3 -2
Переглянути файл
@@ -2,7 +2,7 @@
import type { ReactNode } from "react";
import { create } from "zustand";
import { call, commands, onIdeEvent } from "@/platform/ipc";
import { tx } from "@/platform/i18n";
import { txTemplate } from "@/platform/i18n";
import { useProject } from "@/platform/project";
import type { NotificationService } from "./contributions";
@@ -197,6 +197,7 @@ export const notificationServiceImpl: NotificationService = {
export function installNotifyEvents(): () => void {
return onIdeEvent(
"notify",
(e) => void notify({ level: e.level, title: tx(e.title), body: e.body ? tx(e.body) : undefined }),
// Backend text may carry values (paths, names); `{name}` catalog templates translate it.
(e) => void notify({ level: e.level, title: txTemplate(e.title), body: e.body ? txTemplate(e.body) : undefined }),
);
}