以下是在任何類型的文件中執行此操作的方法。你需要這個擴展(我寫的),查找和轉換。使此鍵綁定(在keybindings.json中): { "key": "alt+d", "command": "findInCurrentFile", "args": { "replace": [ "$${", "const date = new Date();", "const options = { weekday: 'short', month: 'short', year: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric'};", "let str = `${LINE_COMMENT} ` + new Intl.DateTimeFormat('en-US', options).format(date) + ' ';", "return str.padEnd(70, '-');", // padEnd with ---, whatever final length you want "}$$" ], "restrictFind": "line", "postCommands": "cancelSelection" }, // "when": "editorLangId == r"} 您