a-h / templ

A language for writing HTML user interfaces in Go.
https://templ.guide/
MIT License
7.14k stars 236 forks source link

I am getting error with templ-vscode extension #806

Closed MukundSinghRajput closed 1 week ago

MukundSinghRajput commented 1 week ago

[Error - 9:26:38 PM] Server process exited with code 1. [Error - 9:26:38 PM] Server initialization failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 9:26:38 PM] Connection to server got closed. Server will not be restarted. [Error - 9:26:38 PM] templ client: couldn't create connection to server. Message: Pending response rejected since connection got disposed Code: -32097

burstman commented 1 week ago

[Info - 19:45:01] 2024/06/24 19:45:01 Created View (#1) directory=/home/hamed/goFullStack view_type="GoMod" root_dir="file:///home/hamed/goFullStack" go_version="go version go1.22.3 linux/amd64" build_flags=[] env={GOOS:linux GOARCH:amd64 GOCACHE:/home/hamed/.cache/go-build GOMODCACHE:/home/hamed/go/pkg/mod GOPATH:/home/hamed/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.3 linux/amd64 ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:} env_overlay=[]

[Info - 19:45:01] 2024/06/24 19:45:01 go/packages.Load #1 view_id="1" snapshot=0 directory=/home/hamed/goFullStack query=[/home/hamed/goFullStack/... builtin] packages=5 duration=537.215806ms

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x87a740]

goroutine 34 [running]: github.com/a-h/templ/cmd/templ/lspcmd/proxy.(*Server).CodeAction(0xc00007e4b0, {0xa55250, 0xc0002d0910}, 0xc00030b740) /home/hamed/go/pkg/mod/github.com/a-h/templ@v0.2.707/cmd/templ/lspcmd/proxy/server.go:294 +0x480 github.com/a-h/protocol.serverDispatch({0xa55250, 0xc0002d0910}, {0xa5b300, 0xc00007e4b0}, 0xc0003117a0, {0xa55528, 0xc0002ab7c0}) /home/hamed/go/pkg/mod/github.com/a-h/protocol@v0.0.0-20230224160810-b4eec67c1c22/server.go:158 +0x4013 github.com/a-h/protocol.NewServer.ServerHandler.func1({0xa55250, 0xc0002d0910}, 0xc0003117a0, {0xa55528, 0xc0002ab7c0}) /home/hamed/go/pkg/mod/github.com/a-h/protocol@v0.0.0-20230224160810-b4eec67c1c22/server.go:36 +0x7e github.com/a-h/protocol.Handlers.ReplyHandler.func1({0xa55250, 0xc0002d0910}, 0xc00032e120, {0xa55528, 0xc0002ab7c0}) /home/hamed/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/handler.go:35 +0xc6 github.com/a-h/protocol.Handlers.AsyncHandler.func2.2() /home/hamed/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/handler.go:114 +0x76 created by github.com/a-h/protocol.Handlers.AsyncHandler.func2 in goroutine 11 /home/hamed/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/handler.go:112 +0x165 [Error - 19:45:02] Server process exited with code 2. [Error - 19:45:02] Connection to server got closed. Server will not be restarted.

advdv commented 1 week ago

Probably: https://github.com/a-h/templ/issues/800

MukundSinghRajput commented 1 week ago

@advdv I switched to older version gopls still getting the same error i have restarted my pc too

advdv commented 1 week ago

Sorry, I can't help you past that point. You'll have to dig deeper yourself

joerdav commented 1 week ago

@MukundSinghRajput please try installing templ from the main branch go install github.com/a-h/templ/cmd/templ@main If this works then the next release will solve this for you.

MukundSinghRajput commented 1 week ago

Thanks @advdv @joerdav i think it was some issue with my go download i reinstall go now templ is working fine i install older version of gopls not any error till now i hope it would be fine :)

a-h commented 1 week ago

Fixed in https://github.com/a-h/templ/releases/tag/v0.2.731