Code changes when I save the file in visual studio code
Today, when I tried to save my file, the code was completely scrambled. I’ve been using this file for a couple weeks now and this has never happened before. Does anyone know what’s going on here?
And it’s not just the look, but also the code. It’s full of errors.
I’ve also added code chunks:
BEFORE:
async function listEmails() {
let response;
try {
response = await gapi.client.gmail.users.messages.list({
'userId': 'me',
});
} catch (err) {
document.getElementById('content').innerText = err.message;
return;
}
const emails = response.result.messages;
if (!emails || emails.length == 0) {
document.getElementById('content').innerText="No emails found.";
console.log('No emails found.');
return;
}
// Flatten to string to display
const output = emails.reduce(
(str, email) => `${str}${email.name}\n`,
'Emails:\n');
document.getElementById('content').innerText = output;
}
AFTER:
async f Emails() {
let response;
try {
response = await gapi.client.gmail.users.messages.list({
'userId': 'm } catch (err) {
document.getElementById t = err.message; ret }
= response.result.messages;
if (!emails || email
um ntById('content').innerText="No emails console.log("No emails f return;
}
// Flatten to string to const output = emails.reduce( (str, e st me}\n`,
'Emails: document.getElementById( Text = output;
}
Read more here: Source link