@@ -27,8 +27,8 @@ import (
27
27
// GetInstalledBoards is an helper function useful to autocomplete.
28
28
// It returns a list of fqbn
29
29
// it's taken from cli/board/listall.go
30
- func GetInstalledBoards (srv rpc.ArduinoCoreServiceServer ) []string {
31
- inst := instance .CreateAndInit ()
30
+ func GetInstalledBoards (srv rpc.ArduinoCoreServiceServer , ctx context. Context ) []string {
31
+ inst := instance .CreateAndInit (srv , ctx )
32
32
33
33
list , _ := srv .BoardListAll (context .Background (), & rpc.BoardListAllRequest {
34
34
Instance : inst ,
@@ -45,8 +45,8 @@ func GetInstalledBoards(srv rpc.ArduinoCoreServiceServer) []string {
45
45
46
46
// GetInstalledProgrammers is an helper function useful to autocomplete.
47
47
// It returns a list of programmers available based on the installed boards
48
- func GetInstalledProgrammers (srv rpc.ArduinoCoreServiceServer ) []string {
49
- inst := instance .CreateAndInit ()
48
+ func GetInstalledProgrammers (srv rpc.ArduinoCoreServiceServer , ctx context. Context ) []string {
49
+ inst := instance .CreateAndInit (srv , ctx )
50
50
51
51
// we need the list of the available fqbn in order to get the list of the programmers
52
52
listAllReq := & rpc.BoardListAllRequest {
@@ -78,8 +78,8 @@ func GetInstalledProgrammers(srv rpc.ArduinoCoreServiceServer) []string {
78
78
79
79
// GetUninstallableCores is an helper function useful to autocomplete.
80
80
// It returns a list of cores which can be uninstalled
81
- func GetUninstallableCores () []string {
82
- inst := instance .CreateAndInit ()
81
+ func GetUninstallableCores (srv rpc. ArduinoCoreServiceServer , ctx context. Context ) []string {
82
+ inst := instance .CreateAndInit (srv , ctx )
83
83
84
84
platforms , _ := commands .PlatformSearch (& rpc.PlatformSearchRequest {
85
85
Instance : inst ,
@@ -99,8 +99,8 @@ func GetUninstallableCores() []string {
99
99
100
100
// GetInstallableCores is an helper function useful to autocomplete.
101
101
// It returns a list of cores which can be installed/downloaded
102
- func GetInstallableCores () []string {
103
- inst := instance .CreateAndInit ()
102
+ func GetInstallableCores (srv rpc. ArduinoCoreServiceServer , ctx context. Context ) []string {
103
+ inst := instance .CreateAndInit (srv , ctx )
104
104
105
105
platforms , _ := commands .PlatformSearch (& rpc.PlatformSearchRequest {
106
106
Instance : inst ,
@@ -118,18 +118,18 @@ func GetInstallableCores() []string {
118
118
119
119
// GetInstalledLibraries is an helper function useful to autocomplete.
120
120
// It returns a list of libs which are currently installed, including the builtin ones
121
- func GetInstalledLibraries () []string {
122
- return getLibraries (true )
121
+ func GetInstalledLibraries (srv rpc. ArduinoCoreServiceServer , ctx context. Context ) []string {
122
+ return getLibraries (srv , ctx , true )
123
123
}
124
124
125
125
// GetUninstallableLibraries is an helper function useful to autocomplete.
126
126
// It returns a list of libs which can be uninstalled
127
- func GetUninstallableLibraries () []string {
128
- return getLibraries (false )
127
+ func GetUninstallableLibraries (srv rpc. ArduinoCoreServiceServer , ctx context. Context ) []string {
128
+ return getLibraries (srv , ctx , false )
129
129
}
130
130
131
- func getLibraries (all bool ) []string {
132
- inst := instance .CreateAndInit ()
131
+ func getLibraries (srv rpc. ArduinoCoreServiceServer , ctx context. Context , all bool ) []string {
132
+ inst := instance .CreateAndInit (srv , ctx )
133
133
libs , _ := commands .LibraryList (context .Background (), & rpc.LibraryListRequest {
134
134
Instance : inst ,
135
135
All : all ,
@@ -147,8 +147,8 @@ func getLibraries(all bool) []string {
147
147
148
148
// GetInstallableLibs is an helper function useful to autocomplete.
149
149
// It returns a list of libs which can be installed/downloaded
150
- func GetInstallableLibs () []string {
151
- inst := instance .CreateAndInit ()
150
+ func GetInstallableLibs (srv rpc. ArduinoCoreServiceServer , ctx context. Context ) []string {
151
+ inst := instance .CreateAndInit (srv , ctx )
152
152
153
153
libs , _ := commands .LibrarySearch (context .Background (), & rpc.LibrarySearchRequest {
154
154
Instance : inst ,
@@ -165,10 +165,10 @@ func GetInstallableLibs() []string {
165
165
// GetAvailablePorts is an helper function useful to autocomplete.
166
166
// It returns a list of upload port of the boards which are currently connected.
167
167
// It will not suggests network ports because the timeout is not set.
168
- func GetAvailablePorts (srv rpc.ArduinoCoreServiceServer ) []* rpc.Port {
168
+ func GetAvailablePorts (srv rpc.ArduinoCoreServiceServer , ctx context. Context ) []* rpc.Port {
169
169
// Get the port list
170
- inst := instance .CreateAndInit ()
171
- list , _ := srv .BoardList (context . Background () , & rpc.BoardListRequest {Instance : inst })
170
+ inst := instance .CreateAndInit (srv , ctx )
171
+ list , _ := srv .BoardList (ctx , & rpc.BoardListRequest {Instance : inst })
172
172
173
173
// Transform the data structure for the completion (DetectedPort -> Port)
174
174
return f .Map (list .GetPorts (), (* rpc .DetectedPort ).GetPort )
0 commit comments