Skip to content

Commit 3a9f374

Browse files
committed
Rename IdSelection to FileSelection
Rename the selection service and types from Id/ID_SELECTION to FileSelectionManager/FILE_SELECTION_MANAGER across the desktop app. Update imports, dependency injection keys, bootstrap registration, and all type annotations and usage sites (FileList, FileListItemWrapper, idSelectionUtils, drop handler and deps). This clarifies the purpose of the selection component (managing file selection) and brings naming consistency between the service and its injection token. Rename idSelection to fileSelectionManager and update imports Rename the selection module file idSelection.svelte.ts to fileSelectionManager.svelte.ts and update all TypeScript import paths to reference the new filename. This ensures consistency with the module's exported types and identifiers (FileSelectionManager, FILE_SELECTION_MANAGER) and prevents broken imports across multiple components and services.
1 parent d874016 commit 3a9f374

18 files changed

+46
-40
lines changed

apps/desktop/src/components/ChangedFiles.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import FileListMode from '$components/FileListMode.svelte';
55
import Resizer from '$components/Resizer.svelte';
66
import emptyFolderSvg from '$lib/assets/empty-state/empty-folder.svg?raw';
7-
import { ID_SELECTION } from '$lib/selection/idSelection.svelte';
7+
import { FILE_SELECTION_MANAGER } from '$lib/selection/fileSelectionManager.svelte';
88
import { inject } from '@gitbutler/core/context';
99
import { Badge, EmptyStatePlaceholder, LineStats } from '@gitbutler/ui';
1010
@@ -49,7 +49,7 @@
4949
ontoggle
5050
}: Props = $props();
5151
52-
const idSelection = inject(ID_SELECTION);
52+
const idSelection = inject(FILE_SELECTION_MANAGER);
5353
5454
let listMode: 'list' | 'tree' = $state('tree');
5555

apps/desktop/src/components/FileContextMenu.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import { isTreeChange, type TreeChange } from '$lib/hunks/change';
1212
import { vscodePath } from '$lib/project/project';
1313
import { PROJECTS_SERVICE } from '$lib/project/projectsService';
14-
import { ID_SELECTION } from '$lib/selection/idSelection.svelte';
14+
import { FILE_SELECTION_MANAGER } from '$lib/selection/fileSelectionManager.svelte';
1515
import { SETTINGS } from '$lib/settings/userSettings';
1616
import { STACK_SERVICE } from '$lib/stacks/stackService.svelte';
1717
import { UI_STATE } from '$lib/state/uiState.svelte';
@@ -60,7 +60,7 @@
6060
const { trigger, selectionId, stackId, projectId, editMode = false }: Props = $props();
6161
const stackService = inject(STACK_SERVICE);
6262
const uiState = inject(UI_STATE);
63-
const idSelection = inject(ID_SELECTION);
63+
const idSelection = inject(FILE_SELECTION_MANAGER);
6464
const aiService = inject(AI_SERVICE);
6565
const actionService = inject(ACTION_SERVICE);
6666
const fileService = inject(FILE_SERVICE);

