Skip to content

Commit b866836

Browse files
committed
chore: additional lsp test
1 parent 78015d5 commit b866836

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

cmd/templ/lspcmd/lsp_test.go

+27
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,33 @@ func TestReferences(t *testing.T) {
387387
return "", true
388388
},
389389
},
390+
{
391+
// this is the definition of the struct in the templates.templ file.
392+
line: 21,
393+
character: 9,
394+
assert: func(t *testing.T, actual []protocol.Location) (msg string, ok bool) {
395+
expectedReference := []protocol.Location{
396+
{
397+
// This is the useage of the struct in the templates.templ file.
398+
URI: uri.URI("file://" + appDir + "/templates.templ"),
399+
Range: protocol.Range{
400+
Start: protocol.Position{
401+
Line: uint32(24),
402+
Character: uint32(8),
403+
},
404+
End: protocol.Position{
405+
Line: uint32(24),
406+
Character: uint32(14),
407+
},
408+
},
409+
},
410+
}
411+
if diff := lspdiff.References(expectedReference, actual); diff != "" {
412+
return fmt.Sprintf("Expected: %+v\nActual: %+v", expectedReference, actual), false
413+
}
414+
return "", true
415+
},
416+
},
390417
}
391418

392419
for i, test := range tests {

0 commit comments

Comments
 (0)