Copilot Continue

2025/5/16 13:00:33

当前为 2025-06-05 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Copilot Continue
// @namespace   https://snomiao.com
// @match       *://*/*
// @grant       none
// @version     1.0
// @author      -
// @description 2025/5/16 13:00:33
// ==/UserScript==

// webhook...update =   fetch(globalThis.GM_info.script.downloadURL)

const enable = !!document.querySelector("meta#vscode-workbench-auth-session");

if (enable) main()

function main() {
  const clear = useInterval(() => clickContinue, 1e3);
  return () => clear();
}

function clickContinue() {
  const stucked = $$("div.rendered-markdown")
    .map((e) => e.innerText)
    .flatMap((e) => (e ? [e] : [])) // empty filter
    .findLast(
      (s) =>
        false ||
        s.match(/Copilot has been working on this problem for a while/) ||
        s.match(/Run command in the terminal/) ||
        s.match(/Allow task run\?/)
    );
  if (!stucked) return;
  const btn = $$("a.monaco-button").findLast(
    (e) => e.textContent === "Continue"
  );
  if (!btn) return;
  btn.click();
  return true;
}

function $$(sel) {
  return [...document.querySelectorAll(sel)];
}

function useInterval(...args) {
  const id = setInterval(...args);
  return () => clearInterval(id);
}