Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 75d3947

Browse files
committed
Public methods for closing Search Results and References bottom panel
The bottom panels 'Search Results' and 'References' can only be closed in the UI at the moment, by clicking at the close button. Public methods for closing them enables extensions to attach a keyboard shortcut to this action.
1 parent 5f40608 commit 75d3947

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/features/FindReferencesManager.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,16 @@ define(function (require, exports, module) {
121121
searchModel.clear();
122122
}
123123

124+
/**
125+
* @public
126+
* Closes the references panel
127+
*/
128+
function closeReferencesPanel() {
129+
if (_resultsView) {
130+
_resultsView.close();
131+
}
132+
}
133+
124134
function setMenuItemStateForLanguage(languageId) {
125135
CommandManager.get(Commands.CMD_FIND_ALL_REFERENCES).setEnabled(false);
126136
if (!languageId) {
@@ -207,4 +217,5 @@ define(function (require, exports, module) {
207217
exports.registerFindReferencesProvider = registerFindReferencesProvider;
208218
exports.removeFindReferencesProvider = removeFindReferencesProvider;
209219
exports.setMenuItemStateForLanguage = setMenuItemStateForLanguage;
220+
exports.closeReferencesPanel = closeReferencesPanel;
210221
});

src/search/FindInFilesUI.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,15 @@ define(function (require, exports, module) {
450450
}
451451
}
452452

453+
/**
454+
* @public
455+
* Closes the search results panel
456+
*/
457+
function closeResultsPanel() {
458+
_resultsView.close();
459+
_closeFindBar();
460+
}
461+
453462
// Initialize items dependent on HTML DOM
454463
AppInit.htmlReady(function () {
455464
var model = FindInFiles.searchModel;
@@ -495,6 +504,7 @@ define(function (require, exports, module) {
495504
// Public exports
496505
exports.searchAndShowResults = searchAndShowResults;
497506
exports.searchAndReplaceResults = searchAndReplaceResults;
507+
exports.closeResultsPanel = closeResultsPanel;
498508

499509
// For unit testing
500510
exports._showFindBar = _showFindBar;

0 commit comments

Comments
 (0)