Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

lsp: Use notify for sending messages #1267

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions internal/lsp/server_aggregates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import rego.v1

barURI := fileURIScheme + filepath.Join(tempDir, "bar.rego")

err = connClient.Call(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
err = connClient.Notify(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
TextDocument: types.TextDocumentIdentifier{
URI: barURI,
},
Expand Down Expand Up @@ -111,7 +111,7 @@ import rego.v1

fooURI := fileURIScheme + filepath.Join(tempDir, "foo.rego")

err = connClient.Call(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
err = connClient.Notify(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
TextDocument: types.TextDocumentIdentifier{
URI: fooURI,
},
Expand Down Expand Up @@ -249,7 +249,7 @@ import data.quz
}

// 2. check the aggregates for a file are updated after an update
err = connClient.Call(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
err = connClient.Notify(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
TextDocument: types.TextDocumentIdentifier{
URI: fileURIScheme + filepath.Join(tempDir, "bar.rego"),
},
Expand Down Expand Up @@ -355,7 +355,7 @@ import rego.v1
// update the contents of the bar.rego file to address the unresolved-import
barURI := fileURIScheme + filepath.Join(tempDir, "bar.rego")

err = connClient.Call(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
err = connClient.Notify(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
TextDocument: types.TextDocumentIdentifier{
URI: barURI,
},
Expand Down Expand Up @@ -397,7 +397,7 @@ import rego.v1
}

// update the contents of the bar.rego to bring back the violation
err = connClient.Call(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
err = connClient.Notify(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
TextDocument: types.TextDocumentIdentifier{
URI: barURI,
},
Expand Down
2 changes: 1 addition & 1 deletion internal/lsp/server_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ rules:
}

// this event is sent to allow the server to detect the new config
if err := connClient.Call(ctx, "workspace/didChangeWatchedFiles", types.WorkspaceDidChangeWatchedFilesParams{
if err := connClient.Notify(ctx, "workspace/didChangeWatchedFiles", types.WorkspaceDidChangeWatchedFilesParams{
Changes: []types.FileEvent{
{
URI: fileURIScheme + filepath.Join(tempDir, ".regal/config.yaml"),
Expand Down
2 changes: 1 addition & 1 deletion internal/lsp/server_multi_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ ignore:

// 3. Client sends textDocument/didChange notification with new contents
// for authz.rego no response to the call is expected
if err := connClient.Call(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
if err := connClient.Notify(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
TextDocument: types.TextDocumentIdentifier{
URI: fileURIScheme + filepath.Join(tempDir, "authz.rego"),
},
Expand Down
4 changes: 2 additions & 2 deletions internal/lsp/server_single_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ rules:

// Client sends textDocument/didChange notification with new contents for main.rego
// no response to the call is expected
if err := connClient.Call(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
if err := connClient.Notify(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
TextDocument: types.TextDocumentIdentifier{
URI: mainRegoURI,
},
Expand Down Expand Up @@ -220,7 +220,7 @@ capabilities:
// the start of an EOPA-specific call, so if the capabilities were
// loaded correctly, we should see a completion later after we ask for
// it.
if err := connClient.Call(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
if err := connClient.Notify(ctx, "textDocument/didChange", types.TextDocumentDidChangeParams{
TextDocument: types.TextDocumentIdentifier{
URI: mainRegoURI,
},
Expand Down
2 changes: 1 addition & 1 deletion internal/lsp/server_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func TestNewFileTemplating(t *testing.T) {
}

// Client sends workspace/didCreateFiles notification
if err := connClient.Call(ctx, "workspace/didCreateFiles", types.WorkspaceDidCreateFilesParams{
if err := connClient.Notify(ctx, "workspace/didCreateFiles", types.WorkspaceDidCreateFilesParams{
Files: []types.WorkspaceDidCreateFilesParamsCreatedFile{
{URI: newFileURI},
},
Expand Down