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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v0.2.717] error: column is beyond end of line #801

Closed
saada opened this issue Jun 22, 2024 · 28 comments · Fixed by #817
Closed

[v0.2.717] error: column is beyond end of line #801

saada opened this issue Jun 22, 2024 · 28 comments · Fixed by #817

Comments

@saada
Copy link

saada commented Jun 22, 2024

Getting this error in vscode output

[Error - 9:37:49 PM] Request textDocument/codeAction failed.
  Message: column is beyond end of line
  Code: 0 

I'm running a patch version to work around the upcoming fix for the panic

❯ templ --version
v0.2.717

Is there any way I could get a nice stacktrace so that I can find which file and what is causing this particular error?
I don't even know which template to share because I don't know what is causing the error.

Thank you

@joerdav
Copy link
Collaborator

joerdav commented Jun 22, 2024

Hi, thanks for the bug report, we have a guide on troubleshooting, if you follow this then you should end up with some more logs to help diagnose: https://templ.guide/commands-and-tools/ide-support#troubleshooting-1

@valentimarco
Copy link
Contributor

valentimarco commented Jun 22, 2024

For some reason, the plugin creates an empty log file.
Here my log (Using the latest commit because of #800 ):

[Info  - 12:41:42] 2024/06/22 12:41:42 Created View (#1)
	directory=/home/marco/Documents/vscode/website
	view_type="GoMod"
	root_dir="file:///home/marco/Documents/vscode/website"
	go_version="go version go1.22.4 linux/amd64"
	build_flags=[]
	env={GOOS:linux GOARCH:amd64 GOCACHE:/home/marco/.cache/go-build GOMODCACHE:/home/marco/go/pkg/mod GOPATH:/home/marco/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.4 linux/amd64
 ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}
	env_overlay=[]

[Info  - 12:41:43] 2024/06/22 12:41:43 go/packages.Load #1
	view_id="1"
	snapshot=0
	directory=/home/marco/Documents/vscode/website
	query=[/home/marco/Documents/vscode/website/... builtin]
	packages=12
	duration=200.058423ms

[Error - 12:41:47] Request textDocument/codeAction failed.
  Message: column is beyond end of line
  Code: 0 
[Error - 12:42:04] Request textDocument/codeAction failed.
  Message: column is beyond end of line
  Code: 0 
[Info  - 12:42:13] 2024/06/22 12:42:13 background imports cache refresh starting

[Info  - 12:42:13] 2024/06/22 12:42:13 background refresh finished after 204.122742ms

@advdv
Copy link

advdv commented Jun 24, 2024

I'm running into the same issue, also running the latest commit because of the LSP crashing.

It happens with this simple template ( think the Doctype triggers it ).

package main

templ hello(name string) {
	<!doctype html>

 	<html lang="en"></html>
}

I've ran the diagnostics steps, these are my logs ~/templ.log.

{"level":"info","ts":"2024-06-24T20:55:17+02:00","caller":"lspcmd/main.go:76","msg":"lsp: starting up..."}
{"level":"info","ts":"2024-06-24T20:55:17+02:00","caller":"lspcmd/main.go:83","msg":"lsp: starting gopls..."}
{"level":"info","ts":"2024-06-24T20:55:17+02:00","caller":"lspcmd/main.go:96","msg":"creating gopls client"}
{"level":"info","ts":"2024-06-24T20:55:17+02:00","caller":"lspcmd/main.go:101","msg":"creating proxy"}
{"level":"info","ts":"2024-06-24T20:55:17+02:00","caller":"lspcmd/main.go:106","msg":"creating templ server"}
{"level":"info","ts":"2024-06-24T20:55:17+02:00","caller":"lspcmd/main.go:116","msg":"starting debug http server","addr":"localhost:7575"}
{"level":"info","ts":"2024-06-24T20:55:17+02:00","caller":"lspcmd/main.go:125","msg":"listening"}
{"level":"info","ts":"2024-06-24T20:55:17+02:00","caller":"proxy/server.go:207","msg":"client -> server: Initialize"}
{"level":"info","ts":"2024-06-24T20:55:17+02:00","caller":"proxy/server.go:237","msg":"client -> server: Initialize end"}
{"level":"info","ts":"2024-06-24T20:55:17+02:00","caller":"proxy/server.go:241","msg":"client -> server: Initialized"}
{"level":"info","ts":"2024-06-24T20:55:17+02:00","caller":"proxy/server.go:243","msg":"client -> server: Initialized end"}
{"level":"info","ts":"2024-06-24T20:55:17+02:00","caller":"proxy/client.go:42","msg":"client <- server: WorkDoneProgressCreate"}
{"level":"info","ts":"2024-06-24T20:55:17+02:00","caller":"proxy/client.go:38","msg":"client <- server: Progress"}
{"level":"info","ts":"2024-06-24T20:55:17+02:00","caller":"proxy/client.go:136","msg":"client <- server: Configuration"}
{"level":"info","ts":"2024-06-24T20:55:17+02:00","caller":"proxy/client.go:47","msg":"client <- server: LogMessage","message":"2024/06/24 20:55:17 Created View (#1)\n\tdirectory=/Users/adam/Documents/Projects/github.com/crewlinker/atsboards\n\tview_type=\"GoMod\"\n\troot_dir=\"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards\"\n\tgo_version=\"go version go1.22.3 darwin/arm64\"\n\tbuild_flags=[]\n\tenv={GOOS:darwin GOARCH:arm64 GOCACHE:/Users/adam/Library/Caches/go-build GOMODCACHE:/Users/adam/go/pkg/mod GOPATH:/Users/adam/go GOPRIVATE:github.com/crewlinker/atscqrs GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.3 darwin/arm64\n ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}\n\tenv_overlay=[]\n"}
{"level":"info","ts":"2024-06-24T20:55:18+02:00","caller":"proxy/client.go:47","msg":"client <- server: LogMessage","message":"2024/06/24 20:55:18 go/packages.Load #1\n\tview_id=\"1\"\n\tsnapshot=0\n\tdirectory=/Users/adam/Documents/Projects/github.com/crewlinker/atsboards\n\tquery=[/Users/adam/Documents/Projects/github.com/crewlinker/atsboards/... builtin]\n\tpackages=3\n\tduration=307.279167ms\n"}
{"level":"info","ts":"2024-06-24T20:55:18+02:00","caller":"proxy/client.go:38","msg":"client <- server: Progress"}
{"level":"info","ts":"2024-06-24T20:55:18+02:00","caller":"proxy/client.go:121","msg":"client <- server: RegisterCapability"}
{"level":"info","ts":"2024-06-24T20:55:18+02:00","caller":"proxy/client.go:121","msg":"client <- server: RegisterCapability"}
{"level":"info","ts":"2024-06-24T20:55:19+02:00","caller":"proxy/server.go:271","msg":"client -> server: SetTrace"}
{"level":"info","ts":"2024-06-24T20:55:19+02:00","caller":"proxy/server.go:273","msg":"client -> server: SetTrace end"}
{"level":"info","ts":"2024-06-24T20:55:19+02:00","caller":"proxy/server.go:577","msg":"client -> server: DidChangeConfiguration"}
{"level":"info","ts":"2024-06-24T20:55:19+02:00","caller":"proxy/server.go:579","msg":"client -> server: DidChangeConfiguration end"}
{"level":"info","ts":"2024-06-24T20:55:19+02:00","caller":"proxy/client.go:136","msg":"client <- server: Configuration"}
{"level":"info","ts":"2024-06-24T20:55:19+02:00","caller":"proxy/client.go:136","msg":"client <- server: Configuration"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:610","msg":"client -> server: DidOpen","uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main.templ"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:634","msg":"setting source map cache contents","uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main.templ"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:641","msg":"client -> server: DidOpen end"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:277","msg":"client -> server: CodeAction"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/client.go:52","msg":"client <- server: PublishDiagnostics"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:307","msg":"client -> server: CodeAction end"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:711","msg":"client -> server: DocumentSymbol"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:715","msg":"client -> server: DocumentSymbol end"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:682","msg":"client -> server: DocumentLink","uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main.templ"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:684","msg":"client -> server: DocumentLink end"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:725","msg":"client -> server: FoldingRanges"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:729","msg":"client -> server: FoldingRanges end"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:311","msg":"client -> server: CodeLens"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:324","msg":"client -> server: CodeLens end"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:277","msg":"client -> server: CodeAction"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:287","msg":"client -> server: CodeAction end"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:711","msg":"client -> server: DocumentSymbol"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:715","msg":"client -> server: DocumentSymbol end"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:725","msg":"client -> server: FoldingRanges"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:729","msg":"client -> server: FoldingRanges end"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:311","msg":"client -> server: CodeLens"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:324","msg":"client -> server: CodeLens end"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:277","msg":"client -> server: CodeAction"}
{"level":"info","ts":"2024-06-24T20:55:24+02:00","caller":"proxy/server.go:307","msg":"client -> server: CodeAction end"}
{"level":"info","ts":"2024-06-24T20:55:25+02:00","caller":"proxy/client.go:52","msg":"client <- server: PublishDiagnostics"}
{"level":"info","ts":"2024-06-24T20:55:25+02:00","caller":"proxy/client.go:59","msg":"client <- server: PublishDiagnostics: [0]","diagnostic":{"range":{"start":{"line":19,"character":31},"end":{"line":19,"character":48}},"severity":4,"code":"default","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/infertypeargs"},"source":"infertypeargs","message":"unnecessary type arguments","tags":[1]}}
{"level":"error","ts":"2024-06-24T20:55:25+02:00","caller":"proxy/client.go:65","msg":"unable to complete because the sourcemap for the URI doesn't exist in the cache","uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main.go.templ","stacktrace":"github.com/a-h/templ/cmd/templ/lspcmd/proxy.Client.PublishDiagnostics\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.708-0.20240622185712-6c508309ccb1/cmd/templ/lspcmd/proxy/client.go:65\ngit.luolix.top/a-h/protocol.clientDispatch\n\t/Users/adam/go/pkg/mod/github.com/a-h/protocol@v0.0.0-20230224160810-b4eec67c1c22/client.go:102\ngit.luolix.top/a-h/protocol.NewClient.ClientHandler.func1\n\t/Users/adam/go/pkg/mod/github.com/a-h/protocol@v0.0.0-20230224160810-b4eec67c1c22/client.go:36\ngit.luolix.top/a-h/protocol.Handlers.ReplyHandler.func1\n\t/Users/adam/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/handler.go:35\ngit.luolix.top/a-h/protocol.Handlers.AsyncHandler.func2.2\n\t/Users/adam/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/handler.go:114"}

And this is my ~/gopls.log:

[Trace - 20:55:17.623 PM] Sending request 'initialize - (1)'.
Params: {"processId":82233,"clientInfo":{"name":"Visual Studio Code","version":"1.90.2"},"locale":"en","rootPath":"/Users/adam/Documents/Projects/github.com/crewlinker/atsboards","rootUri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"failureHandling":"textOnlyTransactional","resourceOperations":["create","rename","delete"],"normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":true}},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"tagSupport":{"valueSet":[1]}},"executeCommand":{"dynamicRegistration":true},"workspaceFolders":true,"configuration":true,"semanticTokens":{"refreshSupport":true},"codeLens":{"refreshSupport":true},"fileOperations":{"dynamicRegistration":true,"didCreate":true,"willCreate":true,"didRename":true,"willRename":true,"didDelete":true,"willDelete":true}},"textDocument":{"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true,"tagSupport":{"valueSet":[1]},"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"insertTextModeSupport":{"valueSet":[1,2]}},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]},"contextSupport":true},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true},"activeParameterSupport":true},"contextSupport":true},"declaration":{"dynamicRegistration":true,"linkSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true,"tagSupport":{"valueSet":[1]},"labelSupport":true},"codeAction":{"dynamicRegistration":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"isPreferredSupport":true,"disabledSupport":true,"dataSupport":true,"resolveSupport":{"properties":["edit"]},"honorsChangeAnnotations":true},"codeLens":{"dynamicRegistration":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"colorProvider":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"publishDiagnostics":{"relatedInformation":true,"tagSupport":{"valueSet":[1,2]},"codeDescriptionSupport":true,"dataSupport":true},"rename":{"dynamicRegistration":true,"prepareSupport":true,"prepareSupportDefaultBehavior":1,"honorsChangeAnnotations":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"selectionRange":{"dynamicRegistration":true},"callHierarchy":{"dynamicRegistration":true},"semanticTokens":{"dynamicRegistration":true,"requests":{"range":true,"full":{"delta":true}},"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator","decorator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats":["relative"]},"linkedEditingRange":{"dynamicRegistration":true}},"window":{"workDoneProgress":true,"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"showDocument":{"support":true}},"general":{"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"markdown":{"parser":"marked","version":"1.1.0"}}},"trace":"off","workspaceFolders":[{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards","name":"atsboards"}]}


[Trace - 20:55:17.626 PM] Received response 'initialize - (1)' in 2ms.
Result: {"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"completionProvider":{"triggerCharacters":["."]},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor.extract","refactor.inline","refactor.rewrite","source.assembly","source.doc","source.fixAll","source.freesymbols","source.organizeImports"],"resolveProvider":true},"codeLensProvider":{},"documentLinkProvider":{},"workspaceSymbolProvider":true,"documentFormattingProvider":true,"renameProvider":{"prepareProvider":true},"foldingRangeProvider":true,"selectionRangeProvider":true,"executeCommandProvider":{"commands":["gopls.add_dependency","gopls.add_import","gopls.add_telemetry_counters","gopls.apply_fix","gopls.assembly","gopls.change_signature","gopls.check_upgrades","gopls.diagnose_files","gopls.doc","gopls.edit_go_directive","gopls.fetch_vulncheck_result","gopls.free_symbols","gopls.gc_details","gopls.generate","gopls.go_get_package","gopls.list_imports","gopls.list_known_packages","gopls.maybe_prompt_for_telemetry","gopls.mem_stats","gopls.regenerate_cgo","gopls.remove_dependency","gopls.reset_go_mod_diagnostics","gopls.run_go_work_command","gopls.run_govulncheck","gopls.run_tests","gopls.scan_imports","gopls.start_debugging","gopls.start_profile","gopls.stop_profile","gopls.test","gopls.tidy","gopls.toggle_gc_details","gopls.update_go_sum","gopls.upgrade_dependency","gopls.vendor","gopls.views","gopls.workspace_stats"]},"callHierarchyProvider":true,"semanticTokensProvider":{"legend":{"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator","decorator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"]},"range":true,"full":true},"inlayHintProvider":{},"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"}}},"serverInfo":{"name":"gopls","version":"{\"GoVersion\":\"go1.22.3\",\"Path\":\"golang.org/x/tools/gopls\",\"Main\":{\"Path\":\"golang.org/x/tools/gopls\",\"Version\":\"v0.16.0\",\"Sum\":\"h1:JOYR1NabC699+pLFI02CxlD9xaPXdaVmPp7f01k0/hE=\",\"Replace\":null},\"Deps\":[{\"Path\":\"github.com/BurntSushi/toml\",\"Version\":\"v1.2.1\",\"Sum\":\"h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=\",\"Replace\":null},{\"Path\":\"github.com/google/go-cmp\",\"Version\":\"v0.6.0\",\"Sum\":\"h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=\",\"Replace\":null},{\"Path\":\"golang.org/x/exp/typeparams\",\"Version\":\"v0.0.0-20221212164502-fae10dda9338\",\"Sum\":\"h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=\",\"Replace\":null},{\"Path\":\"golang.org/x/mod\",\"Version\":\"v0.18.0\",\"Sum\":\"h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=\",\"Replace\":null},{\"Path\":\"golang.org/x/sync\",\"Version\":\"v0.7.0\",\"Sum\":\"h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=\",\"Replace\":null},{\"Path\":\"golang.org/x/telemetry\",\"Version\":\"v0.0.0-20240607193123-221703e18637\",\"Sum\":\"h1:3Wt8mZlbFwG8llny+t18kh7AXxyWePFycXMuVdHxnyM=\",\"Replace\":null},{\"Path\":\"golang.org/x/text\",\"Version\":\"v0.16.0\",\"Sum\":\"h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=\",\"Replace\":null},{\"Path\":\"golang.org/x/tools\",\"Version\":\"v0.22.1-0.20240620150659-cb3016b76f3e\",\"Sum\":\"h1:Cht5EwNRmW9EgQ7ihPmgIswaQW4jR1cPbmzGCNl2++8=\",\"Replace\":null},{\"Path\":\"golang.org/x/vuln\",\"Version\":\"v1.0.4\",\"Sum\":\"h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I=\",\"Replace\":null},{\"Path\":\"honnef.co/go/tools\",\"Version\":\"v0.4.7\",\"Sum\":\"h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs=\",\"Replace\":null},{\"Path\":\"mvdan.cc/gofumpt\",\"Version\":\"v0.6.0\",\"Sum\":\"h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo=\",\"Replace\":null},{\"Path\":\"mvdan.cc/xurls/v2\",\"Version\":\"v2.5.0\",\"Sum\":\"h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=\",\"Replace\":null}],\"Settings\":[{\"Key\":\"-buildmode\",\"Value\":\"exe\"},{\"Key\":\"-compiler\",\"Value\":\"gc\"},{\"Key\":\"DefaultGODEBUG\",\"Value\":\"httplaxcontentlength=1,httpmuxgo121=1,panicnil=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1\"},{\"Key\":\"CGO_ENABLED\",\"Value\":\"1\"},{\"Key\":\"CGO_CFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_CPPFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_CXXFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_LDFLAGS\",\"Value\":\"\"},{\"Key\":\"GOARCH\",\"Value\":\"arm64\"},{\"Key\":\"GOOS\",\"Value\":\"darwin\"}],\"Version\":\"v0.16.0\"}"}}


