Skip to content

Commit 45f6646

Browse files
committed
closes #269
1 parent 6d0637d commit 45f6646

File tree

6 files changed

+12
-29
lines changed

6 files changed

+12
-29
lines changed

dist/main/atom/atomUtils.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ exports.getEditorPositionForBufferPosition = getEditorPositionForBufferPosition;
1717
function onDiskAndTs(editor) {
1818
if (editor instanceof require('atom').TextEditor) {
1919
var filePath = editor.getPath();
20+
if (!filePath) {
21+
return false;
22+
}
2023
var ext = path.extname(filePath);
2124
if (ext == '.ts') {
2225
if (fs.existsSync(filePath)) {
@@ -27,17 +30,6 @@ function onDiskAndTs(editor) {
2730
return false;
2831
}
2932
exports.onDiskAndTs = onDiskAndTs;
30-
function isTs(editor) {
31-
if (editor instanceof require('atom').TextEditor) {
32-
var filePath = editor.getPath();
33-
var ext = path.extname(filePath);
34-
if (ext == '.ts') {
35-
return true;
36-
}
37-
}
38-
return false;
39-
}
40-
exports.isTs = isTs;
4133
function getFilePathPosition() {
4234
var editor = atom.workspace.getActiveTextEditor();
4335
var filePath = editor.getPath();

dist/main/atom/onSaveHandler.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ function handle(event) {
99
parent.errorsForFile({ filePath: event.filePath })
1010
.then(function (resp) { return mainPanelView_1.errorView.setErrors(event.filePath, resp.errors); });
1111
});
12+
mainPanelView_1.show();
1213
parent.getProjectFileDetails({ filePath: event.filePath }).then(function (fileDetails) {
1314
if (!fileDetails.project.compileOnSave)
1415
return;

dist/main/atomts.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ exports.config = atomConfig.schema;
2525
var utils_1 = require("./lang/utils");
2626
var hideIfNotActiveOnStart = utils_1.debounce(function () {
2727
var editor = atom.workspace.getActiveTextEditor();
28-
if (editor && editor.getGrammar() && editor.getGrammar().name !== 'TypeScript') {
28+
if (atomUtils.onDiskAndTs(editor)) {
2929
mainPanelView.hide();
3030
}
3131
}, 100);
@@ -39,8 +39,6 @@ function readyToActivate() {
3939
var filePath = editor.getPath();
4040
parent.errorsForFile({ filePath: filePath })
4141
.then(function (resp) { return mainPanelView_1.errorView.setErrors(filePath, resp.errors); });
42-
}
43-
if (atomUtils.isTs(editor)) {
4442
mainPanelView.show();
4543
}
4644
else {

lib/main/atom/atomUtils.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export function getEditorPositionForBufferPosition(editor: AtomCore.IEditor, buf
2121
export function onDiskAndTs(editor: AtomCore.IEditor) {
2222
if (editor instanceof require('atom').TextEditor) {
2323
var filePath = editor.getPath();
24+
if (!filePath) {
25+
return false;
26+
}
2427
var ext = path.extname(filePath);
2528
if (ext == '.ts') {
2629
if (fs.existsSync(filePath)) {
@@ -31,17 +34,6 @@ export function onDiskAndTs(editor: AtomCore.IEditor) {
3134
return false;
3235
}
3336

34-
export function isTs(editor: AtomCore.IEditor) {
35-
if (editor instanceof require('atom').TextEditor) {
36-
var filePath = editor.getPath();
37-
var ext = path.extname(filePath);
38-
if (ext == '.ts') {
39-
return true;
40-
}
41-
}
42-
return false;
43-
}
44-
4537
export function getFilePathPosition(): { filePath: string; position: number } {
4638
var editor = atom.workspace.getActiveTextEditor();
4739
var filePath = editor.getPath();

lib/main/atom/onSaveHandler.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import atomConfig = require('./atomConfig'); ///ts:import:generated
77
///ts:import=parent
88
import parent = require('../../worker/parent'); ///ts:import:generated
99

10-
import {errorView} from "./views/mainPanelView";
10+
import {errorView, show} from "./views/mainPanelView";
1111

1212
///ts:import=debugAtomTs
1313
import debugAtomTs = require('./debugAtomTs'); ///ts:import:generated
@@ -27,6 +27,8 @@ export function handle(event: { filePath: string; editor: AtomCore.IEditor }) {
2727
.then((resp) => errorView.setErrors(event.filePath, resp.errors));
2828
})
2929

30+
show();
31+
3032
// Compile on save
3133
parent.getProjectFileDetails({ filePath: event.filePath }).then(fileDetails => {
3234
if (!fileDetails.project.compileOnSave) return;

lib/main/atomts.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ import {debounce} from "./lang/utils";
5252
var hideIfNotActiveOnStart = debounce(() => {
5353
// Only show if this editor is active:
5454
var editor = atom.workspace.getActiveTextEditor();
55-
if (editor && editor.getGrammar() && editor.getGrammar().name !== 'TypeScript') {
55+
if (atomUtils.onDiskAndTs(editor)) {
5656
mainPanelView.hide();
5757
}
5858
}, 100);
@@ -97,9 +97,7 @@ function readyToActivate() {
9797
// or the other file might have made this file have an error
9898
parent.errorsForFile({ filePath: filePath })
9999
.then((resp) => errorView.setErrors(filePath, resp.errors));
100-
}
101100

102-
if (atomUtils.isTs(editor)) {
103101
mainPanelView.show();
104102
}
105103
else {

0 commit comments

Comments
 (0)