Skip to content

Commit

Permalink
DEV2-3741 add "active_text_editor_changed" event (#1296)
Browse files Browse the repository at this point in the history
* DEV2-3741 add "active_text_editor_changed" event

* prettier
  • Loading branch information
yonip23 authored Sep 19, 2023
1 parent bdd3a7f commit cd94345
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/activeTextEditorState.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import * as vscode from "vscode";
import { prefetch } from "./binary/requests/prefetch";
import { sendEvent } from "./binary/requests/sendEvent";

// Notify the binary on changes to the active text editor.
export const activeTextEditorState = vscode.window.onDidChangeActiveTextEditor(
async (editor) => {
if (editor) {
void sendEvent({
name: "active_text_editor_changed",
properties: {
isDirty: editor.document.isDirty.toString(),
},
});
const filename = editor.document.uri.fsPath;
await prefetch({ filename });
}
Expand Down

0 comments on commit cd94345

Please sign in to comment.