[Trace - 20:55:17.628 PM] Sending notification 'initialized'.
Params: {}


[Trace - 20:55:17.629 PM] Received request 'window/workDoneProgress/create - (1)'.
Params: {"token":"3789041339378010932"}


[Trace - 20:55:17.631 PM] Sending response 'window/workDoneProgress/create - (1)' in 1ms.
Result: 


[Trace - 20:55:17.631 PM] Received notification '$/progress'.
Params: {"token":"3789041339378010932","value":{"kind":"begin","title":"Setting up workspace","message":"Loading packages..."}}


[Trace - 20:55:17.631 PM] Received request 'workspace/configuration - (2)'.
Params: {"items":[{"scopeUri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards","section":"gopls"}]}


[Trace - 20:55:17.814 PM] Sending response 'workspace/configuration - (2)' in 183ms.
Result: [{}]


[Trace - 20:55:17.860 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2024/06/24 20:55:17 Created View (#1)\n\tdirectory=/Users/adam/Documents/Projects/github.com/crewlinker/atsboards\n\tview_type=\"GoMod\"\n\troot_dir=\"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards\"\n\tgo_version=\"go version go1.22.3 darwin/arm64\"\n\tbuild_flags=[]\n\tenv={GOOS:darwin GOARCH:arm64 GOCACHE:/Users/adam/Library/Caches/go-build GOMODCACHE:/Users/adam/go/pkg/mod GOPATH:/Users/adam/go GOPRIVATE:github.com/crewlinker/atscqrs GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.3 darwin/arm64\n ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}\n\tenv_overlay=[]\n"}


[Trace - 20:55:18.167 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2024/06/24 20:55:18 go/packages.Load #1\n\tview_id=\"1\"\n\tsnapshot=0\n\tdirectory=/Users/adam/Documents/Projects/github.com/crewlinker/atsboards\n\tquery=[/Users/adam/Documents/Projects/github.com/crewlinker/atsboards/... builtin]\n\tpackages=3\n\tduration=307.279167ms\n"}


[Trace - 20:55:18.204 PM] Received notification '$/progress'.
Params: {"token":"3789041339378010932","value":{"kind":"end","message":"Finished loading packages."}}


[Trace - 20:55:18.205 PM] Received request 'client/registerCapability - (3)'.
Params: {"registrations":[{"id":"workspace/didChangeWatchedFiles-0","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"**/*.{mod,work}","kind":7},{"globPattern":"/Users/adam/Documents/Projects/github.com/crewlinker/atsboards/**/*.{go,mod,sum,work}","kind":7},{"globPattern":"/Users/adam/Documents/Projects/github.com/crewlinker/atsboards","kind":7},{"globPattern":"/Users/adam/Documents/Projects/github.com/crewlinker/atsboards/magefiles","kind":7}]}}]}


[Trace - 20:55:18.208 PM] Sending response 'client/registerCapability - (3)' in 2ms.
Result: 


[Trace - 20:55:18.208 PM] Received request 'client/registerCapability - (4)'.
Params: {"registrations":[{"id":"workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"}]}


[Trace - 20:55:18.209 PM] Sending response 'client/registerCapability - (4)' in 0ms.
Result: 


[Trace - 20:55:19.280 PM] Sending notification '$/setTrace'.
Params: {"value":"off"}


[Trace - 20:55:19.280 PM] Sending notification 'workspace/didChangeConfiguration'.
Params: {}


[Trace - 20:55:19.281 PM] Received request 'workspace/configuration - (5)'.
Params: {"items":[{"section":"gopls"}]}


[Trace - 20:55:19.295 PM] Sending response 'workspace/configuration - (5)' in 14ms.
Result: [{}]


[Trace - 20:55:19.295 PM] Received request 'workspace/configuration - (6)'.
Params: {"items":[{"scopeUri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards","section":"gopls"}]}


[Trace - 20:55:19.297 PM] Sending response 'workspace/configuration - (6)' in 1ms.
Result: [{}]


[Trace - 20:55:24.135 PM] Sending notification 'textDocument/didOpen'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main_templ.go","languageId":"templ","version":1,"text":"// Code generated by templ - DO NOT EDIT.\n\npackage main\n\n//lint:file-ignore SA4006 This context is only used if a nested component is present.\n\nimport \"github.com/a-h/templ\"\nimport templruntime \"github.com/a-h/templ/runtime\"\n\nfunc hello(name string) templ.Component {\n\treturn templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {\n\t\ttempl_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context\n\t\ttempl_7745c5c3_Buffer, templ_7745c5c3_IsBuffer, templ_7745c5c3_Release := templruntime.WriterToBuffer(templ_7745c5c3_W)\n\t\tdefer templ_7745c5c3_Release()\n\t\tctx = templ.InitializeContext(ctx)\n\t\ttempl_7745c5c3_Var1 := templ.GetChildren(ctx)\n\t\tif templ_7745c5c3_Var1 == nil {\n\t\t\ttempl_7745c5c3_Var1 = templ.NopComponent\n\t\t}\n\t\tctx = templ.ClearChildren(ctx)\n\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(\"\u003c!doctype html\u003e\u003chtml lang=\\\"en\\\"\u003e\u003chead\u003e\u003cmeta charset=\\\"UTF-8\\\"\u003e\u003cmeta http-equiv=\\\"X-UA-Compatible\\\" content=\\\"IE=edge\\\"\u003e\u003cmeta name=\\\"viewport\\\" content=\\\"width=device-width, initial-scale=1.0\\\"\u003e\u003ctitle\u003e\")\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn templ_7745c5c3_Err\n\t\t}\n\t\tvar templ_7745c5c3_Var2 string\n\t\ttempl_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(name)\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn\ttempl.Error{Err: templ_7745c5c3_Err, FileName: ``, Line: 11, Col: 16}\n\t\t}\n\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn templ_7745c5c3_Err\n\t\t}\n\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(\"\u003c/title\u003e\u003c/head\u003e\u003cbody\u003eHello, \")\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn templ_7745c5c3_Err\n\t\t}\n\t\tvar templ_7745c5c3_Var3 string\n\t\ttempl_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(name)\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn\ttempl.Error{Err: templ_7745c5c3_Err, FileName: ``, Line: 13, Col: 21}\n\t\t}\n\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn templ_7745c5c3_Err\n\t\t}\n\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(\"\u003c/body\u003e\u003c/html\u003e\")\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn templ_7745c5c3_Err\n\t\t}\n\t\tif !templ_7745c5c3_IsBuffer {\n\t\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)\n\t\t}\n\t\treturn templ_7745c5c3_Err\n\t})\n}\n"}}


[Trace - 20:55:24.146 PM] Sending request 'textDocument/codeAction - (2)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main_templ.go"},"context":{"diagnostics":[]},"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}}}


[Trace - 20:55:24.195 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main_templ.go","version":1,"diagnostics":[]}


[Trace - 20:55:24.195 PM] Received response 'textDocument/codeAction - (2)' in 49ms.
Result: [{"title":"Browse documentation for package main","kind":"source.doc","command":{"title":"Browse documentation for package main","command":"gopls.doc","arguments":[{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main_templ.go","range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}}}]}}]


[Trace - 20:55:24.388 PM] Sending request 'textDocument/codeLens - (3)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main_templ.go"}}


[Trace - 20:55:24.388 PM] Received response 'textDocument/codeLens - (3)' in 0ms.
Result: null


[Trace - 20:55:24.390 PM] Sending request 'textDocument/codeAction - (4)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main_templ.go"},"context":{"diagnostics":[]},"range":{"start":{"line":2,"character":26},"end":{"line":2,"character":26}}}


[Error - Received] 20:55:24.390 PM #4 column is beyond end of line


[Trace - 20:55:24.652 PM] Sending request 'textDocument/codeLens - (5)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main_templ.go"}}


[Trace - 20:55:24.653 PM] Received response 'textDocument/codeLens - (5)' in 0ms.
Result: null


[Trace - 20:55:24.653 PM] Sending request 'textDocument/codeAction - (6)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main_templ.go"},"context":{"diagnostics":[]},"range":{"start":{"line":10,"character":25},"end":{"line":10,"character":25}}}


[Trace - 20:55:24.654 PM] Received response 'textDocument/codeAction - (6)' in 0ms.
Result: [{"title":"Browse documentation for func runtime.GeneratedTemplate","kind":"source.doc","command":{"title":"Browse documentation for func runtime.GeneratedTemplate","command":"gopls.doc","arguments":[{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main_templ.go","range":{"start":{"line":10,"character":25},"end":{"line":10,"character":25}}}]}},{"title":"Browse arm64 assembly for hello","kind":"source.assembly","command":{"title":"Browse arm64 assembly for hello","command":"gopls.assembly","arguments":["1","github.com/crewlinker/atsboards","main.hello"]}}]


[Trace - 20:55:25.231 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main.go","diagnostics":[{"range":{"start":{"line":19,"character":31},"end":{"line":19,"character":48}},"severity":4,"code":"default","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/infertypeargs"},"source":"infertypeargs","message":"unnecessary type arguments","tags":[1]}]}


[Trace - 20:55:46.860 PM] Sending request 'textDocument/codeLens - (7)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main_templ.go"}}


[Trace - 20:55:46.861 PM] Received response 'textDocument/codeLens - (7)' in 1ms.
Result: null


[Trace - 20:55:47.973 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2024/06/24 20:55:47 background imports cache refresh starting\n"}


[Trace - 20:55:49.833 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2024/06/24 20:55:49 background refresh finished after 1.973192125s\n"}


[Trace - 20:56:00.703 PM] Sending request 'textDocument/codeLens - (8)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/atsboards/main_templ.go"}}


[Trace - 20:56:00.704 PM] Received response 'textDocument/codeLens - (8)' in 0ms.
Result: null

@joerdav
Copy link
Collaborator

joerdav commented Jun 25, 2024

@advdv These logs are interesting. It seems that a publish diagnostic notification is being triggered for a go file main.go. With your minimal reproduction I'm not getting the same error, are there any other files in your repo?

@advdv
Copy link

advdv commented Jun 25, 2024

@joerdav I've setup a full repo that triggers the error for me: https://github.com/crewlinker/templ-reproduce

golang.org/x/tools/gopls v0.16.0
go version go1.22.3 darwin/arm64
vscode Version: 1.90.2 (Universal)

Logs with this project:

[Trace - 16:20:31.818 PM] Sending request 'initialize - (1)'.
Params: {"processId":7571,"clientInfo":{"name":"Visual Studio Code","version":"1.90.2"},"locale":"en","rootPath":"/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce","rootUri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"failureHandling":"textOnlyTransactional","resourceOperations":["create","rename","delete"],"normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":true}},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"tagSupport":{"valueSet":[1]}},"executeCommand":{"dynamicRegistration":true},"workspaceFolders":true,"configuration":true,"semanticTokens":{"refreshSupport":true},"codeLens":{"refreshSupport":true},"fileOperations":{"dynamicRegistration":true,"didCreate":true,"willCreate":true,"didRename":true,"willRename":true,"didDelete":true,"willDelete":true}},"textDocument":{"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true,"tagSupport":{"valueSet":[1]},"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"insertTextModeSupport":{"valueSet":[1,2]}},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]},"contextSupport":true},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true},"activeParameterSupport":true},"contextSupport":true},"declaration":{"dynamicRegistration":true,"linkSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true,"tagSupport":{"valueSet":[1]},"labelSupport":true},"codeAction":{"dynamicRegistration":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"isPreferredSupport":true,"disabledSupport":true,"dataSupport":true,"resolveSupport":{"properties":["edit"]},"honorsChangeAnnotations":true},"codeLens":{"dynamicRegistration":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"colorProvider":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"publishDiagnostics":{"relatedInformation":true,"tagSupport":{"valueSet":[1,2]},"codeDescriptionSupport":true,"dataSupport":true},"rename":{"dynamicRegistration":true,"prepareSupport":true,"prepareSupportDefaultBehavior":1,"honorsChangeAnnotations":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"selectionRange":{"dynamicRegistration":true},"callHierarchy":{"dynamicRegistration":true},"semanticTokens":{"dynamicRegistration":true,"requests":{"range":true,"full":{"delta":true}},"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator","decorator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats":["relative"]},"linkedEditingRange":{"dynamicRegistration":true}},"window":{"workDoneProgress":true,"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"showDocument":{"support":true}},"general":{"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"markdown":{"parser":"marked","version":"1.1.0"}}},"trace":"off","workspaceFolders":[{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce","name":"templ-reproduce"}]}


[Trace - 16:20:31.825 PM] Received response 'initialize - (1)' in 6ms.
Result: {"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"completionProvider":{"triggerCharacters":["."]},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor.extract","refactor.inline","refactor.rewrite","source.assembly","source.doc","source.fixAll","source.freesymbols","source.organizeImports"],"resolveProvider":true},"codeLensProvider":{},"documentLinkProvider":{},"workspaceSymbolProvider":true,"documentFormattingProvider":true,"renameProvider":{"prepareProvider":true},"foldingRangeProvider":true,"selectionRangeProvider":true,"executeCommandProvider":{"commands":["gopls.add_dependency","gopls.add_import","gopls.add_telemetry_counters","gopls.apply_fix","gopls.assembly","gopls.change_signature","gopls.check_upgrades","gopls.diagnose_files","gopls.doc","gopls.edit_go_directive","gopls.fetch_vulncheck_result","gopls.free_symbols","gopls.gc_details","gopls.generate","gopls.go_get_package","gopls.list_imports","gopls.list_known_packages","gopls.maybe_prompt_for_telemetry","gopls.mem_stats","gopls.regenerate_cgo","gopls.remove_dependency","gopls.reset_go_mod_diagnostics","gopls.run_go_work_command","gopls.run_govulncheck","gopls.run_tests","gopls.scan_imports","gopls.start_debugging","gopls.start_profile","gopls.stop_profile","gopls.test","gopls.tidy","gopls.toggle_gc_details","gopls.update_go_sum","gopls.upgrade_dependency","gopls.vendor","gopls.views","gopls.workspace_stats"]},"callHierarchyProvider":true,"semanticTokensProvider":{"legend":{"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator","decorator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"]},"range":true,"full":true},"inlayHintProvider":{},"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"}}},"serverInfo":{"name":"gopls","version":"{\"GoVersion\":\"go1.22.3\",\"Path\":\"golang.org/x/tools/gopls\",\"Main\":{\"Path\":\"golang.org/x/tools/gopls\",\"Version\":\"v0.16.0\",\"Sum\":\"h1:JOYR1NabC699+pLFI02CxlD9xaPXdaVmPp7f01k0/hE=\",\"Replace\":null},\"Deps\":[{\"Path\":\"github.com/BurntSushi/toml\",\"Version\":\"v1.2.1\",\"Sum\":\"h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=\",\"Replace\":null},{\"Path\":\"github.com/google/go-cmp\",\"Version\":\"v0.6.0\",\"Sum\":\"h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=\",\"Replace\":null},{\"Path\":\"golang.org/x/exp/typeparams\",\"Version\":\"v0.0.0-20221212164502-fae10dda9338\",\"Sum\":\"h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=\",\"Replace\":null},{\"Path\":\"golang.org/x/mod\",\"Version\":\"v0.18.0\",\"Sum\":\"h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=\",\"Replace\":null},{\"Path\":\"golang.org/x/sync\",\"Version\":\"v0.7.0\",\"Sum\":\"h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=\",\"Replace\":null},{\"Path\":\"golang.org/x/telemetry\",\"Version\":\"v0.0.0-20240607193123-221703e18637\",\"Sum\":\"h1:3Wt8mZlbFwG8llny+t18kh7AXxyWePFycXMuVdHxnyM=\",\"Replace\":null},{\"Path\":\"golang.org/x/text\",\"Version\":\"v0.16.0\",\"Sum\":\"h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=\",\"Replace\":null},{\"Path\":\"golang.org/x/tools\",\"Version\":\"v0.22.1-0.20240620150659-cb3016b76f3e\",\"Sum\":\"h1:Cht5EwNRmW9EgQ7ihPmgIswaQW4jR1cPbmzGCNl2++8=\",\"Replace\":null},{\"Path\":\"golang.org/x/vuln\",\"Version\":\"v1.0.4\",\"Sum\":\"h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I=\",\"Replace\":null},{\"Path\":\"honnef.co/go/tools\",\"Version\":\"v0.4.7\",\"Sum\":\"h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs=\",\"Replace\":null},{\"Path\":\"mvdan.cc/gofumpt\",\"Version\":\"v0.6.0\",\"Sum\":\"h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo=\",\"Replace\":null},{\"Path\":\"mvdan.cc/xurls/v2\",\"Version\":\"v2.5.0\",\"Sum\":\"h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=\",\"Replace\":null}],\"Settings\":[{\"Key\":\"-buildmode\",\"Value\":\"exe\"},{\"Key\":\"-compiler\",\"Value\":\"gc\"},{\"Key\":\"DefaultGODEBUG\",\"Value\":\"httplaxcontentlength=1,httpmuxgo121=1,panicnil=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1\"},{\"Key\":\"CGO_ENABLED\",\"Value\":\"1\"},{\"Key\":\"CGO_CFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_CPPFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_CXXFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_LDFLAGS\",\"Value\":\"\"},{\"Key\":\"GOARCH\",\"Value\":\"arm64\"},{\"Key\":\"GOOS\",\"Value\":\"darwin\"}],\"Version\":\"v0.16.0\"}"}}


[Trace - 16:20:31.829 PM] Sending notification 'initialized'.
Params: {}


[Trace - 16:20:31.829 PM] Received request 'window/workDoneProgress/create - (1)'.
Params: {"token":"8868331633499286510"}


[Trace - 16:20:32.013 PM] Sending response 'window/workDoneProgress/create - (1)' in 183ms.
Result: 


[Trace - 16:20:32.013 PM] Received notification '$/progress'.
Params: {"token":"8868331633499286510","value":{"kind":"begin","title":"Setting up workspace","message":"Loading packages..."}}


[Trace - 16:20:32.013 PM] Received request 'workspace/configuration - (2)'.
Params: {"items":[{"scopeUri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce","section":"gopls"}]}


[Trace - 16:20:32.017 PM] Sending response 'workspace/configuration - (2)' in 3ms.
Result: [{}]


[Trace - 16:20:32.111 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2024/06/25 16:20:32 Created View (#1)\n\tdirectory=/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce\n\tview_type=\"GoMod\"\n\troot_dir=\"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce\"\n\tgo_version=\"go version go1.22.3 darwin/arm64\"\n\tbuild_flags=[]\n\tenv={GOOS:darwin GOARCH:arm64 GOCACHE:/Users/adam/Library/Caches/go-build GOMODCACHE:/Users/adam/go/pkg/mod GOPATH:/Users/adam/go GOPRIVATE:github.com/crewlinker/atscqrs GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.3 darwin/arm64\n ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}\n\tenv_overlay=[]\n"}


[Trace - 16:20:32.541 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2024/06/25 16:20:32 go/packages.Load #1\n\tview_id=\"1\"\n\tsnapshot=0\n\tdirectory=/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce\n\tquery=[/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/... builtin]\n\tpackages=2\n\tduration=429.82925ms\n"}


[Trace - 16:20:32.569 PM] Received notification '$/progress'.
Params: {"token":"8868331633499286510","value":{"kind":"end","message":"Finished loading packages."}}


[Trace - 16:20:32.570 PM] Received request 'client/registerCapability - (3)'.
Params: {"registrations":[{"id":"workspace/didChangeWatchedFiles-0","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce","kind":7},{"globPattern":"**/*.{mod,work}","kind":7},{"globPattern":"/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/**/*.{go,mod,sum,work}","kind":7}]}}]}


[Trace - 16:20:32.572 PM] Sending response 'client/registerCapability - (3)' in 2ms.
Result: 


[Trace - 16:20:32.572 PM] Received request 'client/registerCapability - (4)'.
Params: {"registrations":[{"id":"workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"}]}


[Trace - 16:20:32.573 PM] Sending response 'client/registerCapability - (4)' in 0ms.
Result: 


[Trace - 16:20:33.576 PM] Sending notification '$/setTrace'.
Params: {"value":"off"}


[Trace - 16:20:33.580 PM] Sending notification 'workspace/didChangeConfiguration'.
Params: {}


[Trace - 16:20:33.580 PM] Received request 'workspace/configuration - (5)'.
Params: {"items":[{"section":"gopls"}]}


[Trace - 16:20:33.587 PM] Sending response 'workspace/configuration - (5)' in 6ms.
Result: [{}]


[Trace - 16:20:33.587 PM] Received request 'workspace/configuration - (6)'.
Params: {"items":[{"scopeUri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce","section":"gopls"}]}


[Trace - 16:20:33.588 PM] Sending response 'workspace/configuration - (6)' in 0ms.
Result: [{}]


[Trace - 16:20:36.613 PM] Sending notification 'textDocument/didOpen'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go","languageId":"templ","version":1,"text":"// Code generated by templ - DO NOT EDIT.\n\npackage main\n\n//lint:file-ignore SA4006 This context is only used if a nested component is present.\n\nimport \"github.com/a-h/templ\"\nimport templruntime \"github.com/a-h/templ/runtime\"\n\nfunc hello(title, name string) templ.Component {\n\treturn templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {\n\t\ttempl_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context\n\t\ttempl_7745c5c3_Buffer, templ_7745c5c3_IsBuffer, templ_7745c5c3_Release := templruntime.WriterToBuffer(templ_7745c5c3_W)\n\t\tdefer templ_7745c5c3_Release()\n\t\tctx = templ.InitializeContext(ctx)\n\t\ttempl_7745c5c3_Var1 := templ.GetChildren(ctx)\n\t\tif templ_7745c5c3_Var1 == nil {\n\t\t\ttempl_7745c5c3_Var1 = templ.NopComponent\n\t\t}\n\t\tctx = templ.ClearChildren(ctx)\n\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(\"\u003c!doctype html\u003e\u003chtml lang=\\\"en\\\"\u003e\u003chead\u003e\u003ctitle\u003e\")\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn templ_7745c5c3_Err\n\t\t}\n\t\tvar templ_7745c5c3_Var2 string\n\t\ttempl_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title)\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn\ttempl.Error{Err: templ_7745c5c3_Err, FileName: ``, Line: 7, Col: 22}\n\t\t}\n\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn templ_7745c5c3_Err\n\t\t}\n\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(\"\u003c/title\u003e\u003c/head\u003e\u003cbody\u003e\u003cp\u003ehello, \")\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn templ_7745c5c3_Err\n\t\t}\n\t\tvar templ_7745c5c3_Var3 string\n\t\ttempl_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(name)\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn\ttempl.Error{Err: templ_7745c5c3_Err, FileName: ``, Line: 8, Col: 24}\n\t\t}\n\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn templ_7745c5c3_Err\n\t\t}\n\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(\"!\u003c/p\u003e\u003c/body\u003e\u003c/html\u003e\")\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn templ_7745c5c3_Err\n\t\t}\n\t\tif !templ_7745c5c3_IsBuffer {\n\t\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)\n\t\t}\n\t\treturn templ_7745c5c3_Err\n\t})\n}\n"}}


[Trace - 16:20:36.625 PM] Sending request 'textDocument/codeAction - (2)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go"},"context":{"diagnostics":[]},"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}}}


[Trace - 16:20:36.652 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go","version":1,"diagnostics":[]}


[Trace - 16:20:36.652 PM] Received response 'textDocument/codeAction - (2)' in 27ms.
Result: [{"title":"Browse documentation for package main","kind":"source.doc","command":{"title":"Browse documentation for package main","command":"gopls.doc","arguments":[{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go","range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}}}]}}]


[Trace - 16:20:36.866 PM] Sending request 'textDocument/codeLens - (3)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go"}}


[Trace - 16:20:36.866 PM] Received response 'textDocument/codeLens - (3)' in 0ms.
Result: null


[Trace - 16:20:36.869 PM] Sending request 'textDocument/codeAction - (4)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go"},"context":{"diagnostics":[]},"range":{"start":{"line":9,"character":1},"end":{"line":9,"character":1}}}


[Trace - 16:20:36.870 PM] Received response 'textDocument/codeAction - (4)' in 0ms.
Result: [{"title":"Browse documentation for package main","kind":"source.doc","command":{"title":"Browse documentation for package main","command":"gopls.doc","arguments":[{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go","range":{"start":{"line":9,"character":1},"end":{"line":9,"character":1}}}]}},{"title":"Browse arm64 assembly for hello","kind":"source.assembly","command":{"title":"Browse arm64 assembly for hello","command":"gopls.assembly","arguments":["1","github.com/crewlinker/templ-reproduce","main.hello"]}}]


[Trace - 16:20:37.992 PM] Sending request 'textDocument/codeLens - (5)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go"}}


[Trace - 16:20:37.993 PM] Received response 'textDocument/codeLens - (5)' in 0ms.
Result: null


[Trace - 16:20:37.993 PM] Sending request 'textDocument/codeAction - (6)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go"},"context":{"diagnostics":[]},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":8}}}


[Error - Received] 16:20:37.994 PM #6 column is beyond end of line


[Trace - 16:20:38.292 PM] Sending request 'textDocument/codeAction - (7)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go"},"context":{"diagnostics":[]},"range":{"start":{"line":3,"character":16},"end":{"line":3,"character":16}}}


[Error - Received] 16:20:38.293 PM #7 column is beyond end of line


[Trace - 16:20:40.754 PM] Sending request 'textDocument/codeAction - (8)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go"},"context":{"diagnostics":[]},"range":{"start":{"line":10,"character":0},"end":{"line":10,"character":0}}}


[Trace - 16:20:40.755 PM] Received response 'textDocument/codeAction - (8)' in 1ms.
Result: [{"title":"Browse documentation for package main","kind":"source.doc","command":{"title":"Browse documentation for package main","command":"gopls.doc","arguments":[{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go","range":{"start":{"line":10,"character":0},"end":{"line":10,"character":0}}}]}},{"title":"Browse arm64 assembly for hello","kind":"source.assembly","command":{"title":"Browse arm64 assembly for hello","command":"gopls.assembly","arguments":["1","github.com/crewlinker/templ-reproduce","main.hello"]}}]


[Trace - 16:20:40.876 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2024/06/25 16:20:40 Shutdown session\n\tshutdown_session=1\n"}

and

{"level":"info","ts":"2024-06-25T16:20:31+02:00","caller":"lspcmd/main.go:76","msg":"lsp: starting up..."}
{"level":"info","ts":"2024-06-25T16:20:31+02:00","caller":"lspcmd/main.go:83","msg":"lsp: starting gopls..."}
{"level":"info","ts":"2024-06-25T16:20:31+02:00","caller":"lspcmd/main.go:96","msg":"creating gopls client"}
{"level":"info","ts":"2024-06-25T16:20:31+02:00","caller":"lspcmd/main.go:101","msg":"creating proxy"}
{"level":"info","ts":"2024-06-25T16:20:31+02:00","caller":"lspcmd/main.go:106","msg":"creating templ server"}
{"level":"info","ts":"2024-06-25T16:20:31+02:00","caller":"lspcmd/main.go:116","msg":"starting debug http server","addr":"localhost:7575"}
{"level":"info","ts":"2024-06-25T16:20:31+02:00","caller":"lspcmd/main.go:125","msg":"listening"}
{"level":"info","ts":"2024-06-25T16:20:31+02:00","caller":"proxy/server.go:207","msg":"client -> server: Initialize"}
{"level":"info","ts":"2024-06-25T16:20:31+02:00","caller":"proxy/server.go:237","msg":"client -> server: Initialize end"}
{"level":"info","ts":"2024-06-25T16:20:31+02:00","caller":"proxy/server.go:241","msg":"client -> server: Initialized"}
{"level":"info","ts":"2024-06-25T16:20:31+02:00","caller":"proxy/server.go:243","msg":"client -> server: Initialized end"}
{"level":"info","ts":"2024-06-25T16:20:31+02:00","caller":"proxy/client.go:42","msg":"client <- server: WorkDoneProgressCreate"}
{"level":"info","ts":"2024-06-25T16:20:32+02:00","caller":"proxy/client.go:38","msg":"client <- server: Progress"}
{"level":"info","ts":"2024-06-25T16:20:32+02:00","caller":"proxy/client.go:136","msg":"client <- server: Configuration"}
{"level":"info","ts":"2024-06-25T16:20:32+02:00","caller":"proxy/client.go:47","msg":"client <- server: LogMessage","message":"2024/06/25 16:20:32 Created View (#1)\n\tdirectory=/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce\n\tview_type=\"GoMod\"\n\troot_dir=\"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce\"\n\tgo_version=\"go version go1.22.3 darwin/arm64\"\n\tbuild_flags=[]\n\tenv={GOOS:darwin GOARCH:arm64 GOCACHE:/Users/adam/Library/Caches/go-build GOMODCACHE:/Users/adam/go/pkg/mod GOPATH:/Users/adam/go GOPRIVATE:github.com/crewlinker/atscqrs GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.3 darwin/arm64\n ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}\n\tenv_overlay=[]\n"}
{"level":"info","ts":"2024-06-25T16:20:32+02:00","caller":"proxy/client.go:47","msg":"client <- server: LogMessage","message":"2024/06/25 16:20:32 go/packages.Load #1\n\tview_id=\"1\"\n\tsnapshot=0\n\tdirectory=/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce\n\tquery=[/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/... builtin]\n\tpackages=2\n\tduration=429.82925ms\n"}
{"level":"info","ts":"2024-06-25T16:20:32+02:00","caller":"proxy/client.go:38","msg":"client <- server: Progress"}
{"level":"info","ts":"2024-06-25T16:20:32+02:00","caller":"proxy/client.go:121","msg":"client <- server: RegisterCapability"}
{"level":"info","ts":"2024-06-25T16:20:32+02:00","caller":"proxy/client.go:121","msg":"client <- server: RegisterCapability"}
{"level":"info","ts":"2024-06-25T16:20:33+02:00","caller":"proxy/server.go:271","msg":"client -> server: SetTrace"}
{"level":"info","ts":"2024-06-25T16:20:33+02:00","caller":"proxy/server.go:273","msg":"client -> server: SetTrace end"}
{"level":"info","ts":"2024-06-25T16:20:33+02:00","caller":"proxy/server.go:577","msg":"client -> server: DidChangeConfiguration"}
{"level":"info","ts":"2024-06-25T16:20:33+02:00","caller":"proxy/server.go:579","msg":"client -> server: DidChangeConfiguration end"}
{"level":"info","ts":"2024-06-25T16:20:33+02:00","caller":"proxy/client.go:136","msg":"client <- server: Configuration"}
{"level":"info","ts":"2024-06-25T16:20:33+02:00","caller":"proxy/client.go:136","msg":"client <- server: Configuration"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:610","msg":"client -> server: DidOpen","uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main.templ"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:634","msg":"setting source map cache contents","uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main.templ"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:641","msg":"client -> server: DidOpen end"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:277","msg":"client -> server: CodeAction"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/client.go:52","msg":"client <- server: PublishDiagnostics"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:307","msg":"client -> server: CodeAction end"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:711","msg":"client -> server: DocumentSymbol"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:715","msg":"client -> server: DocumentSymbol end"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:682","msg":"client -> server: DocumentLink","uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main.templ"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:684","msg":"client -> server: DocumentLink end"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:725","msg":"client -> server: FoldingRanges"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:729","msg":"client -> server: FoldingRanges end"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:311","msg":"client -> server: CodeLens"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:324","msg":"client -> server: CodeLens end"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:277","msg":"client -> server: CodeAction"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:307","msg":"client -> server: CodeAction end"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:711","msg":"client -> server: DocumentSymbol"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:715","msg":"client -> server: DocumentSymbol end"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:725","msg":"client -> server: FoldingRanges"}
{"level":"info","ts":"2024-06-25T16:20:36+02:00","caller":"proxy/server.go:729","msg":"client -> server: FoldingRanges end"}
{"level":"info","ts":"2024-06-25T16:20:37+02:00","caller":"proxy/server.go:311","msg":"client -> server: CodeLens"}
{"level":"info","ts":"2024-06-25T16:20:37+02:00","caller":"proxy/server.go:324","msg":"client -> server: CodeLens end"}
{"level":"info","ts":"2024-06-25T16:20:37+02:00","caller":"proxy/server.go:277","msg":"client -> server: CodeAction"}
{"level":"info","ts":"2024-06-25T16:20:37+02:00","caller":"proxy/server.go:287","msg":"client -> server: CodeAction end"}
{"level":"info","ts":"2024-06-25T16:20:38+02:00","caller":"proxy/server.go:277","msg":"client -> server: CodeAction"}
{"level":"info","ts":"2024-06-25T16:20:38+02:00","caller":"proxy/server.go:287","msg":"client -> server: CodeAction end"}
{"level":"info","ts":"2024-06-25T16:20:40+02:00","caller":"proxy/server.go:277","msg":"client -> server: CodeAction"}
{"level":"info","ts":"2024-06-25T16:20:40+02:00","caller":"proxy/server.go:307","msg":"client -> server: CodeAction end"}
{"level":"info","ts":"2024-06-25T16:20:40+02:00","caller":"lspcmd/stdrwc.go:36","msg":"rwc: closing","name":"templStream"}
{"level":"info","ts":"2024-06-25T16:20:40+02:00","caller":"lspcmd/main.go:131","msg":"templConn closed"}
{"level":"info","ts":"2024-06-25T16:20:40+02:00","caller":"lspcmd/main.go:135","msg":"shutdown complete"}
{"level":"info","ts":"2024-06-25T16:20:40+02:00","caller":"lspcmd/stdrwc.go:36","msg":"rwc: closing","name":"templStream"}
{"level":"error","ts":"2024-06-25T16:20:40+02:00","caller":"lspcmd/stdrwc.go:40","msg":"rwc: error closing reader","name":"templStream","error":"close /dev/stdin: file already closed","stacktrace":"github.com/a-h/templ/cmd/templ/lspcmd.stdrwc.Close\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.708-0.20240622185712-6c508309ccb1/cmd/templ/lspcmd/stdrwc.go:40\ngo.lsp.dev/jsonrpc2.(*stream).Close\n\t/Users/adam/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/stream.go:225\ngo.lsp.dev/jsonrpc2.(*conn).Close\n\t/Users/adam/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/conn.go:225\ngit.luolix.top/a-h/templ/cmd/templ/lspcmd.run\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.708-0.20240622185712-6c508309ccb1/cmd/templ/lspcmd/main.go:136\ngit.luolix.top/a-h/templ/cmd/templ/lspcmd.Run\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.708-0.20240622185712-6c508309ccb1/cmd/templ/lspcmd/main.go:72\nmain.lspCmd\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.708-0.20240622185712-6c508309ccb1/cmd/templ/main.go:313\nmain.run\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.708-0.20240622185712-6c508309ccb1/cmd/templ/main.go:52\nmain.main\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.708-0.20240622185712-6c508309ccb1/cmd/templ/main.go:22\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:271"}
{"level":"error","ts":"2024-06-25T16:20:40+02:00","caller":"lspcmd/stdrwc.go:46","msg":"rwc: error closing writer","name":"templStream","error":"close /dev/stdout: file already closed","stacktrace":"github.com/a-h/templ/cmd/templ/lspcmd.stdrwc.Close\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.708-0.20240622185712-6c508309ccb1/cmd/templ/lspcmd/stdrwc.go:46\ngo.lsp.dev/jsonrpc2.(*stream).Close\n\t/Users/adam/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/stream.go:225\ngo.lsp.dev/jsonrpc2.(*conn).Close\n\t/Users/adam/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/conn.go:225\ngit.luolix.top/a-h/templ/cmd/templ/lspcmd.run\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.708-0.20240622185712-6c508309ccb1/cmd/templ/lspcmd/main.go:136\ngit.luolix.top/a-h/templ/cmd/templ/lspcmd.Run\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.708-0.20240622185712-6c508309ccb1/cmd/templ/lspcmd/main.go:72\nmain.lspCmd\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.708-0.20240622185712-6c508309ccb1/cmd/templ/main.go:313\nmain.run\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.708-0.20240622185712-6c508309ccb1/cmd/templ/main.go:52\nmain.main\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.708-0.20240622185712-6c508309ccb1/cmd/templ/main.go:22\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:271"}

@joerdav
Copy link
Collaborator

joerdav commented Jun 25, 2024

I've narrowed this down then just to vscode, none of this happens in the nvim client! Will do some more digging.

@joerdav
Copy link
Collaborator

joerdav commented Jun 25, 2024

But struggling to reproduce actually even in vscode. My vscode version is older though so maybe that's it, will update.

@advdv
Copy link

advdv commented Jun 26, 2024

@joerdav today I opened my VSCode and the explorer looks like this, maybe it's a hint as to what is going on. I'm pretty sure that this was not like this yesterday. But I've also removed other extensions so it's hard for me to say why/when it happened:

Screen.Recording.2024-06-26.at.06.01.54.mov

@advdv
Copy link

advdv commented Jun 28, 2024

I've updated everything this morning to the latest tagged versions:

  • go install golang.org/x/tools/gopls@v0.16.0
  • go install github.com/a-h/templ/cmd/templ@v0.2.731

and everything works again, thank you for the effort! And I unfortunately still run into this issue, but it does seem to be less often.

@joerdav
Copy link
Collaborator

joerdav commented Jun 28, 2024

Great! Glad it's working, as for the explorer, generated files are now displayed as children of the templates. This can be overridden if it isn't desirable for you.

@joerdav joerdav closed this as completed Jun 28, 2024
@advdv
Copy link

advdv commented Jun 28, 2024

@joerdav sorry, I've just ran again into this issue again with the latest version. It does happen less often. I think it started triggering again AFTER I've regenerated my templates, I think before that it worked fine, maybe that is a useful hint.

Edit: here are the latest logs from the 'templ-reproduce' repo I've uploaded. I've updated the repo to the latest version.

{"level":"info","ts":"2024-06-28T09:17:13+02:00","caller":"lspcmd/main.go:76","msg":"lsp: starting up..."}
{"level":"info","ts":"2024-06-28T09:17:13+02:00","caller":"lspcmd/main.go:83","msg":"lsp: starting gopls..."}
{"level":"info","ts":"2024-06-28T09:17:13+02:00","caller":"lspcmd/main.go:96","msg":"creating gopls client"}
{"level":"info","ts":"2024-06-28T09:17:13+02:00","caller":"lspcmd/main.go:101","msg":"creating proxy"}
{"level":"info","ts":"2024-06-28T09:17:13+02:00","caller":"lspcmd/main.go:106","msg":"creating templ server"}
{"level":"info","ts":"2024-06-28T09:17:13+02:00","caller":"lspcmd/main.go:116","msg":"starting debug http server","addr":"localhost:7575"}
{"level":"info","ts":"2024-06-28T09:17:13+02:00","caller":"lspcmd/main.go:125","msg":"listening"}
{"level":"info","ts":"2024-06-28T09:17:13+02:00","caller":"proxy/server.go:207","msg":"client -> server: Initialize"}
{"level":"info","ts":"2024-06-28T09:17:14+02:00","caller":"proxy/server.go:237","msg":"client -> server: Initialize end"}
{"level":"info","ts":"2024-06-28T09:17:14+02:00","caller":"proxy/server.go:241","msg":"client -> server: Initialized"}
{"level":"info","ts":"2024-06-28T09:17:14+02:00","caller":"proxy/server.go:243","msg":"client -> server: Initialized end"}
{"level":"info","ts":"2024-06-28T09:17:14+02:00","caller":"proxy/client.go:42","msg":"client <- server: WorkDoneProgressCreate"}
{"level":"info","ts":"2024-06-28T09:17:14+02:00","caller":"proxy/client.go:38","msg":"client <- server: Progress"}
{"level":"info","ts":"2024-06-28T09:17:14+02:00","caller":"proxy/client.go:136","msg":"client <- server: Configuration"}
{"level":"info","ts":"2024-06-28T09:17:14+02:00","caller":"proxy/client.go:47","msg":"client <- server: LogMessage","message":"2024/06/28 09:17:14 Created View (#1)\n\tdirectory=/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce\n\tview_type=\"GoMod\"\n\troot_dir=\"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce\"\n\tgo_version=\"go version go1.22.3 darwin/arm64\"\n\tbuild_flags=[]\n\tenv={GOOS:darwin GOARCH:arm64 GOCACHE:/Users/adam/Library/Caches/go-build GOMODCACHE:/Users/adam/go/pkg/mod GOPATH:/Users/adam/go GOPRIVATE:github.com/crewlinker/atscqrs GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.3 darwin/arm64\n ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}\n\tenv_overlay=[]\n"}
{"level":"info","ts":"2024-06-28T09:17:14+02:00","caller":"proxy/client.go:47","msg":"client <- server: LogMessage","message":"2024/06/28 09:17:14 go/packages.Load #1\n\tview_id=\"1\"\n\tsnapshot=0\n\tdirectory=/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce\n\tquery=[/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/... builtin]\n\tpackages=2\n\tduration=235.382333ms\n"}
{"level":"info","ts":"2024-06-28T09:17:14+02:00","caller":"proxy/client.go:38","msg":"client <- server: Progress"}
{"level":"info","ts":"2024-06-28T09:17:14+02:00","caller":"proxy/client.go:121","msg":"client <- server: RegisterCapability"}
{"level":"info","ts":"2024-06-28T09:17:14+02:00","caller":"proxy/client.go:121","msg":"client <- server: RegisterCapability"}
{"level":"info","ts":"2024-06-28T09:17:15+02:00","caller":"proxy/server.go:271","msg":"client -> server: SetTrace"}
{"level":"info","ts":"2024-06-28T09:17:15+02:00","caller":"proxy/server.go:273","msg":"client -> server: SetTrace end"}
{"level":"info","ts":"2024-06-28T09:17:15+02:00","caller":"proxy/server.go:577","msg":"client -> server: DidChangeConfiguration"}
{"level":"info","ts":"2024-06-28T09:17:15+02:00","caller":"proxy/server.go:579","msg":"client -> server: DidChangeConfiguration end"}
{"level":"info","ts":"2024-06-28T09:17:15+02:00","caller":"proxy/client.go:136","msg":"client <- server: Configuration"}
{"level":"info","ts":"2024-06-28T09:17:15+02:00","caller":"proxy/client.go:136","msg":"client <- server: Configuration"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/client.go:47","msg":"client <- server: LogMessage","message":"2024/06/28 09:17:44 background imports cache refresh starting\n"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/server.go:610","msg":"client -> server: DidOpen","uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main.templ"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/server.go:634","msg":"setting source map cache contents","uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main.templ"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/server.go:641","msg":"client -> server: DidOpen end"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/server.go:277","msg":"client -> server: CodeAction"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/server.go:307","msg":"client -> server: CodeAction end"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/server.go:711","msg":"client -> server: DocumentSymbol"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/server.go:715","msg":"client -> server: DocumentSymbol end"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/server.go:682","msg":"client -> server: DocumentLink","uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main.templ"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/server.go:684","msg":"client -> server: DocumentLink end"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/client.go:52","msg":"client <- server: PublishDiagnostics"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/server.go:311","msg":"client -> server: CodeLens"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/server.go:324","msg":"client -> server: CodeLens end"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/server.go:277","msg":"client -> server: CodeAction"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/server.go:287","msg":"client -> server: CodeAction end"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/server.go:711","msg":"client -> server: DocumentSymbol"}
{"level":"info","ts":"2024-06-28T09:17:44+02:00","caller":"proxy/server.go:715","msg":"client -> server: DocumentSymbol end"}
{"level":"info","ts":"2024-06-28T09:17:45+02:00","caller":"proxy/server.go:311","msg":"client -> server: CodeLens"}
{"level":"info","ts":"2024-06-28T09:17:45+02:00","caller":"proxy/server.go:324","msg":"client -> server: CodeLens end"}
{"level":"info","ts":"2024-06-28T09:17:45+02:00","caller":"proxy/client.go:47","msg":"client <- server: LogMessage","message":"2024/06/28 09:17:45 background refresh finished after 1.85321825s\n"}
{"level":"info","ts":"2024-06-28T09:17:46+02:00","caller":"proxy/server.go:311","msg":"client -> server: CodeLens"}
{"level":"info","ts":"2024-06-28T09:17:46+02:00","caller":"proxy/server.go:324","msg":"client -> server: CodeLens end"}
{"level":"info","ts":"2024-06-28T09:17:46+02:00","caller":"lspcmd/stdrwc.go:36","msg":"rwc: closing","name":"templStream"}
{"level":"info","ts":"2024-06-28T09:17:46+02:00","caller":"lspcmd/main.go:131","msg":"templConn closed"}
{"level":"info","ts":"2024-06-28T09:17:46+02:00","caller":"lspcmd/main.go:135","msg":"shutdown complete"}
{"level":"info","ts":"2024-06-28T09:17:46+02:00","caller":"lspcmd/stdrwc.go:36","msg":"rwc: closing","name":"templStream"}
{"level":"error","ts":"2024-06-28T09:17:46+02:00","caller":"lspcmd/stdrwc.go:40","msg":"rwc: error closing reader","name":"templStream","error":"close /dev/stdin: file already closed","stacktrace":"github.com/a-h/templ/cmd/templ/lspcmd.stdrwc.Close\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.731/cmd/templ/lspcmd/stdrwc.go:40\ngo.lsp.dev/jsonrpc2.(*stream).Close\n\t/Users/adam/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/stream.go:225\ngo.lsp.dev/jsonrpc2.(*conn).Close\n\t/Users/adam/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/conn.go:225\ngit.luolix.top/a-h/templ/cmd/templ/lspcmd.run\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.731/cmd/templ/lspcmd/main.go:136\ngit.luolix.top/a-h/templ/cmd/templ/lspcmd.Run\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.731/cmd/templ/lspcmd/main.go:72\nmain.lspCmd\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.731/cmd/templ/main.go:313\nmain.run\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.731/cmd/templ/main.go:52\nmain.main\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.731/cmd/templ/main.go:22\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:271"}
{"level":"error","ts":"2024-06-28T09:17:46+02:00","caller":"lspcmd/stdrwc.go:46","msg":"rwc: error closing writer","name":"templStream","error":"close /dev/stdout: file already closed","stacktrace":"github.com/a-h/templ/cmd/templ/lspcmd.stdrwc.Close\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.731/cmd/templ/lspcmd/stdrwc.go:46\ngo.lsp.dev/jsonrpc2.(*stream).Close\n\t/Users/adam/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/stream.go:225\ngo.lsp.dev/jsonrpc2.(*conn).Close\n\t/Users/adam/go/pkg/mod/go.lsp.dev/jsonrpc2@v0.10.0/conn.go:225\ngit.luolix.top/a-h/templ/cmd/templ/lspcmd.run\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.731/cmd/templ/lspcmd/main.go:136\ngit.luolix.top/a-h/templ/cmd/templ/lspcmd.Run\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.731/cmd/templ/lspcmd/main.go:72\nmain.lspCmd\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.731/cmd/templ/main.go:313\nmain.run\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.731/cmd/templ/main.go:52\nmain.main\n\t/Users/adam/go/pkg/mod/github.com/a-h/templ@v0.2.731/cmd/templ/main.go:22\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:271"}
[Trace - 09:17:14.006 AM] Sending request 'initialize - (1)'.
Params: {"processId":27275,"clientInfo":{"name":"Visual Studio Code","version":"1.90.2"},"locale":"en","rootPath":"/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce","rootUri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"failureHandling":"textOnlyTransactional","resourceOperations":["create","rename","delete"],"normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":true}},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"tagSupport":{"valueSet":[1]}},"executeCommand":{"dynamicRegistration":true},"workspaceFolders":true,"configuration":true,"semanticTokens":{"refreshSupport":true},"codeLens":{"refreshSupport":true},"fileOperations":{"dynamicRegistration":true,"didCreate":true,"willCreate":true,"didRename":true,"willRename":true,"didDelete":true,"willDelete":true}},"textDocument":{"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true,"tagSupport":{"valueSet":[1]},"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"insertTextModeSupport":{"valueSet":[1,2]}},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]},"contextSupport":true},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true},"activeParameterSupport":true},"contextSupport":true},"declaration":{"dynamicRegistration":true,"linkSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true,"tagSupport":{"valueSet":[1]},"labelSupport":true},"codeAction":{"dynamicRegistration":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"isPreferredSupport":true,"disabledSupport":true,"dataSupport":true,"resolveSupport":{"properties":["edit"]},"honorsChangeAnnotations":true},"codeLens":{"dynamicRegistration":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"colorProvider":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"publishDiagnostics":{"relatedInformation":true,"tagSupport":{"valueSet":[1,2]},"codeDescriptionSupport":true,"dataSupport":true},"rename":{"dynamicRegistration":true,"prepareSupport":true,"prepareSupportDefaultBehavior":1,"honorsChangeAnnotations":true},"selectionRange":{"dynamicRegistration":true},"callHierarchy":{"dynamicRegistration":true},"semanticTokens":{"dynamicRegistration":true,"requests":{"range":true,"full":{"delta":true}},"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator","decorator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats":["relative"]},"linkedEditingRange":{"dynamicRegistration":true}},"window":{"workDoneProgress":true,"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"showDocument":{"support":true}},"general":{"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"markdown":{"parser":"marked","version":"1.1.0"}}},"trace":"off","workspaceFolders":[{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce","name":"templ-reproduce"}]}


[Trace - 09:17:14.007 AM] Received response 'initialize - (1)' in 0ms.
Result: {"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"completionProvider":{"triggerCharacters":["."]},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor.extract","refactor.inline","refactor.rewrite","source.assembly","source.doc","source.fixAll","source.freesymbols","source.organizeImports"],"resolveProvider":true},"codeLensProvider":{},"documentLinkProvider":{},"workspaceSymbolProvider":true,"documentFormattingProvider":true,"renameProvider":{"prepareProvider":true},"foldingRangeProvider":true,"selectionRangeProvider":true,"executeCommandProvider":{"commands":["gopls.add_dependency","gopls.add_import","gopls.add_telemetry_counters","gopls.apply_fix","gopls.assembly","gopls.change_signature","gopls.check_upgrades","gopls.diagnose_files","gopls.doc","gopls.edit_go_directive","gopls.fetch_vulncheck_result","gopls.free_symbols","gopls.gc_details","gopls.generate","gopls.go_get_package","gopls.list_imports","gopls.list_known_packages","gopls.maybe_prompt_for_telemetry","gopls.mem_stats","gopls.regenerate_cgo","gopls.remove_dependency","gopls.reset_go_mod_diagnostics","gopls.run_go_work_command","gopls.run_govulncheck","gopls.run_tests","gopls.scan_imports","gopls.start_debugging","gopls.start_profile","gopls.stop_profile","gopls.test","gopls.tidy","gopls.toggle_gc_details","gopls.update_go_sum","gopls.upgrade_dependency","gopls.vendor","gopls.views","gopls.workspace_stats"]},"callHierarchyProvider":true,"semanticTokensProvider":{"legend":{"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator","decorator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"]},"range":true,"full":true},"inlayHintProvider":{},"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"}}},"serverInfo":{"name":"gopls","version":"{\"GoVersion\":\"go1.22.3\",\"Path\":\"golang.org/x/tools/gopls\",\"Main\":{\"Path\":\"golang.org/x/tools/gopls\",\"Version\":\"v0.16.0\",\"Sum\":\"h1:JOYR1NabC699+pLFI02CxlD9xaPXdaVmPp7f01k0/hE=\",\"Replace\":null},\"Deps\":[{\"Path\":\"github.com/BurntSushi/toml\",\"Version\":\"v1.2.1\",\"Sum\":\"h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=\",\"Replace\":null},{\"Path\":\"github.com/google/go-cmp\",\"Version\":\"v0.6.0\",\"Sum\":\"h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=\",\"Replace\":null},{\"Path\":\"golang.org/x/exp/typeparams\",\"Version\":\"v0.0.0-20221212164502-fae10dda9338\",\"Sum\":\"h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=\",\"Replace\":null},{\"Path\":\"golang.org/x/mod\",\"Version\":\"v0.18.0\",\"Sum\":\"h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=\",\"Replace\":null},{\"Path\":\"golang.org/x/sync\",\"Version\":\"v0.7.0\",\"Sum\":\"h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=\",\"Replace\":null},{\"Path\":\"golang.org/x/telemetry\",\"Version\":\"v0.0.0-20240607193123-221703e18637\",\"Sum\":\"h1:3Wt8mZlbFwG8llny+t18kh7AXxyWePFycXMuVdHxnyM=\",\"Replace\":null},{\"Path\":\"golang.org/x/text\",\"Version\":\"v0.16.0\",\"Sum\":\"h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=\",\"Replace\":null},{\"Path\":\"golang.org/x/tools\",\"Version\":\"v0.22.1-0.20240620150659-cb3016b76f3e\",\"Sum\":\"h1:Cht5EwNRmW9EgQ7ihPmgIswaQW4jR1cPbmzGCNl2++8=\",\"Replace\":null},{\"Path\":\"golang.org/x/vuln\",\"Version\":\"v1.0.4\",\"Sum\":\"h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I=\",\"Replace\":null},{\"Path\":\"honnef.co/go/tools\",\"Version\":\"v0.4.7\",\"Sum\":\"h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs=\",\"Replace\":null},{\"Path\":\"mvdan.cc/gofumpt\",\"Version\":\"v0.6.0\",\"Sum\":\"h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo=\",\"Replace\":null},{\"Path\":\"mvdan.cc/xurls/v2\",\"Version\":\"v2.5.0\",\"Sum\":\"h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=\",\"Replace\":null}],\"Settings\":[{\"Key\":\"-buildmode\",\"Value\":\"exe\"},{\"Key\":\"-compiler\",\"Value\":\"gc\"},{\"Key\":\"DefaultGODEBUG\",\"Value\":\"httplaxcontentlength=1,httpmuxgo121=1,panicnil=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1\"},{\"Key\":\"CGO_ENABLED\",\"Value\":\"1\"},{\"Key\":\"CGO_CFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_CPPFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_CXXFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_LDFLAGS\",\"Value\":\"\"},{\"Key\":\"GOARCH\",\"Value\":\"arm64\"},{\"Key\":\"GOOS\",\"Value\":\"darwin\"}],\"Version\":\"v0.16.0\"}"}}


[Trace - 09:17:14.028 AM] Sending notification 'initialized'.
Params: {}


[Trace - 09:17:14.028 AM] Received request 'window/workDoneProgress/create - (1)'.
Params: {"token":"5602944977901019313"}


[Trace - 09:17:14.110 AM] Sending response 'window/workDoneProgress/create - (1)' in 82ms.
Result: 


[Trace - 09:17:14.111 AM] Received notification '$/progress'.
Params: {"token":"5602944977901019313","value":{"kind":"begin","title":"Setting up workspace","message":"Loading packages..."}}


[Trace - 09:17:14.111 AM] Received request 'workspace/configuration - (2)'.
Params: {"items":[{"scopeUri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce","section":"gopls"}]}


[Trace - 09:17:14.113 AM] Sending response 'workspace/configuration - (2)' in 2ms.
Result: [{}]


[Trace - 09:17:14.141 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2024/06/28 09:17:14 Created View (#1)\n\tdirectory=/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce\n\tview_type=\"GoMod\"\n\troot_dir=\"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce\"\n\tgo_version=\"go version go1.22.3 darwin/arm64\"\n\tbuild_flags=[]\n\tenv={GOOS:darwin GOARCH:arm64 GOCACHE:/Users/adam/Library/Caches/go-build GOMODCACHE:/Users/adam/go/pkg/mod GOPATH:/Users/adam/go GOPRIVATE:github.com/crewlinker/atscqrs GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.3 darwin/arm64\n ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}\n\tenv_overlay=[]\n"}


[Trace - 09:17:14.377 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2024/06/28 09:17:14 go/packages.Load #1\n\tview_id=\"1\"\n\tsnapshot=0\n\tdirectory=/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce\n\tquery=[/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/... builtin]\n\tpackages=2\n\tduration=235.382333ms\n"}


[Trace - 09:17:14.405 AM] Received notification '$/progress'.
Params: {"token":"5602944977901019313","value":{"kind":"end","message":"Finished loading packages."}}


[Trace - 09:17:14.405 AM] Received request 'client/registerCapability - (3)'.
Params: {"registrations":[{"id":"workspace/didChangeWatchedFiles-0","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce","kind":7},{"globPattern":"**/*.{mod,work}","kind":7},{"globPattern":"/Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/**/*.{go,mod,sum,work}","kind":7}]}}]}


[Trace - 09:17:14.408 AM] Sending response 'client/registerCapability - (3)' in 2ms.
Result: 


[Trace - 09:17:14.408 AM] Received request 'client/registerCapability - (4)'.
Params: {"registrations":[{"id":"workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"}]}


[Trace - 09:17:14.408 AM] Sending response 'client/registerCapability - (4)' in 0ms.
Result: 


[Trace - 09:17:15.805 AM] Sending notification '$/setTrace'.
Params: {"value":"off"}


[Trace - 09:17:15.805 AM] Sending notification 'workspace/didChangeConfiguration'.
Params: {}


[Trace - 09:17:15.806 AM] Received request 'workspace/configuration - (5)'.
Params: {"items":[{"section":"gopls"}]}


[Trace - 09:17:15.807 AM] Sending response 'workspace/configuration - (5)' in 1ms.
Result: [{}]


[Trace - 09:17:15.807 AM] Received request 'workspace/configuration - (6)'.
Params: {"items":[{"scopeUri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce","section":"gopls"}]}


[Trace - 09:17:15.808 AM] Sending response 'workspace/configuration - (6)' in 0ms.
Result: [{}]


[Trace - 09:17:44.178 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2024/06/28 09:17:44 background imports cache refresh starting\n"}


[Trace - 09:17:44.364 AM] Sending notification 'textDocument/didOpen'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go","languageId":"templ","version":1,"text":"// Code generated by templ - DO NOT EDIT.\n\npackage main\n\n//lint:file-ignore SA4006 This context is only used if a nested component is present.\n\nimport \"github.com/a-h/templ\"\nimport templruntime \"github.com/a-h/templ/runtime\"\n\nfunc hello(title, name string) templ.Component {\n\treturn templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {\n\t\ttempl_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context\n\t\ttempl_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)\n\t\tif !templ_7745c5c3_IsBuffer {\n\t\t\tdefer func() {\n\t\t\t\ttempl_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)\n\t\t\t\tif templ_7745c5c3_Err == nil {\n\t\t\t\t\ttempl_7745c5c3_Err = templ_7745c5c3_BufErr\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t\tctx = templ.InitializeContext(ctx)\n\t\ttempl_7745c5c3_Var1 := templ.GetChildren(ctx)\n\t\tif templ_7745c5c3_Var1 == nil {\n\t\t\ttempl_7745c5c3_Var1 = templ.NopComponent\n\t\t}\n\t\tctx = templ.ClearChildren(ctx)\n\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(\"\u003c!doctype html\u003e\u003chtml lang=\\\"en\\\"\u003e\u003chead\u003e\u003ctitle\u003e\")\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn templ_7745c5c3_Err\n\t\t}\n\t\tvar templ_7745c5c3_Var2 string\n\t\ttempl_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title)\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn\ttempl.Error{Err: templ_7745c5c3_Err, FileName: ``, Line: 6, Col: 22}\n\t\t}\n\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn templ_7745c5c3_Err\n\t\t}\n\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(\"\u003c/title\u003e\u003c/head\u003e\u003cbody\u003e\u003cp\u003ehello, \")\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn templ_7745c5c3_Err\n\t\t}\n\t\tvar templ_7745c5c3_Var3 string\n\t\ttempl_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(name)\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn\ttempl.Error{Err: templ_7745c5c3_Err, FileName: ``, Line: 7, Col: 24}\n\t\t}\n\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn templ_7745c5c3_Err\n\t\t}\n\t\t_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(\"!\u003c/p\u003e\u003c/body\u003e\u003c/html\u003e\")\n\t\tif templ_7745c5c3_Err != nil {\n\t\t\treturn templ_7745c5c3_Err\n\t\t}\n\t\treturn templ_7745c5c3_Err\n\t})\n}\n"}}


[Trace - 09:17:44.368 AM] Sending request 'textDocument/codeAction - (2)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go"},"context":{"diagnostics":[]},"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}}}


[Trace - 09:17:44.433 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go","version":1,"diagnostics":[]}


[Trace - 09:17:44.434 AM] Received response 'textDocument/codeAction - (2)' in 65ms.
Result: [{"title":"Browse documentation for package main","kind":"source.doc","command":{"title":"Browse documentation for package main","command":"gopls.doc","arguments":[{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go","range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}}}]}}]


[Trace - 09:17:44.615 AM] Sending request 'textDocument/codeLens - (3)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go"}}


[Trace - 09:17:44.615 AM] Received response 'textDocument/codeLens - (3)' in 0ms.
Result: null


[Trace - 09:17:44.618 AM] Sending request 'textDocument/codeAction - (4)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go"},"context":{"diagnostics":[]},"range":{"start":{"line":8,"character":1},"end":{"line":8,"character":1}}}


[Error - Received] 09:17:44.618 AM #4 column is beyond end of line


[Trace - 09:17:45.435 AM] Sending request 'textDocument/codeLens - (5)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go"}}


[Trace - 09:17:45.435 AM] Received response 'textDocument/codeLens - (5)' in 0ms.
Result: null


[Trace - 09:17:45.994 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2024/06/28 09:17:45 background refresh finished after 1.85321825s\n"}


[Trace - 09:17:46.423 AM] Sending request 'textDocument/codeLens - (6)'.
Params: {"textDocument":{"uri":"file:///Users/adam/Documents/Projects/github.com/crewlinker/templ-reproduce/main_templ.go"}}


[Trace - 09:17:46.423 AM] Received response 'textDocument/codeLens - (6)' in 0ms.
Result: null


[Trace - 09:17:46.477 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2024/06/28 09:17:46 Shutdown session\n\tshutdown_session=1\n"}

@a-h
Copy link
Owner

a-h commented Jun 28, 2024

I think this is a legit issue, see #817

@whlapinel
Copy link

I installed the fix but I'm still having the same issue unfortunately.

@prencher
Copy link

prencher commented Jun 30, 2024

Sadly this still happens for me with the fixes in #817, using version v0.2.732-0.20240629093741-01d33616aadc (main at the time). This is along with VS Code v1.90.2, templ-vscode v0.0.26, and gopls 0.16.0.

It seems to trigger in particular when the cursor moves through different contexts, e.g. <p>{ children... }</p>, but that may be a red herring.

@advdv
Copy link

advdv commented Jun 30, 2024

Also for me this doesn't solve the issue unfortunately. Let me know if there is anything else I can provide to make it easier to fix this

@a-h a-h reopened this Jun 30, 2024
@a-h
Copy link
Owner

a-h commented Jun 30, 2024

OK, I've updated gopls with:

go install golang.org/x/tools/gopls@latest
go: downloading golang.org/x/tools/gopls v0.16.0
go: downloading golang.org/x/tools v0.22.0
go: downloading golang.org/x/telemetry v0.0.0-20240607193123-221703e18637
go: downloading golang.org/x/tools v0.22.1-0.20240620150659-cb3016b76f3e
go: downloading golang.org/x/mod v0.18.0
go: downloading golang.org/x/vuln v1.0.4
go: downloading mvdan.cc/xurls/v2 v2.5.0
go: downloading mvdan.cc/gofumpt v0.6.0
go: downloading honnef.co/go/tools v0.4.7
go: downloading golang.org/x/text v0.16.0
go: downloading golang.org/x/exp/typeparams v0.0.0-20221212164502-fae10dda9338
go: downloading github.com/BurntSushi/toml v1.2.1

And:

go install github.com/a-h/templ/cmd/templ@latest

And I've updated VS Code to v1.90.2.

And I can reproduce the issue easily. However, there's nothing really useful in the logs. I'll add some more detail to help me debug.

@a-h a-h closed this as completed in d3033c5 Jun 30, 2024
@a-h
Copy link
Owner

a-h commented Jun 30, 2024

OK, with the extra logging I could see that the templ file code position wasn't being re-written to the Go code position, because the position within the templ file was not actually a Go expression, so the LSP was sending through the position within the templ file, hence it being outside of what gopls knows about.

This didn't happen previously, so I assume that an update to VS Code and/or gopls has surfaced the behaviour.

If someone can confirm the fix for them, I'll push a new release.

@johannes-luebke
Copy link

Works for me.
At least I'm no longer seeing the error message Request textDocument/codeAction failed.
But I'm not getting full Autocomplete yet. I'm only ever getting this:
Screenshot 2024-06-30 at 18 17 05

Might be a different issue though.

@axzilla
Copy link

axzilla commented Jun 30, 2024

Works for me. At least I'm no longer seeing the error message Request textDocument/codeAction failed. But I'm not getting full Autocomplete yet. I'm only ever getting this: Screenshot 2024-06-30 at 18 17 05

Might be a different issue though.

Same for me in NeoVim:

Screenshot 2024-06-30 at 18 19 56

@whlapinel
Copy link

Yay, the error was fixed for me too! But autocomplete is also not working for me in VS Code. At one point (before this error message became a permanent issue for me), autocomplete worked.

@a-h
Copy link
Owner

a-h commented Jun 30, 2024

Yes, I see that. Thanks.

The LSP is returning results but they're not showing in editors any more. I need to do some more investigating. Could be that gopls has changed its result shape or some other value is being set differently.

The templ LSP tests are still passing, so it makes me think it's likely that the gopls behaviour has changed.

@whlapinel
Copy link

It does seem to still pop up under certain conditions. I could only get it to show by selecting text as shown, but after a few times of trying to nail down the exact conditions I couldn't get it to show up again.

image

@a-h a-h reopened this Jul 1, 2024
@zyriab
Copy link

zyriab commented Jul 3, 2024

Hello I have the same issue, if I revert gopls to version 0.15.3 with go install golang.org/x/tools/gopls@v0.15.3, it's working just fine

@Ganes556
Copy link

Ganes556 commented Jul 4, 2024

Hello I have the same issue, if I revert gopls to version 0.15.3 with go install golang.org/x/tools/gopls@v0.15.3, it's working just fine

this only work for nvim

@zyriab
Copy link

zyriab commented Jul 4, 2024

Hello I have the same issue, if I revert gopls to version 0.15.3 with go install golang.org/x/tools/gopls@v0.15.3, it's working just fine

this only work for nvim

It's about the LSP, the editor is irrelevant.
You have to configure your editor to use another version of gopls.

@Ganes556
Copy link

Ganes556 commented Jul 4, 2024

Hello I have the same issue, if I revert gopls to version 0.15.3 with go install golang.org/x/tools/gopls@v0.15.3, it's working just fine

this only work for nvim

It's about the LSP, the editor is irrelevant. You have to configure your editor to use another version of gopls.

Owh sorry my bad, after reopen my vscode that work properly

@a-h
Copy link
Owner

a-h commented Jul 4, 2024

I've tracked down the issue. In gopls v15, completion items look like this:

{
    "detail": "func(c complex128, fmt byte, prec int, bitSize int) string",
    "documentation": {
        "kind": "markdown",
        "value": "FormatComplex converts the complex number c to a string of the form (a+bi) where a and b are the real and imaginary parts, formatted according to the format fmt and precision prec.\n\nThe format fmt and precision prec have the same meaning as in FormatFloat. It rounds the result assuming that the original was obtained from a complex value of bitSize bits, which must be 64 for complex64 and 128 for complex128.\n"
    },
    "filterText": "FormatComplex",
    "insertTextFormat": 2,
    "kind": 3,
    "label": "FormatComplex",
    "sortText": "00001",
    "textEdit": {
        "newText": "FormatComplex(${1:})",
        "range": {
            "end": {
                "character": 73,
                "line": 105
            },
            "start": {
                "character": 73,
                "line": 105
            }
        }
    }
}

But in v16, they've changed shape:

{
    "detail": "func(c complex128, fmt byte, prec int, bitSize int) string",
    "documentation": {
        "kind": "markdown",
        "value": "FormatComplex converts the complex number c to a string of the form (a+bi) where a and b are the real and imaginary parts, formatted according to the format fmt and precision prec.\n\nThe format fmt and precision prec have the same meaning as in FormatFloat. It rounds the result assuming that the original was obtained from a complex value of bitSize bits, which must be 64 for complex64 and 128 for complex128.\n"
    },
    "filterText": "strconv.FormatComplex",
    "insertTextFormat": 2,
    "kind": 3,
    "label": "strconv.FormatComplex",
    "sortText": "00001",
    "textEdit": {
        "insert": {
            "end": {
                "character": 72,
                "line": 105
            },
            "start": {
                "character": 65,
                "line": 105
            }
        },
        "newText": "strconv.FormatComplex(${1:})",
        "replace": {
            "end": {
                "character": 76,
                "line": 105
            },
            "start": {
                "character": 65,
                "line": 105
            }
        }
    }
}

The LSP library I use (I forked it a while ago so that I didn't have to wait for PRs to get merged to make changes), doesn't support that structure: https://github.com/go-language-server/protocol/blob/dd685d4561a3ff05f82d25b51346f3c83ce5f918/language.go#L260

So, I need to update the protocol library to support a union of both types. I have it working locally.

@a-h a-h closed this as completed in bc6e65a Jul 4, 2024
@a-h
Copy link
Owner

a-h commented Jul 4, 2024

I've updated protocol in a-h/protocol@1e461c1

And I've updated templ in 26c1d79

On the "end of line" thing, I think there's another potential way that it could happen where if you've got an invalid line, the templ generation can't happen, so the Go mapping might not have updated, resulting in an out-of-bounds position being sent.

I've added a commit to bc6e65a

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

Successfully merging a pull request may close this issue.