дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-22 09:30:46 +02:00
Порівняти коміти
2
Коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
8781acd42f | ||
|
|
107bf4a8e2 |
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test("keeps diagnostic text and file counts visible in a narrow Problems pane", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 720, height: 760 });
|
||||
await page.evaluate(async () => {
|
||||
const projectModule = "/src/platform/project.ts";
|
||||
const problemsModule = "/src/features/code-insight/problemsStore.ts";
|
||||
const { useProject } = await import(/* @vite-ignore */ projectModule);
|
||||
const { applyDiagnosticsEvent } = await import(/* @vite-ignore */ problemsModule);
|
||||
const root = useProject.getState().project.root;
|
||||
const path = `${root}/src/features/checkout/shared/services/with-a-long-directory-name/for-order-processing/orders.ts`;
|
||||
const source = "typescript-eslint-application-rules-with-a-very-long-source-label";
|
||||
applyDiagnosticsEvent(path, source, [
|
||||
{
|
||||
range: { start: { line: 2, col: 2 }, end: { line: 2, col: 9 } },
|
||||
severity: "error",
|
||||
source,
|
||||
message: "Invalid order total",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
await page.getByRole("button", { name: "Problems", exact: true }).click();
|
||||
const pane = page.locator('[data-toolwindow="problems"]');
|
||||
await pane.getByRole("tab", { name: /Project Errors/ }).click();
|
||||
await expect(pane.getByRole("toolbar", { name: "Problems actions" })).toHaveAttribute("aria-orientation", "vertical");
|
||||
const tree = pane.getByRole("tree", { name: "Problems" });
|
||||
const count = tree.getByText("1 error", { exact: true });
|
||||
const message = tree.getByText("Invalid order total", { exact: true });
|
||||
await expect(count).toBeVisible();
|
||||
await expect(message).toBeVisible();
|
||||
await expect.poll(() => message.evaluate((element) => element.scrollWidth <= element.clientWidth)).toBe(true);
|
||||
await expect.poll(() => tree.evaluate((element) => element.scrollWidth <= element.clientWidth)).toBe(true);
|
||||
});
|
||||
@@ -14,6 +14,24 @@
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
.results {
|
||||
display: flex;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
}
|
||||
.toolbar {
|
||||
flex: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-1);
|
||||
padding: var(--space-1);
|
||||
border-inline-end: 1px solid var(--border);
|
||||
overflow-y: auto;
|
||||
}
|
||||
.tree {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.tabs {
|
||||
min-width: 0;
|
||||
border: 0;
|
||||
@@ -38,10 +56,21 @@
|
||||
flex: none;
|
||||
color: var(--fg-muted);
|
||||
}
|
||||
.fileLocation {
|
||||
display: flex;
|
||||
gap: var(--space-1-5);
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.fileName {
|
||||
flex: none;
|
||||
max-inline-size: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: var(--fg-strong);
|
||||
}
|
||||
.fileError {
|
||||
padding-block: var(--space-0-5);
|
||||
text-decoration-line: underline;
|
||||
text-decoration-style: wavy;
|
||||
text-decoration-color: var(--danger);
|
||||
@@ -51,18 +80,25 @@
|
||||
.selectedText {
|
||||
color: var(--fg-strong);
|
||||
}
|
||||
.muted {
|
||||
flex: none;
|
||||
.directory {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: var(--fg-subtle);
|
||||
}
|
||||
.count {
|
||||
flex: none;
|
||||
max-inline-size: 50%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: var(--fg-subtle);
|
||||
margin-left: 4px;
|
||||
}
|
||||
.source {
|
||||
flex: none;
|
||||
margin-left: auto;
|
||||
padding-right: 8px;
|
||||
min-width: 0;
|
||||
max-inline-size: 25%;
|
||||
margin-inline-start: auto;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: var(--fg-faint);
|
||||
}
|
||||
.message {
|
||||
@@ -77,6 +113,7 @@
|
||||
.position {
|
||||
flex: none;
|
||||
color: var(--fg-subtle);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.sev-error {
|
||||
flex: none;
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
SplitHandle,
|
||||
SplitPanel,
|
||||
Tabs,
|
||||
Toolbar,
|
||||
Tree,
|
||||
fileIconName,
|
||||
showContextMenu,
|
||||
@@ -213,11 +214,11 @@ function useCurrentPath(): string | null {
|
||||
return currentProblemsPath(text, useSyncExternalStore(subscribeActiveInput, activeInput));
|
||||
}
|
||||
|
||||
export function ProblemsHeaderActions() {
|
||||
function ProblemsToolbar() {
|
||||
const show = useProblemsView((s) => s.show);
|
||||
const toggle = useProblemsView((s) => s.toggle);
|
||||
return (
|
||||
<>
|
||||
<Toolbar aria-label="Problems actions" orientation="vertical" className={styles.toolbar}>
|
||||
<IconButton icon="arrow-up" action="navigate.prevOccurrence" size="small" />
|
||||
<IconButton icon="arrow-down" action="navigate.nextOccurrence" size="small" />
|
||||
<IconButton icon="error" title="Show Errors" size="small" pressed={show.error} onClick={() => toggle("error")} />
|
||||
@@ -235,7 +236,7 @@ export function ProblemsHeaderActions() {
|
||||
pressed={show.info}
|
||||
onClick={() => toggle("info")}
|
||||
/>
|
||||
</>
|
||||
</Toolbar>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -337,33 +338,44 @@ export function ProblemsView() {
|
||||
|
||||
const renderNode = (n: Node, state: TreeRowState) => {
|
||||
if (n.kind === "file") {
|
||||
const name = basename(n.path);
|
||||
const directory = relativeDir(root, n.path);
|
||||
const c = countSeverities(n.items);
|
||||
const parts = [plural(c.error, "error"), plural(c.warning, "warning"), plural(c.info + c.hint, "info")].filter(
|
||||
Boolean,
|
||||
);
|
||||
const counts = [plural(c.error, "error"), plural(c.warning, "warning"), plural(c.info + c.hint, "info")]
|
||||
.filter(Boolean)
|
||||
.join(", ");
|
||||
return (
|
||||
<span className={styles.row}>
|
||||
<Icon name={fileIconName(basename(n.path), n.path)} size={16} className={styles.fileIcon} />
|
||||
<span
|
||||
className={clsx(styles.fileName, c.error > 0 && styles.fileError, state.selected && styles.selectedText)}
|
||||
>
|
||||
{basename(n.path)}
|
||||
<Icon name={fileIconName(name, n.path)} size={16} className={styles.fileIcon} />
|
||||
<span className={styles.fileLocation}>
|
||||
<span
|
||||
className={clsx(styles.fileName, c.error > 0 && styles.fileError, state.selected && styles.selectedText)}
|
||||
title={name}
|
||||
>
|
||||
{name}
|
||||
</span>
|
||||
{directory && (
|
||||
<span className={styles.directory} title={directory}>
|
||||
{directory}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
<span className={styles.count} title={counts}>
|
||||
{counts}
|
||||
</span>
|
||||
<span className={styles.muted}>{relativeDir(root, n.path)}</span>
|
||||
<span className={styles.count}>{parts.join(", ")}</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
const d = n.d;
|
||||
const source = d.source && (d.code ? `${d.source}(${d.code})` : d.source);
|
||||
return (
|
||||
<span className={styles.row} title={d.message}>
|
||||
<Icon name={SEVERITY_ICON[d.severity]} size={14} className={styles[`sev-${d.severity}`]} />
|
||||
<span className={clsx(styles.message, d.deprecated && styles.deprecated)}>{d.message.split("\n")[0]}</span>
|
||||
<span className={styles.position}>:{d.range.start.line + 1}</span>
|
||||
{d.source && (
|
||||
<span className={styles.source}>
|
||||
{d.source}
|
||||
{d.code ? `(${d.code})` : ""}
|
||||
{source && (
|
||||
<span className={styles.source} title={source}>
|
||||
{source}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
@@ -378,9 +390,10 @@ export function ProblemsView() {
|
||||
);
|
||||
|
||||
const selected = target(lead);
|
||||
const list = (
|
||||
const treeView = (
|
||||
<Tree<Node>
|
||||
aria-label="Problems"
|
||||
className={styles.tree}
|
||||
handleRef={tree}
|
||||
roots={roots}
|
||||
getKey={(n) => n.key}
|
||||
@@ -428,7 +441,11 @@ export function ProblemsView() {
|
||||
run: () => copy(n),
|
||||
},
|
||||
...inspectionMenu(n.kind === "diag" ? diagInspection(map, n.path, n.d) : null),
|
||||
...menuGroupItems("problems", { paths: [t.path], line: t.d.range.start.line, column: t.d.range.start.col }),
|
||||
...menuGroupItems("problems", {
|
||||
paths: [t.path],
|
||||
line: t.d.range.start.line,
|
||||
column: t.d.range.start.col,
|
||||
}),
|
||||
]);
|
||||
}}
|
||||
activateExpandable={false}
|
||||
@@ -436,6 +453,12 @@ export function ProblemsView() {
|
||||
empty={empty}
|
||||
/>
|
||||
);
|
||||
const list = (
|
||||
<div className={styles.results}>
|
||||
<ProblemsToolbar />
|
||||
{treeView}
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={styles.view}>
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
import { getContext } from "@/platform/context";
|
||||
import { clearProblems, installProblemsEvents, problemsReport, useProblems } from "./problemsStore";
|
||||
import { installProblemDecorations } from "./decorations";
|
||||
import { ProblemsHeaderActions, ProblemsTabs, ProblemsView, useProblemsHeaderMenu } from "./ProblemsView";
|
||||
import { ProblemsTabs, ProblemsView, useProblemsHeaderMenu } from "./ProblemsView";
|
||||
import { UsagesTabs, UsagesView, useUsagesHeaderMenu } from "./UsagesView";
|
||||
import { UsagesPopup } from "./UsagesPopup";
|
||||
import { findUsages, rerunActiveUsages, resetUsages, showUsageResults, showUsagesPopup } from "./usages";
|
||||
@@ -79,7 +79,6 @@ export function activate(): () => void {
|
||||
order: 30,
|
||||
component: ProblemsView,
|
||||
headerContent: ProblemsTabs,
|
||||
headerActions: ProblemsHeaderActions,
|
||||
headerMenu: useProblemsHeaderMenu,
|
||||
useBadge: useErrorBadge,
|
||||
}),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"Problems actions": "Problems actions",
|
||||
"TODO actions": "TODO actions",
|
||||
"Same as the existing configuration '{existing}'": "Same as the existing configuration '{existing}'",
|
||||
"Windows file and folder names cannot end with a period or space": "Windows file and folder names cannot end with a period or space",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"Problems actions": "问题操作",
|
||||
"Windows file and folder names cannot end with a period or space": "Windows 文件和文件夹名称不能以句点或空格结尾",
|
||||
"Use URL template": "使用 URL 模板",
|
||||
"Use Driver": "使用驱动程序",
|
||||
|
||||
Reference in new issue
Заблокувати користувача