Skip to content

Commit c53cbc9

Browse files
committed
feat: pin files support in working files
1 parent d13b448 commit c53cbc9

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

src/project/WorkingSetView.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,14 @@ define(function (require, exports, module) {
12441244
$newItem.addClass(provider(data));
12451245
});
12461246

1247+
// if the file is pinned, add the pin icon in the list item
1248+
const isPinned = MainViewManager.isPathPinned(this.paneId, file.fullPath);
1249+
if (isPinned) {
1250+
$newItem.addClass("pinned");
1251+
const $pinIcon = $("<div class='pin-icon'><i class='fa-solid fa-thumbtack'></i></div>");
1252+
$newItem.append($pinIcon);
1253+
}
1254+
12471255
// Update the listItem's apperance
12481256
this._updateFileStatusIcon($newItem, _isOpenAndDirty(file), false);
12491257
_updateListItemSelection($newItem, selectedFile);
@@ -1421,6 +1429,15 @@ define(function (require, exports, module) {
14211429
}
14221430
};
14231431

1432+
/**
1433+
* working set pin change (unpinned/pinned) event handler
1434+
*/
1435+
WorkingSetView.prototype._handleWorkingSetPinChange = function (e, file, paneId) {
1436+
if (paneId === this.paneId) {
1437+
this._rebuildViewList(true);
1438+
}
1439+
};
1440+
14241441
/**
14251442
* dirtyFlagChange event handler
14261443
* @private
@@ -1469,6 +1486,8 @@ define(function (require, exports, module) {
14691486
MainViewManager.on(this._makeEventName("activePaneChange"), _.bind(this._handleActivePaneChange, this));
14701487
MainViewManager.on(this._makeEventName("paneLayoutChange"), _.bind(this._handlePaneLayoutChange, this));
14711488
MainViewManager.on(this._makeEventName("workingSetUpdate"), _.bind(this._handleWorkingSetUpdate, this));
1489+
MainViewManager.on(this._makeEventName("workingSetPinned"), _.bind(this._handleWorkingSetPinChange, this));
1490+
MainViewManager.on(this._makeEventName("workingSetUnpinned"), _.bind(this._handleWorkingSetPinChange, this));
14721491

14731492
DocumentManager.on(this._makeEventName("dirtyFlagChange"), _.bind(this._handleDirtyFlagChanged, this));
14741493

src/styles/brackets.less

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,20 @@ a, img {
14421442
.extension, .directory {
14431443
color: @project-panel-text-2;
14441444
}
1445+
1446+
li.pinned .pin-icon {
1447+
position: absolute;
1448+
right: 4px;
1449+
top: 50%;
1450+
transform: translateY(-50%);
1451+
font-size: 10px;
1452+
color: @project-panel-text-2;
1453+
opacity: 0.7;
1454+
1455+
&:hover {
1456+
opacity: 1;
1457+
}
1458+
}
14451459
}
14461460

14471461

0 commit comments

Comments
 (0)