From f8474fc2a2585d0d74adf42526557b6eef62dd0b Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Thu, 19 Nov 2026 17:56:15 +0800 Subject: [PATCH] feat(project-view): option to turn off horizontal scrolling (#4478) The Project view's options menu gets Horizontal Scrolling under Appearance (on by default, as before). Turned off, long rows are clipped with an ellipsis instead of the whole tree scrolling sideways and cutting names on the left. --- src/features/project-tree/HeaderActions.tsx | 3 ++- src/features/project-tree/ProjectView.tsx | 2 +- src/features/project-tree/store.ts | 3 +++ src/platform/locales/text/en.json | 3 ++- src/platform/locales/text/zh.json | 3 ++- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/features/project-tree/HeaderActions.tsx b/src/features/project-tree/HeaderActions.tsx index 81016a403..2947f0f0b 100644 --- a/src/features/project-tree/HeaderActions.tsx +++ b/src/features/project-tree/HeaderActions.tsx @@ -44,6 +44,7 @@ export const OPTION_LABELS: Array<[ToggleOption, string]> = [ ["showExcluded", "Show Excluded Files"], ["showMembers", "Show Members"], ["showRootPaths", "Show Root Paths"], + ["horizontalScroll", "Horizontal Scrolling"], ["compact", "Compact Middle Packages"], ["foldersFirst", "Sort Folders First"], ["autoscrollFromSource", "Always Select Opened File"], @@ -54,7 +55,7 @@ export const OPTION_LABELS: Array<[ToggleOption, string]> = [ ]; /** The first entries of OPTION_LABELS are Appearance options, the rest Behavior. */ -const APPEARANCE_OPTIONS = 6; +const APPEARANCE_OPTIONS = 7; /** Header controls of the Project tool window (IDEA: Locate, Expand/Collapse All). */ export function ProjectHeaderActions() { diff --git a/src/features/project-tree/ProjectView.tsx b/src/features/project-tree/ProjectView.tsx index fc20423de..ea1279aa6 100644 --- a/src/features/project-tree/ProjectView.tsx +++ b/src/features/project-tree/ProjectView.tsx @@ -907,7 +907,7 @@ export function ProjectView() { )} - horizontalScroll + horizontalScroll={options.horizontalScroll} aria-label="Project" focusContext="projectViewFocus" handleRef={setTreeHandle} diff --git a/src/features/project-tree/store.ts b/src/features/project-tree/store.ts index 536ada510..d630c1e53 100644 --- a/src/features/project-tree/store.ts +++ b/src/features/project-tree/store.ts @@ -63,6 +63,8 @@ export interface ViewOptions extends TreeOptions { showMembers: boolean; /** Show the location of each project root beside its name. */ showRootPaths: boolean; + /** Rows wider than the pane scroll sideways; off clips long names (VS Code's horizontal scrolling). */ + horizontalScroll: boolean; } export const DEFAULT_VIEW_OPTIONS: ViewOptions = { @@ -75,6 +77,7 @@ export const DEFAULT_VIEW_OPTIONS: ViewOptions = { previewTab: false, showMembers: false, showRootPaths: true, + horizontalScroll: true, }; function storedOptions(): ViewOptions { diff --git a/src/platform/locales/text/en.json b/src/platform/locales/text/en.json index c2add3915..f2e1a0a7c 100644 --- a/src/platform/locales/text/en.json +++ b/src/platform/locales/text/en.json @@ -2634,5 +2634,6 @@ "No branches were updated": "No branches were updated", "Selected branches are up-to-date": "Selected branches are up-to-date", "Use application title as tab name": "Use application title as tab name", - "When command is running": "When command is running" + "When command is running": "When command is running", + "Horizontal Scrolling": "Horizontal Scrolling" } diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json index c61fd5db8..c53d49101 100644 --- a/src/platform/locales/text/zh.json +++ b/src/platform/locales/text/zh.json @@ -9013,5 +9013,6 @@ "No branches were updated": "没有分支被更新", "Selected branches are up-to-date": "所选分支都是最新的", "Use application title as tab name": "使用应用标题作为标签页名称", - "When command is running": "命令运行时" + "When command is running": "命令运行时", + "Horizontal Scrolling": "横向滚动" }