Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 BUG: Astro VSCode extension crashing Typescript language server #850

Open
funabab opened this issue Apr 7, 2024 · 15 comments
Open
Labels
needs repro Issue needs a reproduction

Comments

@funabab
Copy link

funabab commented Apr 7, 2024

Describe the Bug

Unable to work with any TS project because VSCode TS server keeps crashing with the following message.

The JS/TS language service crashed 5 times in the last 5 Minutes. This may be caused by a plugin contributed by one of these extensions: astro-build.astro-vscode, nrwl.angular-console, styled-components.vscode-styled-components, Vue.volar Please try disabling these extensions before filing an issue against VS Code.

Just as the error stated, I disabled all extensions mentioned and manually enabled each one. Eventually, I discovered disabling only astro extension prevented the crash.

Steps to Reproduce

VSCode Version: 1.87.2
Typescript Version: 5.3.2
Astro VSCode Extension Version: 2.8.5
OS: Ubuntu 22.04.4

@github-actions github-actions bot added the needs triage Issue needs to be triaged label Apr 7, 2024
@Princesseuh
Copy link
Member

Can't do much without a reproduction. Do you have a project I can check out?

@Princesseuh Princesseuh added needs repro Issue needs a reproduction and removed needs triage Issue needs to be triaged labels Apr 7, 2024
Copy link
Contributor

github-actions bot commented Apr 7, 2024

Hello @funabab. Please provide a minimal reproduction using a GitHub repository or at least sharing the file where the issue happen. Issues marked with needs repro will be closed if they have no activity within 3 days.

@dennibl
Copy link

dennibl commented Apr 9, 2024

Same Issue here. Here's the output from my console:

[Error - 8:57:44 PM] Server initialization failed.
Message: Request initialize failed with message: Can't find typescript.js or tsserverlibrary.js in "c:/Users/.../.vscode/extensions/ms-vscode.vscode-typescript-next-5.5.20240408/node_modules/typescript/lib"
Code: -32603
[Error - 8:57:44 PM] Astro Language Server client: couldn't create connection to server.
Message: Request initialize failed with message: Can't find typescript.js or tsserverlibrary.js in "c:/Users/.../.vscode/extensions/ms-vscode.vscode-typescript-next-5.5.20240408/node_modules/typescript/lib"
Code: -32603
[Error - 8:57:46 PM] Server process exited with code 1.
[Info - 8:57:46 PM] Connection to server got closed. Server will restart.
true
[Error - 8:57:46 PM] Server initialization failed.

@Princesseuh
Copy link
Member

Princesseuh commented Apr 9, 2024

Same Issue here. Here's the output from my console:

[Error - 8:57:44 PM] Server initialization failed.
Message: Request initialize failed with message: Can't find typescript.js or tsserverlibrary.js in "c:/Users/.../.vscode/extensions/ms-vscode.vscode-typescript-next-5.5.20240408/node_modules/typescript/lib"
Code: -32603
[Error - 8:57:44 PM] Astro Language Server client: couldn't create connection to server.
Message: Request initialize failed with message: Can't find typescript.js or tsserverlibrary.js in "c:/Users/.../.vscode/extensions/ms-vscode.vscode-typescript-next-5.5.20240408/node_modules/typescript/lib"
Code: -32603
[Error - 8:57:46 PM] Server process exited with code 1.
[Info - 8:57:46 PM] Connection to server got closed. Server will restart.
true
[Error - 8:57:46 PM] Server initialization failed.

That's not the same error. Yours seems to be related to our extension not being able to find TypeScript when using TypeScript's nightly.

@RealKendpr
Copy link

I had the same problem. Try updating your VS Code to the latest version; this is how I solve this error.

The JS/TS language service crashed 5 times in the last 5 Minutes.

@amxv
Copy link

amxv commented Apr 24, 2024

yep im also having the same issue

@xtealer
Copy link

xtealer commented May 5, 2024

Same issue here. Logs:

The JS/TS language service immediately crashed 5 times. The service will not be restarted. This may be caused by a plugin contributed by one of these extensions: astro-build.astro-vscode, svelte.svelte-vscode. Please try disabling these 
extensions before filing an issue against VS Code.

@xtealer
Copy link

xtealer commented May 6, 2024

Same issue here. Logs:

