File tree 1 file changed +22
-4
lines changed
1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change 7
7
"net/http"
8
8
_ "net/http/pprof"
9
9
"os"
10
+ "os/exec"
10
11
"os/signal"
11
12
12
13
"github.com/arduino/arduino-language-server/ls"
@@ -68,15 +69,32 @@ func main() {
68
69
log .SetOutput (os .Stderr )
69
70
}
70
71
71
- if * cliPath != "" {
72
+ if * cliDaemonAddress != "" || * cliDaemonInstanceNumber != - 1 {
73
+ // if one is set, both must be set
74
+ if * cliDaemonAddress == "" || * cliDaemonInstanceNumber == - 1 {
75
+ log .Fatal ("ArduinoCLI daemon address and instance number must be set." )
76
+ }
77
+ } else {
72
78
if * cliConfigPath == "" {
73
79
log .Fatal ("Path to ArduinoCLI config file must be set." )
74
80
}
75
- } else if * cliDaemonAddress == "" || * cliDaemonInstanceNumber == - 1 {
76
- log .Fatal ("ArduinoCLI daemon address and instance number must be set." )
81
+ if * cliPath == "" {
82
+ bin , _ := exec .LookPath ("arduino-cli" )
83
+ if bin == "" {
84
+ log .Fatal ("Path to ArduinoCLI must be set." )
85
+ }
86
+ log .Printf ("arduino-cli found at %s\n " , bin )
87
+ * cliPath = bin
88
+ }
77
89
}
90
+
78
91
if * clangdPath == "" {
79
- log .Fatal ("Path to Clangd must be set." )
92
+ bin , _ := exec .LookPath ("clangd" )
93
+ if bin == "" {
94
+ log .Fatal ("Path to Clangd must be set." )
95
+ }
96
+ log .Printf ("clangd found at %s\n " , bin )
97
+ * clangdPath = bin
80
98
}
81
99
82
100
config := & ls.Config {
You can’t perform that action at this time.
0 commit comments