Skip to content

Commit 2bf6abc

Browse files
devvaannshabose
authored andcommitted
feat: add preferences to toggle the working set visibility
1 parent a8729b4 commit 2bf6abc

File tree

3 files changed

+35
-9
lines changed

3 files changed

+35
-9
lines changed

src/nls/root/strings.js

+3
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,9 @@ define({
12781278
// Emmet
12791279
"DESCRIPTION_EMMET": "true to enable Emmet, else false.",
12801280

1281+
// Hide/Show working set (that is displayed in the sidebar)
1282+
"DESCRIPTION_HIDE_WORKING_SET": "true to hide the working set, false to display it.",
1283+
12811284
// Tabbar
12821285
"DESCRIPTION_TABBAR": "Set the tab bar settings.",
12831286
"DESCRIPTION_SHOW_TABBAR": "true to show the tab bar, else false.",

src/project/SidebarView.js

+27-9
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,16 @@
3838
define(function (require, exports, module) {
3939

4040

41-
var AppInit = require("utils/AppInit"),
42-
ProjectManager = require("project/ProjectManager"),
43-
WorkingSetView = require("project/WorkingSetView"),
44-
MainViewManager = require("view/MainViewManager"),
45-
CommandManager = require("command/CommandManager"),
46-
Commands = require("command/Commands"),
47-
Strings = require("strings"),
48-
Resizer = require("utils/Resizer"),
49-
_ = require("thirdparty/lodash");
41+
var AppInit = require("utils/AppInit"),
42+
ProjectManager = require("project/ProjectManager"),
43+
PreferencesManager = require("preferences/PreferencesManager"),
44+
WorkingSetView = require("project/WorkingSetView"),
45+
MainViewManager = require("view/MainViewManager"),
46+
CommandManager = require("command/CommandManager"),
47+
Commands = require("command/Commands"),
48+
Strings = require("strings"),
49+
Resizer = require("utils/Resizer"),
50+
_ = require("thirdparty/lodash");
5051

5152
// These vars are initialized by the htmlReady handler
5253
// below since they refer to DOM elements
@@ -244,6 +245,23 @@ define(function (require, exports, module) {
244245

245246
// Tooltips
246247
$splitViewMenu.attr("title", Strings.GEAR_MENU_TOOLTIP);
248+
249+
// Define the preference to decide whether to hide the working set or not
250+
PreferencesManager.definePreference("hideWorkingSet", "boolean", false, {
251+
description: Strings.DESCRIPTION_HIDE_WORKING_SET
252+
})
253+
.on("change", function () {
254+
// 'working-set-list-container' is the id of the main working set element which we need to hide/show
255+
const $workingSet = $(document.getElementById("working-set-list-container"));
256+
const getPref = PreferencesManager.get("hideWorkingSet");
257+
258+
if(getPref) {
259+
// refer to brackets.less file for styles
260+
$workingSet.addClass("working-set-hidden");
261+
} else {
262+
$workingSet.removeClass("working-set-hidden");
263+
}
264+
});
247265
});
248266

249267
ProjectManager.on("projectOpen", _updateProjectTitle);

src/styles/brackets.less

+5
Original file line numberDiff line numberDiff line change
@@ -1167,12 +1167,17 @@ a, img {
11671167

11681168
#working-set-list-container {
11691169
background: @bc-sidebar-bg;
1170+
display: block;
11701171

11711172
> div:last-child ul {
11721173
padding-bottom: 21px; // Adds working set bottom padding to the last UL.
11731174
}
11741175
}
11751176

1177+
#working-set-list-container.working-set-hidden {
1178+
display: none !important;
1179+
}
1180+
11761181
.working-set-header {
11771182
position: relative;
11781183
height: 19px;

0 commit comments

Comments
 (0)