apps/desktop/src/components/FileList.svelte

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
import { type TreeChange, type Modification } from '$lib/hunks/change';
1414
import { MODE_SERVICE } from '$lib/mode/modeService';
1515
import { showToast } from '$lib/notifications/toasts';
16-
import { ID_SELECTION } from '$lib/selection/idSelection.svelte';
17-
import { selectFilesInList, updateSelection } from '$lib/selection/idSelectionUtils';
16+
import { FILE_SELECTION_MANAGER } from '$lib/selection/fileSelectionManager.svelte';
17+
import { selectFilesInList, updateSelection } from '$lib/selection/fileSelectionUtils';
1818
import { type SelectionId } from '$lib/selection/key';
1919
import { chunk } from '$lib/utils/array';
2020
import { inject, injectOptional } from '@gitbutler/core/context';
@@ -52,8 +52,8 @@
5252
onselect
5353
}: Props = $props();
5454
55-
const idSelection = inject(ID_SELECTION);
5655
const focusManager = inject(FOCUS_MANAGER);
56+
const idSelection = inject(FILE_SELECTION_MANAGER);
5757
const aiService = inject(AI_SERVICE);
5858
const actionService = inject(ACTION_SERVICE);
5959
const modeService = injectOptional(MODE_SERVICE, undefined);
@@ -212,6 +212,7 @@
212212
});
213213
return true;
214214
}
215+
return false;
215216
}
216217
const lastAdded = $derived(idSelection.getById(selectionId).lastAdded);
217218
$effect(() => {

apps/desktop/src/components/FileListItemWrapper.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { DROPZONE_REGISTRY } from '$lib/dragging/registry';
99
import { getFilename } from '$lib/files/utils';
1010
import { type TreeChange } from '$lib/hunks/change';
11-
import { ID_SELECTION } from '$lib/selection/idSelection.svelte';
11+
import { FILE_SELECTION_MANAGER } from '$lib/selection/fileSelectionManager.svelte';
1212
import { key, type SelectionId } from '$lib/selection/key';
1313
import { UNCOMMITTED_SERVICE } from '$lib/selection/uncommittedService.svelte';
1414
import { computeChangeStatus } from '$lib/utils/fileStatus';
@@ -71,7 +71,7 @@
7171
scrollContainer
7272
}: Props = $props();
7373
74-
const idSelection = inject(ID_SELECTION);
74+
const idSelection = inject(FILE_SELECTION_MANAGER);
7575
const uncommittedService = inject(UNCOMMITTED_SERVICE);
7676
const dropzoneRegistry = inject(DROPZONE_REGISTRY);
7777
const dragStateService = inject(DRAG_STATE_SERVICE);

apps/desktop/src/components/NewCommitView.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { projectRunCommitHooks } from '$lib/config/config';
44
import { HOOKS_SERVICE } from '$lib/hooks/hooksService';
55
import { showError, showToast } from '$lib/notifications/toasts';
6-
import { ID_SELECTION } from '$lib/selection/idSelection.svelte';
6+
import { FILE_SELECTION_MANAGER } from '$lib/selection/fileSelectionManager.svelte';
77
import { createWorktreeSelection } from '$lib/selection/key';
88
import { UNCOMMITTED_SERVICE } from '$lib/selection/uncommittedService.svelte';
99
import { COMMIT_ANALYTICS } from '$lib/soup/commitAnalytics';
@@ -25,7 +25,7 @@
2525
const hooksService = inject(HOOKS_SERVICE);
2626
const uncommittedService = inject(UNCOMMITTED_SERVICE);
2727
const commitAnalytics = inject(COMMIT_ANALYTICS);
28-
const idSelection = inject(ID_SELECTION);
28+
const idSelection = inject(FILE_SELECTION_MANAGER);
2929
3030
const projectState = $derived(uiState.project(projectId));
3131
// Using a dummy stackId kind of sucks... but it's fine for now

apps/desktop/src/components/SelectionView.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import ReduxResult from '$components/ReduxResult.svelte';
55
import UnifiedDiffView from '$components/UnifiedDiffView.svelte';
66
import { DIFF_SERVICE } from '$lib/hunks/diffService.svelte';
7-
import { ID_SELECTION } from '$lib/selection/idSelection.svelte';
7+
import { FILE_SELECTION_MANAGER } from '$lib/selection/fileSelectionManager.svelte';
88
import { readKey, type SelectionId } from '$lib/selection/key';
99
import { inject } from '@gitbutler/core/context';
1010
@@ -30,7 +30,7 @@
3030
bottomBorder
3131
}: Props = $props();
3232
33-
const idSelection = inject(ID_SELECTION);
33+
const idSelection = inject(FILE_SELECTION_MANAGER);
3434
const diffService = inject(DIFF_SERVICE);
3535
3636
const selection = $derived(selectionId ? idSelection.valuesReactive(selectionId) : undefined);

