@@ -20,11 +20,6 @@ func TestTextDocumentSignatureHelp(t *testing.T) {
2020
2121 tempDir := t .TempDir ()
2222
23- ls := NewLanguageServer (ctx , & LanguageServerOptions {
24- LogWriter : newTestLogger (t ),
25- LogLevel : log .LevelDebug ,
26- })
27-
2823 mainRegoURI := fileURIScheme + filepath .Join (tempDir , "main.rego" )
2924
3025 content := `package example
@@ -33,20 +28,12 @@ allow if regex.match(` + "`foo`" + `, "bar")
3328allow if count([1,2,3]) == 2
3429allow if concat(",", "a", "b") == "b,a"`
3530
36- ls .cache .SetFileContents (mainRegoURI , content )
37-
3831 builtins := map [string ]* ast.Builtin {
3932 "count" : ast .Count ,
4033 "concat" : ast .Concat ,
4134 "regex.match" : ast .RegexMatch ,
4235 }
4336
44- // this is needed to prepare the server for signature help queries
45- err := ls .storeBuiltinsAndCacheSignatureHelp (ctx , builtins )
46- if err != nil {
47- t .Fatalf ("failed to store builtins and cache signature help: %s" , err )
48- }
49-
5037 testCases := map [string ]struct {
5138 position types.Position
5239 expectedLabel string
@@ -77,6 +64,19 @@ allow if concat(",", "a", "b") == "b,a"`
7764 t .Run (name , func (t * testing.T ) {
7865 t .Parallel ()
7966
67+ ls := NewLanguageServer (ctx , & LanguageServerOptions {
68+ LogWriter : newTestLogger (t ),
69+ LogLevel : log .LevelDebug ,
70+ })
71+
72+ ls .cache .SetFileContents (mainRegoURI , content )
73+
74+ // this is needed to prepare the server for signature help queries
75+ err := ls .storeBuiltinsAndCacheSignatureHelp (ctx , builtins )
76+ if err != nil {
77+ t .Fatalf ("failed to store builtins and cache signature help: %s" , err )
78+ }
79+
8080 params := types.SignatureHelpParams {
8181 TextDocumentPositionParams : types.TextDocumentPositionParams {
8282 TextDocument : types.TextDocumentIdentifier {URI : mainRegoURI },
0 commit comments