Skip to content

Commit da72a5b

Browse files
committed
feat: pin a regular file if dropped before a pinned file in working set
1 parent 1c30d28 commit da72a5b

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/project/WorkingSetView.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,22 @@ define(function (require, exports, module) {
809809
}
810810
}
811811

812+
// Check if the dragged file is not pinned - if moved before a pinned file, pin it
813+
if (!isPinned) {
814+
const workingSet = MainViewManager.getWorkingSet(sourceView.paneId);
815+
816+
// check if there's a file after this one
817+
if (newIndex < workingSet.length - 1) {
818+
const nextFilePath = workingSet[newIndex + 1].fullPath;
819+
820+
// if the next file is pinned, pin this file too
821+
if (MainViewManager.isPathPinned(sourceView.paneId, nextFilePath)) {
822+
CommandManager.get(Commands.FILE_PIN).setEnabled(true);
823+
CommandManager.execute(Commands.FILE_PIN, { file: sourceFile, paneId: sourceView.paneId });
824+
}
825+
}
826+
}
827+
812828
postDropCleanup();
813829
} else {
814830
// If the same doc view is present in the destination pane prevent drop

0 commit comments

Comments
 (0)