Skip to content

feat: add preferences to toggle the working set visibility #2202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,9 @@ define({
// Emmet
"DESCRIPTION_EMMET": "true to enable Emmet, else false.",

// Hide/Show working set (that is displayed in the sidebar)
"DESCRIPTION_HIDE_WORKING_SET": "true to hide the working set, false to display it.",

// Tabbar
"DESCRIPTION_TABBAR": "Set the tab bar settings.",
"DESCRIPTION_SHOW_TABBAR": "true to show the tab bar, else false.",
Expand Down
36 changes: 27 additions & 9 deletions src/project/SidebarView.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@
define(function (require, exports, module) {


var AppInit = require("utils/AppInit"),
ProjectManager = require("project/ProjectManager"),
WorkingSetView = require("project/WorkingSetView"),
MainViewManager = require("view/MainViewManager"),
CommandManager = require("command/CommandManager"),
Commands = require("command/Commands"),
Strings = require("strings"),
Resizer = require("utils/Resizer"),
_ = require("thirdparty/lodash");
var AppInit = require("utils/AppInit"),
ProjectManager = require("project/ProjectManager"),
PreferencesManager = require("preferences/PreferencesManager"),
WorkingSetView = require("project/WorkingSetView"),
MainViewManager = require("view/MainViewManager"),
CommandManager = require("command/CommandManager"),
Commands = require("command/Commands"),
Strings = require("strings"),
Resizer = require("utils/Resizer"),
_ = require("thirdparty/lodash");

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

// Tooltips
$splitViewMenu.attr("title", Strings.GEAR_MENU_TOOLTIP);

// Define the preference to decide whether to hide the working set or not
PreferencesManager.definePreference("hideWorkingSet", "boolean", false, {
description: Strings.DESCRIPTION_HIDE_WORKING_SET
})
.on("change", function () {
// 'working-set-list-container' is the id of the main working set element which we need to hide/show
const $workingSet = $(document.getElementById("working-set-list-container"));
const getPref = PreferencesManager.get("hideWorkingSet");

if(getPref) {
// refer to brackets.less file for styles
$workingSet.addClass("working-set-hidden");
} else {
$workingSet.removeClass("working-set-hidden");
}
});
});

ProjectManager.on("projectOpen", _updateProjectTitle);
Expand Down
5 changes: 5 additions & 0 deletions src/styles/brackets.less
Original file line number Diff line number Diff line change
Expand Up @@ -1167,12 +1167,17 @@ a, img {

#working-set-list-container {
background: @bc-sidebar-bg;
display: block;

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

#working-set-list-container.working-set-hidden {
display: none !important;
}

.working-set-header {
position: relative;
height: 19px;
Expand Down
Loading