Skip to content

Support for arduino-cli API changes after 1.0.0 #174

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

Merged
merged 6 commits into from
Jan 4, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Updated gRPC client
  • Loading branch information
cmaglie committed Jan 3, 2024
commit 81324c0ecd93ebd44aaf3f8a5d63872a0f19b50d
12 changes: 8 additions & 4 deletions ls/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"sync"
"time"

rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/settings/v1"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
"github.com/arduino/arduino-language-server/globals"
"github.com/arduino/arduino-language-server/sourcemapper"
"github.com/arduino/arduino-language-server/streams"
Expand All @@ -40,6 +40,7 @@ import (
"go.bug.st/lsp/jsonrpc"
"go.bug.st/lsp/textedits"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)

// INOLanguageServer is a JSON-RPC handler that delegates messages to clangd.
Expand Down Expand Up @@ -1430,14 +1431,17 @@ func (ls *INOLanguageServer) extractDataFolderFromArduinoCLI(logger jsonrpc.Func
var dataDir string
if ls.config.CliPath == nil {
// Establish a connection with the arduino-cli gRPC server
conn, err := grpc.Dial(ls.config.CliDaemonAddress, grpc.WithInsecure(), grpc.WithBlock())
conn, err := grpc.Dial(
ls.config.CliDaemonAddress,
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithBlock())
if err != nil {
return nil, fmt.Errorf("error connecting to arduino-cli rpc server: %w", err)
}
defer conn.Close()
client := rpc.NewSettingsServiceClient(conn)
client := rpc.NewArduinoCoreServiceClient(conn)

resp, err := client.GetValue(context.Background(), &rpc.GetValueRequest{
resp, err := client.SettingsGetValue(context.Background(), &rpc.SettingsGetValueRequest{
Key: "directories.data",
})
if err != nil {
Expand Down