Файли
openidea/src/features/debugger/breakpoints/languages.ts
T
Jaw 5217f8570b chore: add knip and remove the dead code it reports (#247)
Adds knip (pnpm knip, knip.ts covering src, scripts, perf and e2e) and runs it in the CI frontend job. Removes what it reported: the unused codemirror and @types/dompurify dependencies, exports and test hooks used nowhere (AppLogo, Tooltip, barrel re-exports, duplicate default exports of lazily loaded settings pages), the unused iterateAll helper, and the zh entry for a deleted notification. rustfmt (used by lint-staged) is ignored as a toolchain binary.

Co-authored-by: jaw52 <[email protected]>
2026-10-29 23:21:56 +08:00

31 рядки
1.0 KiB
TypeScript
Неформатований Анотація Історія

Цей файл містить неоднозначні символи Юнікоду
Цей файл містить символи Юнікоду, які можна сплутати з іншими символами. Якщо ви вважаєте, що це зроблено навмисно, можете сміливо ігнорувати це попередження. Щоб показати їх, скористайтеся кнопкою Escape.
/**
* Settings › Debugger › Breakpoints › "Allow placing breakpoints in any file":
* when off, new line breakpoints go only into files of languages that have a
* debug adapter (`languages/*.toml` `[debugger]`).
*/
import { commands, isTauri } from "@/platform/ipc";
import { workflowSettings } from "@/platform/workflowSettings";
let debuggable: Set<string> | null = null;
let loading = false;
function load() {
if (debuggable || loading || !isTauri()) return;
loading = true;
commands
.languages()
.then((langs) => {
debuggable = new Set(langs.filter((l) => l.debuggable).map((l) => l.id));
})
.catch(() => undefined)
.finally(() => (loading = false));
}
/** Whether a new breakpoint may be placed in a file of `language`. */
export function canPlaceBreakpoint(language: string): boolean {
if (workflowSettings().debugger.breakpointsAnyFile) return true;
load();
// Until the language list is known, don't block anything.
return !debuggable || debuggable.has(language);
}