I made the functionality myself by keeping an array of files changed:
var isDirty = [];
function activate(context) {
console.log('activated.');
vscode.workspace.onDidChangeTextDocument(function(e) {
console.log('Changed.');
if (!isDirty.includes(e.document.uri.path)) {
console.log('This is the change that made this file "dirty".');
isDirty.push(e.document.uri.path);
// Place code that you only want to run on the first change (that makes a document dirty) here...
}
});
vscode.workspace.onDidSaveTextDocument(function(e) {
console.log('Saved!');
const index = isDirty.indexOf(e.uri.path);
if (index > -1) {
isDirty.splice(index, 1);
}
});
}
exports.activate = activate;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…