This commit is contained in:
Julius Marminge committed 2026-02-17 17:57:37 -08:00
1 parent 0371dc90b9
commit b73b2c9c01
2 files changed
+9 -11

No files matched your search

+1 -7
View File
@@ -60,7 +60,7 @@ import {
import { isScrollContainerNearBottom } from "../chat-scroll";
import { useStore } from "../store";
import { MAX_THREAD_TERMINAL_COUNT, type ChatImageAttachment } from "../types";
import { getVscodeIconUrlForEntry } from "../vscode-icons";
import { basenameOfPath, getVscodeIconUrlForEntry } from "../vscode-icons";
import { useTheme } from "../hooks/useTheme";
import BranchToolbar from "./BranchToolbar";
import GitActionsControl from "./GitActionsControl";
@@ -125,12 +125,6 @@ function workToneClass(tone: "thinking" | "tool" | "info" | "error"): string {
return "text-muted-foreground/40";
}
function basenameOfPath(pathValue: string): string {
const slashIndex = pathValue.lastIndexOf("/");
if (slashIndex === -1) return pathValue;
return pathValue.slice(slashIndex + 1);
}
type SessionContinuityState = "resumed" | "new" | "fallback_new";
interface EnsuredSessionInfo {
+8 -4
View File
@@ -66,7 +66,7 @@ function toLowercaseLookup(source: Record<string, string>): Record<string, strin
return lookup;
}
function basenameOfPath(pathValue: string): string {
export function basenameOfPath(pathValue: string): string {
const slashIndex = pathValue.lastIndexOf("/");
if (slashIndex === -1) return pathValue;
return pathValue.slice(slashIndex + 1);
@@ -88,7 +88,10 @@ function extensionCandidates(fileName: string): string[] {
return [...candidates];
}
function resolveLanguageFallbackDefinition(pathValue: string, theme: "light" | "dark"): string | null {
function resolveLanguageFallbackDefinition(
pathValue: string,
theme: "light" | "dark",
): string | null {
const basename = basenameOfPath(pathValue).toLowerCase();
const languageIds = theme === "light" ? lightLanguageIds : darkLanguageIds;
@@ -99,8 +102,9 @@ function resolveLanguageFallbackDefinition(pathValue: string, theme: "light" | "
for (const candidate of extensionCandidates(basename)) {
const languageId =
localLanguageIdByExtensionOverrides[candidate as keyof typeof localLanguageIdByExtensionOverrides] ??
languageIdByExtension[candidate];
localLanguageIdByExtensionOverrides[
candidate as keyof typeof localLanguageIdByExtensionOverrides
] ?? languageIdByExtension[candidate];
if (!languageId) continue;
return languageIds[languageId] ?? darkLanguageIds[languageId] ?? null;
}