Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
Merged
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
18 changes: 6 additions & 12 deletions src/extensions/default/JavaScriptCodeHints/ScopeManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1245,10 +1245,9 @@ define(function (require, exports, module) {
* Do some cleanup when a project is closed.
*
* We can clean up the web worker we use to calculate hints now, since
* we know we will need to re-init it in any new project that is opened.
* @param {boolean=} terminateNow true if Brackets is quitting and need to terminate tern worker immediately.
* we know we will need to re-init it in any new project that is opened.
*/
function closeWorker(terminateNow) {
function closeWorker() {
function terminateWorker() {
var worker = _ternWorker;

Expand All @@ -1266,11 +1265,7 @@ define(function (require, exports, module) {
}

if (_ternWorker) {
if (terminateNow) {
_ternWorker.terminate();
_ternWorker = null;
resolvedFiles = {};
} else if (addFilesPromise) {
if (addFilesPromise) {
// If we're in the middle of added files, don't terminate
// until we're done or we might get NPEs
addFilesPromise.done(terminateWorker).fail(terminateWorker);
Expand Down Expand Up @@ -1487,11 +1482,10 @@ define(function (require, exports, module) {
*
* We can clean up the web worker we use to calculate hints now, since
* we know we will need to re-init it in any new project that is opened.
* @param {boolean=} quitting true if Brackets is quitting and need to terminate tern worker immediately.
*/
function handleProjectClose(quitting) {
function handleProjectClose() {
if (currentWorker) {
currentWorker.closeWorker(quitting);
currentWorker.closeWorker();
currentWorker = null;
}
}
Expand Down Expand Up @@ -1540,4 +1534,4 @@ define(function (require, exports, module) {
exports.handleProjectOpen = handleProjectOpen;
exports._readyPromise = _readyPromise;

});
});
6 changes: 0 additions & 6 deletions src/extensions/default/JavaScriptCodeHints/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -838,12 +838,6 @@ define(function (require, exports, module) {
ScopeManager.handleProjectOpen();
});

$(ProjectManager).on("beforeAppClose", function () {
if (brackets.platform === "win") {
ScopeManager.handleProjectClose(true);
}
});

// immediately install the current editor
installEditorListeners(EditorManager.getActiveEditor());

Expand Down