apps/desktop/src/components/StackView.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import { stagingBehaviorFeature } from '$lib/config/uiFeatureFlags';
1414
import { isParsedError } from '$lib/error/parser';
1515
import { DIFF_SERVICE } from '$lib/hunks/diffService.svelte';
16-
import { ID_SELECTION } from '$lib/selection/idSelection.svelte';
16+
import { FILE_SELECTION_MANAGER } from '$lib/selection/fileSelectionManager.svelte';
1717
import {
1818
createBranchSelection,
1919
createCommitSelection,
@@ -62,7 +62,7 @@
6262
const diffService = inject(DIFF_SERVICE);
6363
const uncommittedService = inject(UNCOMMITTED_SERVICE);
6464
const uiState = inject(UI_STATE);
65-
const idSelection = inject(ID_SELECTION);
65+
const idSelection = inject(FILE_SELECTION_MANAGER);
6666
6767
// Component is read-only when stackId is undefined
6868
const isReadOnly = $derived(!stackId);

apps/desktop/src/components/UnassignedView.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import noChanges from '$lib/assets/illustrations/no-changes.svg?raw';
77
import { SETTINGS_SERVICE } from '$lib/config/appSettingsV2';
88
import { stagingBehaviorFeature } from '$lib/config/uiFeatureFlags';
9-
import { ID_SELECTION } from '$lib/selection/idSelection.svelte';
9+
import { FILE_SELECTION_MANAGER } from '$lib/selection/fileSelectionManager.svelte';
1010
import { createWorktreeSelection } from '$lib/selection/key';
1111
import { UNCOMMITTED_SERVICE } from '$lib/selection/uncommittedService.svelte';
1212
import { UI_STATE } from '$lib/state/uiState.svelte';
@@ -24,7 +24,7 @@
2424
2525
const uiState = inject(UI_STATE);
2626
const uncommittedService = inject(UNCOMMITTED_SERVICE);
27-
const idSelection = inject(ID_SELECTION);
27+
const idSelection = inject(FILE_SELECTION_MANAGER);
2828
const settingsService = inject(SETTINGS_SERVICE);
2929
const settingsStore = $derived(settingsService.appSettings);
3030
const projectState = $derived(uiState.project(projectId));

apps/desktop/src/components/WorkspaceView.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import UnassignedView from '$components/UnassignedView.svelte';
99
import { BASE_BRANCH_SERVICE } from '$lib/baseBranch/baseBranchService.svelte';
1010
import { SETTINGS_SERVICE } from '$lib/config/appSettingsV2';
11-
import { ID_SELECTION } from '$lib/selection/idSelection.svelte';
11+
import { FILE_SELECTION_MANAGER } from '$lib/selection/fileSelectionManager.svelte';
1212
import { createWorktreeSelection } from '$lib/selection/key';
1313
import { STACK_SERVICE } from '$lib/stacks/stackService.svelte';
1414
import { UI_STATE, type ExclusiveAction } from '$lib/state/uiState.svelte';
@@ -25,7 +25,7 @@
2525
2626
const stackService = inject(STACK_SERVICE);
2727
const uiState = inject(UI_STATE);
28-
const idSelection = inject(ID_SELECTION);
28+
const idSelection = inject(FILE_SELECTION_MANAGER);
2929
const settingsService = inject(SETTINGS_SERVICE);
3030
const baseBranchService = inject(BASE_BRANCH_SERVICE);
3131

apps/desktop/src/components/WorktreeChanges.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { UncommitDzHandler } from '$lib/commits/dropHandler';
99
import { DIFF_SERVICE } from '$lib/hunks/diffService.svelte';
1010
import { AssignmentDropHandler } from '$lib/hunks/dropHandler';
11-
import { ID_SELECTION } from '$lib/selection/idSelection.svelte';
11+
import { FILE_SELECTION_MANAGER } from '$lib/selection/fileSelectionManager.svelte';
1212
import { createWorktreeSelection } from '$lib/selection/key';
1313
import { UNCOMMITTED_SERVICE } from '$lib/selection/uncommittedService.svelte';
1414
import { STACK_SERVICE } from '$lib/stacks/stackService.svelte';
@@ -53,7 +53,7 @@
5353
const diffService = inject(DIFF_SERVICE);
5454
const uncommittedService = inject(UNCOMMITTED_SERVICE);
5555
const uiState = inject(UI_STATE);
56-
const idSelection = inject(ID_SELECTION);
56+
const idSelection = inject(FILE_SELECTION_MANAGER);
5757
5858
// Create selectionId for this worktree lane
5959
const selectionId = $derived(createWorktreeSelection({ stackId }));

0 commit comments

Comments
 (0)