chore: resolve lint warnings across v2 code
Hoist inline Schema compiles to module scope, drop unused imports/vars, stabilize react-markdown component identities via a module-scope factory, remove useless spreads, and use data-derived keys for release-note bullets. No behavior changes. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
94b7d5f7e1
commit
bb23ddfa90
17 files changed
+449
-377
No files matched your search
@@ -1318,6 +1318,261 @@ function areMarkdownFileLinkPropsEqual(
|
||||
);
|
||||
}
|
||||
|
||||
interface ChatMarkdownComponentsContext {
|
||||
readonly cwd: string | undefined;
|
||||
readonly diffThemeName: DiffThemeName;
|
||||
readonly fileLinkParentSuffixByPath: ReadonlyMap<string, string>;
|
||||
readonly inlineCodeFileLinkMetaByText: ReadonlyMap<string, MarkdownFileLinkMeta>;
|
||||
readonly isStreaming: boolean;
|
||||
readonly markdownFileLinkMetaByHref: ReadonlyMap<string, MarkdownFileLinkMeta>;
|
||||
readonly onTaskListChange: ChatMarkdownProps["onTaskListChange"];
|
||||
readonly openInPreferredEditor: (
|
||||
targetPath: string,
|
||||
) => Promise<AtomCommandResult<unknown, unknown>>;
|
||||
readonly openExternalLinkInPreview: (url: string) => Promise<AtomCommandResult<unknown, unknown>>;
|
||||
readonly openMarkdownFileInPreview: (
|
||||
path: string,
|
||||
) => Promise<AtomCommandResult<unknown, unknown>>;
|
||||
readonly resolvedTheme: "light" | "dark";
|
||||
readonly skills: ReadonlyArray<Pick<ServerProviderSkill, "name" | "displayName">>;
|
||||
readonly text: string;
|
||||
readonly threadRef: ScopedThreadRef | undefined;
|
||||
}
|
||||
|
||||
// Module scope so the markdown renderers are not re-declared inside the
|
||||
// component render (react/no-unstable-nested-components). Referential
|
||||
// stability is unchanged: the caller memoizes the result with the same
|
||||
// dependency values as before.
|
||||
function createChatMarkdownComponents(ctx: ChatMarkdownComponentsContext): Components {
|
||||
const {
|
||||
cwd,
|
||||
diffThemeName,
|
||||
fileLinkParentSuffixByPath,
|
||||
inlineCodeFileLinkMetaByText,
|
||||
isStreaming,
|
||||
markdownFileLinkMetaByHref,
|
||||
onTaskListChange,
|
||||
openInPreferredEditor,
|
||||
openExternalLinkInPreview,
|
||||
openMarkdownFileInPreview,
|
||||
resolvedTheme,
|
||||
skills,
|
||||
text,
|
||||
threadRef,
|
||||
} = ctx;
|
||||
const fileLinkChip = (
|
||||
fileLinkMeta: MarkdownFileLinkMeta,
|
||||
copyMarkdown: string,
|
||||
className?: string,
|
||||
) => {
|
||||
const parentSuffix = fileLinkParentSuffixByPath.get(fileLinkMeta.filePath);
|
||||
const labelParts = [fileLinkMeta.basename];
|
||||
if (typeof parentSuffix === "string" && parentSuffix.length > 0) {
|
||||
labelParts.push(parentSuffix);
|
||||
}
|
||||
if (fileLinkMeta.line) {
|
||||
labelParts.push(
|
||||
`L${fileLinkMeta.line}${fileLinkMeta.column ? `:C${fileLinkMeta.column}` : ""}`,
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<MarkdownFileLink
|
||||
href={fileLinkMeta.targetPath}
|
||||
targetPath={fileLinkMeta.targetPath}
|
||||
iconPath={fileLinkMeta.filePath}
|
||||
displayPath={fileLinkMeta.displayPath}
|
||||
workspaceRelativePath={fileLinkMeta.workspaceRelativePath}
|
||||
line={fileLinkMeta.line}
|
||||
label={labelParts.join(" · ")}
|
||||
copyMarkdown={copyMarkdown}
|
||||
theme={resolvedTheme}
|
||||
threadRef={threadRef}
|
||||
onOpen={openInPreferredEditor}
|
||||
onOpenInBrowser={
|
||||
threadRef && isPreviewSupportedInRuntime() && isBrowserPreviewFile(fileLinkMeta.filePath)
|
||||
? () => openMarkdownFileInPreview(fileLinkMeta.filePath)
|
||||
: undefined
|
||||
}
|
||||
className={className}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
return {
|
||||
p({ node: _node, children, ...props }) {
|
||||
return <p {...props}>{renderSkillInlineMarkdownChildren(children, skills)}</p>;
|
||||
},
|
||||
li({ node, children, ...props }) {
|
||||
const listItemStart = node?.position?.start.offset;
|
||||
const markerOffset =
|
||||
typeof listItemStart === "number" ? findTaskListMarkerOffset(text, listItemStart) : null;
|
||||
return (
|
||||
<li {...props} data-task-marker-offset={markerOffset ?? undefined}>
|
||||
{renderSkillInlineMarkdownChildren(children, skills)}
|
||||
</li>
|
||||
);
|
||||
},
|
||||
input({ node: _node, type, checked, disabled: _disabled, ...props }) {
|
||||
if (type !== "checkbox" || !onTaskListChange) {
|
||||
return (
|
||||
<input
|
||||
{...props}
|
||||
type={type}
|
||||
checked={checked}
|
||||
disabled={_disabled}
|
||||
readOnly={type === "checkbox"}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<input
|
||||
{...props}
|
||||
type="checkbox"
|
||||
name="markdown-task"
|
||||
aria-label="Toggle task"
|
||||
checked={checked}
|
||||
onChange={(event) => {
|
||||
const markerOffset = Number(
|
||||
event.currentTarget.closest("li")?.dataset.taskMarkerOffset,
|
||||
);
|
||||
if (!Number.isSafeInteger(markerOffset)) return;
|
||||
onTaskListChange({ markerOffset, checked: event.currentTarget.checked });
|
||||
}}
|
||||
/>
|
||||
);
|
||||
},
|
||||
a({ node, href, children, ...props }) {
|
||||
const normalizedHref = href ? normalizeMarkdownLinkHrefKey(href) : "";
|
||||
const fileLinkMeta = normalizedHref ? markdownFileLinkMetaByHref.get(normalizedHref) : null;
|
||||
if (!fileLinkMeta) {
|
||||
const faviconHost = resolveExternalWebLinkHost(href);
|
||||
const isSameDocumentLink = href?.startsWith("#") ?? false;
|
||||
const onClick = props.onClick;
|
||||
const canOpenInPreview = Boolean(threadRef) && isPreviewSupportedInRuntime();
|
||||
const link = (
|
||||
<a
|
||||
{...props}
|
||||
href={href}
|
||||
target={isSameDocumentLink ? undefined : "_blank"}
|
||||
rel={isSameDocumentLink ? undefined : "noopener noreferrer"}
|
||||
onClick={(event) => {
|
||||
onClick?.(event);
|
||||
if (isSameDocumentLink && href) {
|
||||
handleMarkdownFragmentClick(event, href);
|
||||
}
|
||||
}}
|
||||
onContextMenu={(event) => {
|
||||
if (!canOpenInPreview || !href || !faviconHost) return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const api = readLocalApi();
|
||||
if (!api) return;
|
||||
void showExternalLinkContextMenu({
|
||||
href,
|
||||
position: { x: event.clientX, y: event.clientY },
|
||||
showContextMenu: (items, position) => api.contextMenu.show(items, position),
|
||||
openInPreview: async (target) => {
|
||||
const result = await openExternalLinkInPreview(target);
|
||||
if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
|
||||
reportMarkdownActionFailure(
|
||||
{ operation: "open-link-in-preview", target },
|
||||
result.cause,
|
||||
);
|
||||
}
|
||||
},
|
||||
openExternal: (target) => api.shell.openExternal(target),
|
||||
copyLink: (target) => writeTextToClipboard(target, "link"),
|
||||
reportFailure: (operation, cause) => {
|
||||
reportMarkdownActionFailure({ operation, target: href }, cause);
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
{faviconHost ? (
|
||||
<MarkdownExternalLinkContent host={faviconHost} plainText={plainHastText(node)}>
|
||||
{children}
|
||||
</MarkdownExternalLinkContent>
|
||||
) : (
|
||||
children
|
||||
)}
|
||||
</a>
|
||||
);
|
||||
if (!faviconHost || !href) {
|
||||
return link;
|
||||
}
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger render={link} />
|
||||
<TooltipPopup
|
||||
side="top"
|
||||
className="max-w-[min(36rem,calc(100vw-2rem))] whitespace-normal leading-tight wrap-anywhere"
|
||||
>
|
||||
{href}
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
return fileLinkChip(
|
||||
fileLinkMeta,
|
||||
`[${fileLinkMeta.basename}](${normalizedHref})`,
|
||||
props.className,
|
||||
);
|
||||
},
|
||||
code({ node, children, className, ...props }) {
|
||||
if (node?.properties?.dataInlineCode != null) {
|
||||
const codeText = nodeToPlainText(children);
|
||||
const fileLinkMeta =
|
||||
inlineCodeFileLinkMetaByText.get(codeText.trim()) ??
|
||||
resolveInlineCodeFileLinkMeta(codeText, cwd);
|
||||
if (fileLinkMeta) {
|
||||
return fileLinkChip(fileLinkMeta, `\`${codeText}\``);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<code {...props} className={className}>
|
||||
{children}
|
||||
</code>
|
||||
);
|
||||
},
|
||||
table({ node: _node, ...props }) {
|
||||
return <MarkdownTable {...props} />;
|
||||
},
|
||||
details({ node: _node, children, open: detailsOpen }) {
|
||||
return <MarkdownDetails open={detailsOpen}>{children}</MarkdownDetails>;
|
||||
},
|
||||
pre({ node, children, ...props }) {
|
||||
const codeBlock = extractCodeBlock(children);
|
||||
if (!codeBlock) {
|
||||
return <pre {...props}>{children}</pre>;
|
||||
}
|
||||
|
||||
const language = extractFenceLanguage(codeBlock.className);
|
||||
const fenceTitle = extractFenceTitle(extractPreCodeMeta(node));
|
||||
return (
|
||||
<MarkdownCodeBlock
|
||||
code={codeBlock.code}
|
||||
language={language}
|
||||
fenceTitle={fenceTitle}
|
||||
theme={resolvedTheme}
|
||||
>
|
||||
<RenderErrorBoundary fallback={<pre {...props}>{children}</pre>}>
|
||||
<Suspense fallback={<pre {...props}>{children}</pre>}>
|
||||
<SuspenseShikiCodeBlock
|
||||
className={codeBlock.className}
|
||||
code={codeBlock.code}
|
||||
themeName={diffThemeName}
|
||||
isStreaming={isStreaming}
|
||||
/>
|
||||
</Suspense>
|
||||
</RenderErrorBoundary>
|
||||
</MarkdownCodeBlock>
|
||||
);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function ChatMarkdown({
|
||||
text,
|
||||
cwd,
|
||||
@@ -1434,267 +1689,41 @@ function ChatMarkdown({
|
||||
},
|
||||
[createAssetUrl, openPreview, preparedConnection, threadRef],
|
||||
);
|
||||
/* eslint-disable react/no-unstable-nested-components -- ReactMarkdown requires component
|
||||
* renderers that close over this message's metadata. useMemo keeps them stable until that
|
||||
* metadata changes. */
|
||||
const markdownComponents = useMemo<Components>(() => {
|
||||
const fileLinkChip = (
|
||||
fileLinkMeta: MarkdownFileLinkMeta,
|
||||
copyMarkdown: string,
|
||||
className?: string,
|
||||
) => {
|
||||
const parentSuffix = fileLinkParentSuffixByPath.get(fileLinkMeta.filePath);
|
||||
const labelParts = [fileLinkMeta.basename];
|
||||
if (typeof parentSuffix === "string" && parentSuffix.length > 0) {
|
||||
labelParts.push(parentSuffix);
|
||||
}
|
||||
if (fileLinkMeta.line) {
|
||||
labelParts.push(
|
||||
`L${fileLinkMeta.line}${fileLinkMeta.column ? `:C${fileLinkMeta.column}` : ""}`,
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<MarkdownFileLink
|
||||
href={fileLinkMeta.targetPath}
|
||||
targetPath={fileLinkMeta.targetPath}
|
||||
iconPath={fileLinkMeta.filePath}
|
||||
displayPath={fileLinkMeta.displayPath}
|
||||
workspaceRelativePath={fileLinkMeta.workspaceRelativePath}
|
||||
line={fileLinkMeta.line}
|
||||
label={labelParts.join(" · ")}
|
||||
copyMarkdown={copyMarkdown}
|
||||
theme={resolvedTheme}
|
||||
threadRef={threadRef}
|
||||
onOpen={openInPreferredEditor}
|
||||
onOpenInBrowser={
|
||||
threadRef &&
|
||||
isPreviewSupportedInRuntime() &&
|
||||
isBrowserPreviewFile(fileLinkMeta.filePath)
|
||||
? () => openMarkdownFileInPreview(fileLinkMeta.filePath)
|
||||
: undefined
|
||||
}
|
||||
className={className}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
return {
|
||||
p({ node: _node, children, ...props }) {
|
||||
return <p {...props}>{renderSkillInlineMarkdownChildren(children, skills)}</p>;
|
||||
},
|
||||
blockquote({ node: _node, children, ...props }) {
|
||||
const alert =
|
||||
GITHUB_ALERT_PRESENTATIONS[
|
||||
String((props as Record<string, unknown>)["data-alert"] ?? "")
|
||||
];
|
||||
if (!alert) {
|
||||
return <blockquote {...props}>{children}</blockquote>;
|
||||
}
|
||||
// Not a <blockquote>: the stylesheet mutes those, and an alert's body is ordinary
|
||||
// text under a colored title — which is how the host renders it.
|
||||
return (
|
||||
<div role="note" className={cn("my-1 border-l-2 pl-3", alert.borderClassName)}>
|
||||
<p className={cn("flex items-center gap-1.5 font-medium", alert.titleClassName)}>
|
||||
<alert.Icon aria-hidden className="size-3.5 shrink-0" />
|
||||
{alert.label}
|
||||
</p>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
li({ node, children, ...props }) {
|
||||
const listItemStart = node?.position?.start.offset;
|
||||
const markerOffset =
|
||||
typeof listItemStart === "number" ? findTaskListMarkerOffset(text, listItemStart) : null;
|
||||
return (
|
||||
<li {...props} data-task-marker-offset={markerOffset ?? undefined}>
|
||||
{renderSkillInlineMarkdownChildren(children, skills)}
|
||||
</li>
|
||||
);
|
||||
},
|
||||
input({ node: _node, type, checked, disabled: _disabled, ...props }) {
|
||||
if (type !== "checkbox" || !onTaskListChange) {
|
||||
return (
|
||||
<input
|
||||
{...props}
|
||||
type={type}
|
||||
checked={checked}
|
||||
disabled={_disabled}
|
||||
readOnly={type === "checkbox"}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<input
|
||||
{...props}
|
||||
type="checkbox"
|
||||
name="markdown-task"
|
||||
aria-label="Toggle task"
|
||||
checked={checked}
|
||||
onChange={(event) => {
|
||||
const markerOffset = Number(
|
||||
event.currentTarget.closest("li")?.dataset.taskMarkerOffset,
|
||||
);
|
||||
if (!Number.isSafeInteger(markerOffset)) return;
|
||||
onTaskListChange({ markerOffset, checked: event.currentTarget.checked });
|
||||
}}
|
||||
/>
|
||||
);
|
||||
},
|
||||
a({ node, href, children, ...props }) {
|
||||
const normalizedHref = href ? normalizeMarkdownLinkHrefKey(href) : "";
|
||||
const fileLinkMeta = normalizedHref ? markdownFileLinkMetaByHref.get(normalizedHref) : null;
|
||||
if (!fileLinkMeta) {
|
||||
const faviconHost = resolveExternalWebLinkHost(href);
|
||||
const isSameDocumentLink = href?.startsWith("#") ?? false;
|
||||
const onClick = props.onClick;
|
||||
const canOpenInPreview = Boolean(threadRef) && isPreviewSupportedInRuntime();
|
||||
const link = (
|
||||
<a
|
||||
{...props}
|
||||
href={href}
|
||||
target={isSameDocumentLink ? undefined : "_blank"}
|
||||
rel={isSameDocumentLink ? undefined : "noopener noreferrer"}
|
||||
onClick={(event) => {
|
||||
onClick?.(event);
|
||||
if (isSameDocumentLink && href) {
|
||||
handleMarkdownFragmentClick(event, href);
|
||||
return;
|
||||
}
|
||||
// A link to a change request in a workspace project opens beside the
|
||||
// conversation instead of in a browser: it is the thing being talked about, and
|
||||
// the panel it opens offers the browser as one of its actions. Anything else is
|
||||
// an ordinary link and keeps the `_blank` the shell already handles.
|
||||
if (href) openChangeRequestLink(event, href);
|
||||
}}
|
||||
onContextMenu={(event) => {
|
||||
if (!href || !faviconHost) return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const api = readLocalApi();
|
||||
if (!api) return;
|
||||
void showExternalLinkContextMenu({
|
||||
href,
|
||||
canOpenInPreview,
|
||||
position: { x: event.clientX, y: event.clientY },
|
||||
showContextMenu: (items, position) => api.contextMenu.show(items, position),
|
||||
openInPreview: async (target) => {
|
||||
const result = await openExternalLinkInPreview(target);
|
||||
if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
|
||||
reportMarkdownActionFailure(
|
||||
{ operation: "open-link-in-preview", target },
|
||||
result.cause,
|
||||
);
|
||||
}
|
||||
},
|
||||
openExternal: (target) => api.shell.openExternal(target),
|
||||
copyLink: (target) => writeTextToClipboard(target, "link"),
|
||||
reportFailure: (operation, cause) => {
|
||||
reportMarkdownActionFailure({ operation, target: href }, cause);
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
{faviconHost && hastHasText(node) ? (
|
||||
<MarkdownExternalLinkContent host={faviconHost} plainText={plainHastText(node)}>
|
||||
{children}
|
||||
</MarkdownExternalLinkContent>
|
||||
) : (
|
||||
children
|
||||
)}
|
||||
</a>
|
||||
);
|
||||
if (!faviconHost || !href) {
|
||||
return link;
|
||||
}
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger render={link} />
|
||||
<TooltipPopup
|
||||
side="top"
|
||||
className="max-w-[min(36rem,calc(100vw-2rem))] whitespace-normal leading-tight wrap-anywhere"
|
||||
>
|
||||
{href}
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
return fileLinkChip(
|
||||
fileLinkMeta,
|
||||
`[${fileLinkMeta.basename}](${normalizedHref})`,
|
||||
props.className,
|
||||
);
|
||||
},
|
||||
code({ node, children, className, ...props }) {
|
||||
if (node?.properties?.dataInlineCode != null) {
|
||||
const codeText = nodeToPlainText(children);
|
||||
const fileLinkMeta =
|
||||
inlineCodeFileLinkMetaByText.get(codeText.trim()) ??
|
||||
resolveInlineCodeFileLinkMeta(codeText, cwd);
|
||||
if (fileLinkMeta) {
|
||||
return fileLinkChip(fileLinkMeta, `\`${codeText}\``);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<code {...props} className={className}>
|
||||
{children}
|
||||
</code>
|
||||
);
|
||||
},
|
||||
table({ node: _node, ...props }) {
|
||||
return <MarkdownTable {...props} />;
|
||||
},
|
||||
details({ node: _node, children, open: detailsOpen }) {
|
||||
return <MarkdownDetails open={detailsOpen}>{children}</MarkdownDetails>;
|
||||
},
|
||||
pre({ node, children, ...props }) {
|
||||
const codeBlock = extractCodeBlock(children);
|
||||
if (!codeBlock) {
|
||||
return <pre {...props}>{children}</pre>;
|
||||
}
|
||||
|
||||
const language = extractFenceLanguage(codeBlock.className);
|
||||
const fenceTitle = extractFenceTitle(extractPreCodeMeta(node));
|
||||
return (
|
||||
<MarkdownCodeBlock
|
||||
code={codeBlock.code}
|
||||
language={language}
|
||||
fenceTitle={fenceTitle}
|
||||
theme={resolvedTheme}
|
||||
>
|
||||
<RenderErrorBoundary fallback={<pre {...props}>{children}</pre>}>
|
||||
<Suspense fallback={<pre {...props}>{children}</pre>}>
|
||||
<SuspenseShikiCodeBlock
|
||||
className={codeBlock.className}
|
||||
code={codeBlock.code}
|
||||
themeName={diffThemeName}
|
||||
isStreaming={isStreaming}
|
||||
/>
|
||||
</Suspense>
|
||||
</RenderErrorBoundary>
|
||||
</MarkdownCodeBlock>
|
||||
);
|
||||
},
|
||||
};
|
||||
}, [
|
||||
cwd,
|
||||
diffThemeName,
|
||||
fileLinkParentSuffixByPath,
|
||||
inlineCodeFileLinkMetaByText,
|
||||
isStreaming,
|
||||
markdownFileLinkMetaByHref,
|
||||
onTaskListChange,
|
||||
openInPreferredEditor,
|
||||
openExternalLinkInPreview,
|
||||
openMarkdownFileInPreview,
|
||||
resolvedTheme,
|
||||
skills,
|
||||
text,
|
||||
threadRef,
|
||||
]);
|
||||
/* eslint-enable react/no-unstable-nested-components */
|
||||
const markdownComponents = useMemo<Components>(
|
||||
() =>
|
||||
createChatMarkdownComponents({
|
||||
cwd,
|
||||
diffThemeName,
|
||||
fileLinkParentSuffixByPath,
|
||||
inlineCodeFileLinkMetaByText,
|
||||
isStreaming,
|
||||
markdownFileLinkMetaByHref,
|
||||
onTaskListChange,
|
||||
openInPreferredEditor,
|
||||
openExternalLinkInPreview,
|
||||
openMarkdownFileInPreview,
|
||||
resolvedTheme,
|
||||
skills,
|
||||
text,
|
||||
threadRef,
|
||||
}),
|
||||
[
|
||||
cwd,
|
||||
diffThemeName,
|
||||
fileLinkParentSuffixByPath,
|
||||
inlineCodeFileLinkMetaByText,
|
||||
isStreaming,
|
||||
markdownFileLinkMetaByHref,
|
||||
onTaskListChange,
|
||||
openInPreferredEditor,
|
||||
openExternalLinkInPreview,
|
||||
openMarkdownFileInPreview,
|
||||
resolvedTheme,
|
||||
skills,
|
||||
text,
|
||||
threadRef,
|
||||
],
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -2102,8 +2102,6 @@ function ChatViewContent(props: ChatViewProps) {
|
||||
dismissVersionMismatch(versionMismatchDismissKey);
|
||||
setDismissedVersionMismatchKey(versionMismatchDismissKey);
|
||||
}, [setDismissedVersionMismatchKey, versionMismatchDismissKey]);
|
||||
const versionMismatchEnvironmentId =
|
||||
versionMismatch && activeThread ? activeThread.environmentId : null;
|
||||
const serverUpdateEnvironmentId = activeThread?.environmentId ?? null;
|
||||
const versionMismatchSelfUpdate = resolveServerSelfUpdateCapability(serverConfig);
|
||||
const serverUpdateState = useAtomValue(
|
||||
|
||||
@@ -96,6 +96,7 @@ import {
|
||||
resolveProjectPickerTarget,
|
||||
resolveWslProjectSelection,
|
||||
} from "../wslPaths";
|
||||
import { type Project } from "../types";
|
||||
import {
|
||||
ADDON_ICON_CLASS,
|
||||
buildBrowseGroups,
|
||||
@@ -150,17 +151,6 @@ import type { Project } from "../types";
|
||||
|
||||
const EMPTY_BROWSE_ENTRIES: FilesystemBrowseResult["entries"] = [];
|
||||
|
||||
function projectFavicon(project: Project) {
|
||||
return (
|
||||
<ProjectFavicon
|
||||
environmentId={project.environmentId}
|
||||
cwd={project.workspaceRoot}
|
||||
faviconPath={project.faviconPath}
|
||||
className={ITEM_ICON_CLASS}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function getLocalFileManagerName(platform: string): string {
|
||||
if (isMacPlatform(platform)) {
|
||||
return "Finder";
|
||||
@@ -278,6 +268,16 @@ function remoteProjectSourceIcon(source: AddProjectRemoteSource, className: stri
|
||||
}
|
||||
}
|
||||
|
||||
function projectFaviconIcon(project: Project): ReactNode {
|
||||
return (
|
||||
<ProjectFavicon
|
||||
environmentId={project.environmentId}
|
||||
cwd={project.workspaceRoot}
|
||||
className={ITEM_ICON_CLASS}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function remoteProjectInputPlaceholder(flow: AddProjectCloneFlow | null): string | null {
|
||||
if (!flow) return null;
|
||||
if (flow.step === "confirm") return null;
|
||||
@@ -972,7 +972,7 @@ function OpenCommandPaletteDialog(props: {
|
||||
group?.memberProjects.flatMap((member) => [member.title, member.workspaceRoot]) ?? []
|
||||
);
|
||||
},
|
||||
icon: projectFavicon,
|
||||
icon: projectFaviconIcon,
|
||||
runProject: openProjectFromSearch,
|
||||
}),
|
||||
[openProjectFromSearch, pickerProjects, projectGroupByTargetKey],
|
||||
@@ -990,7 +990,7 @@ function OpenCommandPaletteDialog(props: {
|
||||
group?.memberProjects.flatMap((member) => [member.title, member.workspaceRoot]) ?? []
|
||||
);
|
||||
},
|
||||
icon: projectFavicon,
|
||||
icon: projectFaviconIcon,
|
||||
runProject: async (project) => {
|
||||
const group = projectGroupByTargetKey.get(`${project.environmentId}:${project.id}`);
|
||||
const contextualRefBelongsToGroup =
|
||||
|
||||
Reference in new issue
Block a user