diff --git a/.version b/.version index 75088f8d2..ae05c28ba 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.2.709 \ No newline at end of file +0.2.717 \ No newline at end of file diff --git a/cmd/templ/lspcmd/proxy/server.go b/cmd/templ/lspcmd/proxy/server.go index 6ef281d51..94a36c8a9 100644 --- a/cmd/templ/lspcmd/proxy/server.go +++ b/cmd/templ/lspcmd/proxy/server.go @@ -291,12 +291,14 @@ func (p *Server) CodeAction(ctx context.Context, params *lsp.CodeActionParams) ( r.Diagnostics[di].Range = p.convertGoRangeToTemplRange(templURI, r.Diagnostics[di].Range) } // Rewrite the DocumentChanges. - for dci := 0; dci < len(r.Edit.DocumentChanges); dci++ { - dc := r.Edit.DocumentChanges[0] - for ei := 0; ei < len(dc.Edits); ei++ { - dc.Edits[ei].Range = p.convertGoRangeToTemplRange(templURI, dc.Edits[ei].Range) + if r.Edit != nil { + for dci := 0; dci < len(r.Edit.DocumentChanges); dci++ { + dc := r.Edit.DocumentChanges[0] + for ei := 0; ei < len(dc.Edits); ei++ { + dc.Edits[ei].Range = p.convertGoRangeToTemplRange(templURI, dc.Edits[ei].Range) + } + dc.TextDocument.URI = templURI } - dc.TextDocument.URI = templURI } result[i] = r }