The JS/TS language service immediately crashed 5 times. The service will not be restarted. This may be caused by a plugin contributed by one of these extensions: astro-build.astro-vscode, svelte.svelte-vscode. Please try disabling these 
extensions before filing an issue against VS Code.

I Started seeing this issue after adding .svelte files with Typescript to my project. When I disable the astro extension the crash is gone. Followed the standard setup for Svelte on Astro.

@Princesseuh
Copy link
Member

I still cannot do anything without a reproduction or more detailed logs. Everything seems to work fine for me, even when using Svelte and other extensions.

@wenwei-lin
Copy link

wenwei-lin commented May 22, 2024

I face the same problem when I use VS Code refactor tools. After unable the Astro plugin, the refactor tools work properly.

<semantic> TypeScript Server Error (5.4.5)
Debug Failure. False expression: No interactive refactor arguments available
Error: Debug Failure. False expression: No interactive refactor arguments available
    at Object.getRefactorEditsToMoveToFile [as getEditsForAction] (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:140862:11)
    at Object.getEditsForRefactor (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:139733:31)
    at getEditsForRefactor2 (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:147297:32)
    at e.getEditsForRefactor (c:\Users\wenwe\.vscode\extensions\astro-build.astro-vscode-2.10.2-win32-x64\node_modules\astro-ts-plugin-bundle\index.js:6:1668)
    at IpcIOSession.getEditsForRefactor (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:187183:49)
    at getEditsForRefactor (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:185408:43)
    at d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:187569:69
    at IpcIOSession.executeWithRequestId (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:187561:14)
    at IpcIOSession.executeCommand (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:187569:29)
    at IpcIOSession.onMessage (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:187611:51)
    at process.<anonymous> (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:189220:14)
    at process.emit (node:events:517:28)
    at emit (node:internal/child_process:944:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

@Princesseuh
Copy link
Member

I face the same problem when I use VS Code refactor tools. After unable the Astro plugin, the refactor tools work properly.

<semantic> TypeScript Server Error (5.4.5)
Debug Failure. False expression: No interactive refactor arguments available
Error: Debug Failure. False expression: No interactive refactor arguments available
    at Object.getRefactorEditsToMoveToFile [as getEditsForAction] (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:140862:11)
    at Object.getEditsForRefactor (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:139733:31)
    at getEditsForRefactor2 (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:147297:32)
    at e.getEditsForRefactor (c:\Users\wenwe\.vscode\extensions\astro-build.astro-vscode-2.10.2-win32-x64\node_modules\astro-ts-plugin-bundle\index.js:6:1668)
    at IpcIOSession.getEditsForRefactor (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:187183:49)
    at getEditsForRefactor (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:185408:43)
    at d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:187569:69
    at IpcIOSession.executeWithRequestId (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:187561:14)
    at IpcIOSession.executeCommand (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:187569:29)
    at IpcIOSession.onMessage (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:187611:51)
    at process.<anonymous> (d:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:189220:14)
    at process.emit (node:events:517:28)
    at emit (node:internal/child_process:944:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

This is unrelated to this issue. The issue you're encountering is this one: #812

@johnsoncodehk
Copy link
Contributor

johnsoncodehk commented May 23, 2024

Same issue here. Logs:

The JS/TS language service immediately crashed 5 times. The service will not be restarted. This may be caused by a plugin contributed by one of these extensions: astro-build.astro-vscode, svelte.svelte-vscode. Please try disabling these 
extensions before filing an issue against VS Code.

The latest version of Svelte extension fixes the compatibility issue with Volar-based TS plugin, please make sure you have updated it.

Refs: sveltejs/language-tools#2317

@bastianhenneberg
Copy link

bastianhenneberg commented May 28, 2024

Same issue here astro Client Crashing in Neovim and VSCode on two Systems this are the lsp.log i get.

[START][2024-05-28 16:42:17] LSP logging initiated
[ERROR][2024-05-28 16:42:17] .../vim/lsp/rpc.lua:770 "rpc" "/home/bastian/.local/share/nvim/mason/bin/astro-ls" "stderr" "panic: "
[ERROR][2024-05-28 16:42:17] .../vim/lsp/rpc.lua:770 "rpc" "/home/bastian/.local/share/nvim/mason/bin/astro-ls" "stderr" "runtime error: index out of range [0] with length 0\n"
[ERROR][2024-05-28 16:42:17] .../vim/lsp/rpc.lua:770 "rpc" "/home/bastian/.local/share/nvim/mason/bin/astro-ls" "stderr" "\n"
[ERROR][2024-05-28 16:42:17] .../vim/lsp/rpc.lua:770 "rpc" "/home/bastian/.local/share/nvim/mason/bin/astro-ls" "stderr" "goroutine "
[ERROR][2024-05-28 16:42:17] .../vim/lsp/rpc.lua:770 "rpc" "/home/bastian/.local/share/nvim/mason/bin/astro-ls" "stderr" "6 [running]:\n"
[ERROR][2024-05-28 16:42:17] .../vim/lsp/rpc.lua:770 "rpc" "/home/bastian/.local/share/nvim/mason/bin/astro-ls" "stderr" "github.com/withastro/compiler/internal/printer.renderTsx("
[ERROR][2024-05-28 16:42:17] .../vim/lsp/rpc.lua:770 "rpc" "/home/bastian/.local/share/nvim/mason/bin/astro-ls" "stderr" "0x1779950"
[ERROR][2024-05-28 16:42:17] .../vim/lsp/rpc.lua:770 "rpc" "/home/bastian/.local/share/nvim/mason/bin/astro-ls" "stderr" ", 0x159da40)\n\tgithub.com/withastro/compiler/internal/printer/print-to-tsx.go:248 +0x1b6\n"
[ERROR][2024-05-28 16:42:17] .../vim/lsp/rpc.lua:770 "rpc" "/home/bastian/.local/share/nvim/mason/bin/astro-ls" "stderr" "github.com/withastro/compiler/internal/printer.renderTsx(0x1779950, 0x1582280)\n\tgithub.com/withastro/compiler/internal/printer/print-to-tsx.go"
[ERROR][2024-05-28 16:42:17] .../vim/lsp/rpc.lua:770 "rpc" "/home/bastian/.local/share/nvim/mason/bin/astro-ls" "stderr" ":523 +0x52f\ngithub.com/withastro/compiler/internal/printer.renderTsx(0x1779950, 0x1512a00)\n\tgithub.com/withastro/compiler/internal/printer/print-to-tsx.go:523 +0x52f\ngithub.com/withastro/compiler/internal/printer.renderTsx(0x1779950, "
[ERROR][2024-05-28 16:42:17] .../vim/lsp/rpc.lua:770 "rpc" "/home/bastian/.local/share/nvim/mason/bin/astro-ls" "stderr" "0x1512780)\n\tgithub.com/withastro/compiler/internal/printer/print-to-tsx.go:523 +0x52f\ngithub.com/withastro/compiler/internal/printer.renderTsx(0x1779950, 0x1512280)\n\tgithub.com/withastro/compiler/internal/printer/print-to-tsx.go:147 +0xba\ngithub.com/withastro/compiler/internal/printer.PrintToTSX({0x154e000, 0x3bf9}, 0x1512280, {{0x3c3c4, 0x6}, {0x145c0a0, "
[ERROR][2024-05-28 16:42:17] .../vim/lsp/rpc.lua:770 "rpc" "/home/bastian/.local/share/nvim/mason/bin/astro-ls" "stderr" "0x44}, {0x145c0a0, 0x44}, {0x46f38, ...}, ...}, ...)\n\tgithub.com/withastro/compiler/internal/printer/print-to-tsx.go:30 +"
[ERROR][2024-05-28 16:42:17] .../vim/lsp/rpc.lua:770 "rpc" "/home/bastian/.local/share/nvim/mason/bin/astro-ls" "stderr" "0x12\nmain.main.ConvertToTSX.func3({{}, 0x7ff8000100000015, 0x140c790}, {0x1434000, 0x2, 0x2})\n\t./astro-wasm.go:263 +0xe\nsyscall/js.handleEvent"
[ERROR][2024-05-28 16:42:17] .../vim/lsp/rpc.lua:770 "rpc" "/home/bastian/.local/share/nvim/mason/bin/astro-ls" "stderr" "()\n\tsyscall/js/func.go:100 +0x23\n"
[WARN][2024-05-28 16:42:18] ...lsp/handlers.lua:625 "exit code: 2"
[ERROR][2024-05-28 16:42:18] ...lsp/handlers.lua:623 "There was an error transforming /home/bastian/Development/cars-bytes/src/pages/aussteller/[id].astro to TSX. An empty file will be returned instead. Please create an issue: https://github.com/withastro/language-tools/issues\nError: TypeError: Cannot read properties of undefined (reading 'map')."
[ERROR][2024-05-28 16:42:18] .../vim/lsp/rpc.lua:770 "rpc" "/home/bastian/.local/share/nvim/mason/bin/astro-ls" "stderr" '/home/bastian/.local/share/nvim/mason/packages/astro-language-server/node_modules/@astrojs/language-server/node_modules/@astrojs/compiler/dist/node/sync.cjs:1\n"use strict";var P=Object.create;var y=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var O=(i,n)=>{for(var s in n)y(i,s,{get:n[s],enumerable:!0})},T=(i,n,s,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of A(n))!C.call(i,c)&&c!==s&&y(i,c,{get:()=>n[c],enumerable:!(r=I(n,c))||r.enumerable});return i};var x=(i,n,s)=>(s=i!=null?P(E(i)):{},T(n||!i||!i.__esModule?y(s,"default",{value:i,enumerable:!0}):s,i)),D=i=>T(y({},"__esModule",{value:!0}),i);var M={};O(M,{convertToTSX:()=>W,parse:()=>L,startRunningService:()=>R,transform:()=>N});module.exports=D(M);var k=()=>typeof document>"u"?new URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href,w=k();var S=require("fs"),j=require("url");var v=x(require("crypto"),1),b=x(require("fs"),1),_=require("util");globalThis.fs||Object.defineProperty(globalThis,"fs",{value:b.default});globalThis.process||Object.defineProperties(globalThis,"process",{value:process});globalThis.crypto||Object.defineProperty(globalThis,"crypto",{value:v.default.webcrypto?v.default.webcrypto:{getRandomValues(i){return v.default.randomFillSync(i)}}});globalThis.performance||Object.defineProperty(globalThis,"performance",{value:{now(){let[i,n]=process.hrtime();return i1e3+n/1e6}}});var U=new _.TextEncoder("utf-8"),V=new _.TextDecoder("utf-8");var d=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;let n=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},s=e=>{let t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o4294967296},r=e=>{let t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;let o=this.mem.getUint32(e,!0);return this._values[o]},c=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;let m=0;switch(typeof t){case"object":t!==null&&(m=1);break;case"string":m=2;break;case"symbol":m=3;break;case"function":m=4;break}this.mem.setUint32(e+4,2146959360|m,!0),this.mem.setUint32(e,a,!0)},l=e=>{let t=s(e+0),o=s(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},g=e=>{let t=s(e+0),o=s(e+8),a=new Array(o);for(let m=0;m<o;m++)a[m]=r(t+m*8);return a},h=e=>{let t=s(e+0),o=s(e+8);return V.decode(new DataView(this._inst.exports.mem.buffer,t,o))},u=Date.now()-performance.now();this.importObject={gojs:{"runtime.wasmExit":e=>{e>>>=0;let t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e>>>=0;let t=s(e+8),o=s(e+16),a=this.mem.getInt32(e+24,!0);b.default.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,n(e+8,(u+performance.now())1e6)},"runtime.walltime":e=>{e>>>=0;let t=new Date().getTime();n(e+8,t/1e3),this.mem.setInt32(e+16,t%1e31e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;let t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},s(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;let t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,globalThis.crypto.getRandomValues(l(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;let t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){let o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,c(e+24,h(e+8))},"syscall/js.valueGet":e=>{e>>>=0;let t=Reflect.get(r(e+8),h(e+16));e=this._inst.exports.getsp()>>>0,c(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(r(e+8),h(e+16),r(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(r(e+8),h(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,c(e+24,Reflect.get(r(e+8),s(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(r(e+8),s(e+16),r(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{let t=r(e+8),o=Reflect.get(t,h(e+16)),a=g(e+32),m=Reflect.apply(o,t,a);e=this._inst.exports.getsp()>>>0,c(e+56,m),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,c(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{let t=r(e+8),o=g(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,c(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,c(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{let t=r(e+8),o=g(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,c(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,c(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,n(e+16,parseInt(r(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;let t=U.encode(String(r(e+8)));c(e+16,t),n(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;let t=r(e+8);l(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,r(e+8)instanceof r(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;let t=l(e+8),o=r(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}let a=o.subarray(0,t.length);t.set(a),n(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;let t=r(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}let a=o.subarray(0,t.length);t.set(a),n(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(n){if(!(n instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=n,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let s=4096,r=u=>{let e=s,t=U.encode(u+"\0");return new Uint8Array(this.mem.buffer,s,t.length).set(t),s+=t.length,s%8!==0&&(s+=8-s%8),e},c=this.argv.length,l=[];this.argv.forEach(u=>{l.push(r(u))}),l.push(0),Object.keys(this.env).sort().forEach(u=>{l.push(r(${u}=${this.env[u]}))}),l.push(0);let h=s;l.forEach(u=>{this.mem.setUint32(s,u,!0),this.mem.setUint32(s+4,0,!0),s+=8}),this._inst.exports.run(c,h),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(n){let s=this;return function(){let r={id:n,this:this,args:arguments};return s._pendingEvent=r,s._resume(),r.result}}};function p(){return f||(f=R()),f}var f,N=(i,n)=>p().transform(i,n),L=(i,n)=>p().parse(i,n),W=(i,n)=>p().convertToTSX(i,n);function R(){let i=new d,n=F((0,j.fileURLToPath)(new URL("../astro.wasm",w)),i.importObject);i.run(n);let s=globalThis["@astrojs/compiler"];return{transform:(r,c)=>{try{return s.transform(r,c||{})}catch(l){throw f=void 0,l}},parse:(r,c)=>{try{let l=s.parse(r,c||{});return{...l,ast:JSON.parse(l.ast)}}catch(l){throw f=void 0,l}},convertToTSX:(r,c)=>{try{let l=s.convertToTSX(r,c||{});return{...l,map:JSON.parse(l.map)}}catch(l){throw f=void 0,l}}}}function F(i,n){let s=(0,S.readFileSync)(i);return new WebAssembly.Instance(new WebAssembly.Module(s),n)}0&&(module.exports={convertToTSX,parse,startRunningService,transform});\n \n\nError: Go program has already exited\n at d._resume (/home/bastian/.local/share/nvim/mason/packages/astro-language-server/node_modules/@astrojs/language-server/node_modules/@astrojs/compiler/dist/node/sync.cjs:1:7231)\n at Timeout._onTimeout (/home/bastian/.local/share/nvim/mason/packages/astro-language-server/node_modules/@astrojs/language-server/node_modules/@astrojs/compiler/dist/node/sync.cjs:1:3722)\n at listOnTimeout (node:internal/timers:573:17)\n
at process.processTimers (node:internal/timers:514:7)\n\nNode.js v21.2.0\n'

@ryan-saffer
Copy link

ryan-saffer commented Jun 16, 2024

I am having the same problem, and have isolated it down to the Astro extension. I have been able to reproduce the error in a freshly created scaffold, where the only things I have added to the empty astro template is react and tailwind.

Here is the GitHub repository

These are the only steps I have done to create this repository:

npm create astro@latest

npx astro add react

npx astro add tailwind

I then created a directory src/components/react and create a single file ReactComponent.tsx.

When I open VSCode I get the error, as well as whenever I restart the JS/TS language server.

The error disappears when I disable the Astro extension.


VSCode version information:

Version: 1.90.1
Commit: 611f9bfce64f25108829dd295f54a6894e87339d
Date: 2024-06-11T21:44:54.914Z (4 days ago)
Electron: 29.4.0
ElectronBuildId: 9593362
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.1.0


Astro extension information:

Version: v2.10.2

@Princesseuh

@ryan-saffer
Copy link

ryan-saffer commented Jun 17, 2024

馃帀 Issue Identified

After some digging around further, I was able to resolve this problem by telling VS Code to use the workspace version of Typescript instead of VS Code's version.

On my machine, the VS Code version is 5.1.6. When I initialised an empty Astro project using npm create astro@latest, it initialised a project with a dependency in my package.json of "typescript": "^5.4.5".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue needs a reproduction
Projects
None yet
Development

No branches or pull requests

10 participants