Skip to content

Commit

Permalink
remove new line scan on temp file (#133)
Browse files Browse the repository at this point in the history
Co-authored-by: Steve Vaknin <[email protected]>
  • Loading branch information
yuvalyacoby and SteveVaknin committed Jun 8, 2023
1 parent 72d0091 commit 13e465d
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,6 @@ export function activate(context: vscode.ExtensionContext): void {
|| !isSupportedFileType(changeEvent.document.fileName))
return;
vscode.commands.executeCommand(REMOVE_DIAGNOSTICS_COMMAND);
// Run scan on enter (new line)
if (!changeEvent.contentChanges.some(change => change.text.includes('\n'))) return;

const tempFileUri: vscode.Uri = vscode.Uri.joinPath(context.globalStorageUri, tempScanFile);
const text: string = changeEvent.document.getText();
const stringBuffer: Uint8Array = new TextEncoder().encode(text);

// Save changes in temp file
vscode.workspace.fs.writeFile(tempFileUri, stringBuffer)
.then(() => {
logger.debug('Saved temporary file, now scanning', { tempFile: tempFileUri.fsPath });
vscode.commands.executeCommand(RUN_FILE_SCAN_COMMAND, tempFileUri);
}, error => {
logger.error('Error occurred trying to save temp file', { error });
});
}),
vscode.workspace.onDidSaveTextDocument(saveEvent => {
if (!extensionReady) return;
Expand Down

0 comments on commit 13e465d

Please sign in to comment.