iCharlesZ / vscode-live2d

一个简单的VSCode看板娘插件,会跟随你的鼠标动作变化,写代码累了可以逗逗她哦
https://marketplace.visualstudio.com/items?itemName=CharlesZ.vscode-live2d
109 stars 15 forks source link

安装后重启vscode 无法打开 #37

Open ZyGitZy opened 1 year ago

ZyGitZy commented 1 year ago

插件安装后再次打开vscode的时候 vscode就打不开了 vscode版本1.79.2

ZyGitZy commented 1 year ago

注意下面更改后每次在vscode中设置live2d的配置的时候他会覆盖html的内容 所以将修改后的html复制下来,每次修改配置后去替换一下html就好了 其他的不用动 (live2d的配置有修改高度,修改板娘等等....他都会还原他html的内容导致vscode打不开,打不开原因是js报错) workbench.html路径 安装目录\Microsoft VS Code\resources\app\out\vs\code\electron-sandbox\workbench 需要管理员打开vscode

更改workbench.html body中加入 `

` 添加scrtip引用 ` ` 添加css引用 `` meta 标签中移除 ` require-trusted-types-for 'script'` 移除 ` ` 这三个js的引用 保留 `workbench.js` script 的引用 删除 workbench.js中 live2d的js内容 `//# sourceMappingURL=https://ticino.blob.core.windows.net/sourcemaps/695af097c7bd098fbf017ce3ac85e09bbc5dda06/core/vs/code/electron-sandbox/workbench/workbench.js.map /*ext-vscode-live2d-start*/ /*ext.vscode-live2d.ver.1.8.1*/ function addElement(elementName, src) { var tempDom = document.createElement(elementName); tempDom.src = src; tempDom.href = src; tempDom.rel = 'stylesheet'; document.body.appendChild(tempDom); return new Promise(resolve => { tempDom.onload = res => { setTimeout(resolve, 0, res); }; }); } var tempDiv = document.createElement('div'); tempDiv.innerHTML = '
'; var waifu = document.body.appendChild(tempDiv.children[0]); if (false) { // 用 waifu 上的鼠标事件来做,无法同时实现穿透效果,算坐标是最简单的方案 var tid, flag; document.body.addEventListener("mousemove", function(e) { var _pointerOverHidden = () => { var cursorX = e.clientX; var cursorY = e.clientY; var minX = waifu.offsetLeft; var maxX = minX + waifu.clientWidth; var minY = waifu.offsetTop; var maxY = minY + waifu.clientHeight; if (cursorX >= minX && cursorX <= maxX && cursorY >= minY && cursorY <= maxY) { if (!waifu.over) { waifu.style.opacity = '0'; waifu.over = true } } else { if (waifu.over) { waifu.style.opacity = '1'; waifu.over = false } } } // 实现一个简单的 throttle 来降低开销 if (!tid) { if (!flag) { _pointerOverHidden(); } tid = setTimeout(() => { clearTimeout(tid); tid = null; if (flag) { _pointerOverHidden(); flag = false; } }, 300); } else { flag = true; } }); } addElement('link', './live2d/waifu.css'); addElement('script', './live2d/live2d.js') .then(() => addElement('script', './live2d/message.js')) .then(() => { loadlive2d( 'live2d', './models/shizuku/index.json' ); }); /*ext-vscode-live2d-end*/`
airuikun commented 1 year ago

我也是安装了以后vscode就打不开了,按照您的步骤走了一遍,还是不行

ZyGitZy commented 1 year ago

或者直接删掉 loader.js的引用也行 Microsoft VS Code\resources\app\out\vs\code\electron-sandbox\workbench\workbench.html

KDR622 commented 1 year ago

可以,有用