Skip to content

Commit e7babb5

Browse files
committed
get project via IPC and update fileStatus on promise fulfillment
1 parent e3be79d commit e7babb5

File tree

2 files changed

+28
-27
lines changed

2 files changed

+28
-27
lines changed

dist/main/atom/views/mainPanelView.js

+15-14
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ var atomUtils = require("../atomUtils");
1010
var parent = require("../../../worker/parent");
1111
var utils = require("../../lang/utils");
1212
var fileStatusCache_1 = require("../fileStatusCache");
13-
var projectCache_1 = require("../../lang/projectCache");
1413
var panelHeaders = {
1514
error: 'Errors In Open Files',
1615
build: 'Last Build Output',
@@ -176,22 +175,24 @@ var MainPanelView = (function (_super) {
176175
}
177176
};
178177
MainPanelView.prototype.updateFileStatus = function (filePath) {
179-
var project = projectCache_1.getOrCreateProject(filePath);
180-
if (!project.projectFile.project.compileOnSave) {
181-
this.fileStatus.addClass("hidden");
182-
}
183-
else {
184-
var status_1 = fileStatusCache_1.getFileStatus(filePath);
185-
this.fileStatus.removeClass('icon-x icon-check text-error text-success hidden');
186-
if (status_1.emitDiffers || status_1.modified) {
187-
this.fileStatus.text('Js emit is outdated');
188-
this.fileStatus.addClass('icon-x text-error');
178+
var _this = this;
179+
parent.getProjectFileDetails({ filePath: filePath }).then(function (fileDetails) {
180+
if (!fileDetails.project.compileOnSave) {
181+
_this.fileStatus.addClass("hidden");
189182
}
190183
else {
191-
this.fileStatus.text('Js emit up to date');
192-
this.fileStatus.addClass('icon-check text-success');
184+
var status_1 = fileStatusCache_1.getFileStatus(filePath);
185+
_this.fileStatus.removeClass('icon-x icon-check text-error text-success hidden');
186+
if (status_1.emitDiffers || status_1.modified) {
187+
_this.fileStatus.text('Js emit is outdated');
188+
_this.fileStatus.addClass('icon-x text-error');
189+
}
190+
else {
191+
_this.fileStatus.text('Js emit up to date');
192+
_this.fileStatus.addClass('icon-check text-success');
193+
}
193194
}
194-
}
195+
});
195196
};
196197
MainPanelView.prototype.showPending = function () {
197198
atom.notifications.addInfo('Pending Requests: <br/> - ' + this.pendingRequests.join('<br/> - '));

lib/main/atom/views/mainPanelView.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import atomUtils = require("../atomUtils");
66
import parent = require("../../../worker/parent");
77
import * as utils from "../../lang/utils";
88
import { FileStatus, getFileStatus } from "../fileStatusCache";
9-
import { getOrCreateProject } from "../../lang/projectCache";
109

1110
var panelHeaders = {
1211
error: 'Errors In Open Files',
@@ -206,20 +205,21 @@ export class MainPanelView extends view.View<any> {
206205

207206
///////////// Change JS File Status
208207
updateFileStatus(filePath: string) {
209-
let project = getOrCreateProject(filePath);
210-
if (!project.projectFile.project.compileOnSave) {
211-
this.fileStatus.addClass("hidden");
212-
} else {
213-
let status = getFileStatus(filePath);
214-
this.fileStatus.removeClass('icon-x icon-check text-error text-success hidden');
215-
if (status.emitDiffers || status.modified) {
216-
this.fileStatus.text('Js emit is outdated');
217-
this.fileStatus.addClass('icon-x text-error');
208+
parent.getProjectFileDetails({ filePath }).then(fileDetails => {
209+
if (!fileDetails.project.compileOnSave) {
210+
this.fileStatus.addClass("hidden");
218211
} else {
219-
this.fileStatus.text('Js emit up to date');
220-
this.fileStatus.addClass('icon-check text-success');
212+
let status = getFileStatus(filePath);
213+
this.fileStatus.removeClass('icon-x icon-check text-error text-success hidden');
214+
if (status.emitDiffers || status.modified) {
215+
this.fileStatus.text('Js emit is outdated');
216+
this.fileStatus.addClass('icon-x text-error');
217+
} else {
218+
this.fileStatus.text('Js emit up to date');
219+
this.fileStatus.addClass('icon-check text-success');
220+
}
221221
}
222-
}
222+
});
223223
}
224224

225225
///////////// Pending Requests

0 commit comments

Comments
 (0)