Skip to content

Commit c2e697e

Browse files
committed
send the tab text to worker on tab change
refs #110
1 parent efc2bcc commit c2e697e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/main/atomts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function activate(state) {
3939
atom.workspace.onDidChangeActivePaneItem(function (editor) {
4040
if (atomUtils.onDiskAndTs(editor)) {
4141
var filePath = editor.getPath();
42-
parent.errorsForFile({ filePath: filePath }).then(function (resp) { return errorView.setErrors(filePath, resp.errors); });
42+
parent.updateText({ text: editor.getText(), filePath: filePath }).then(function () { return parent.errorsForFile({ filePath: filePath }); }).then(function (resp) { return errorView.setErrors(filePath, resp.errors); });
4343
}
4444
});
4545
editorWatch = atom.workspace.observeTextEditors(function (editor) {

lib/main/atomts.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ export function activate(state: PackageState) {
9696
atom.workspace.onDidChangeActivePaneItem((editor: AtomCore.IEditor) => {
9797
if (atomUtils.onDiskAndTs(editor)) {
9898
var filePath = editor.getPath();
99-
parent.errorsForFile({ filePath: filePath })
99+
// We have an update text here as we are highly aggressive about
100+
// * loading file system changes and invalidating our project cache
101+
// * crashes in the worker
102+
// best to reload stuff on change active tab
103+
parent.updateText({ text: editor.getText(), filePath: filePath })
104+
.then(() => parent.errorsForFile({ filePath: filePath }))
100105
.then((resp) => errorView.setErrors(filePath, resp.errors));
101106
}
102107
});

0 commit comments

Comments
 (0)