File tree Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change 77	"net/http" 
88	_ "net/http/pprof" 
99	"os" 
10+ 	"os/exec" 
1011	"os/signal" 
1112
1213	"github.com/arduino/arduino-language-server/ls" 
@@ -68,15 +69,32 @@ func main() {
6869		log .SetOutput (os .Stderr )
6970	}
7071
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  {
7278		if  * cliConfigPath  ==  ""  {
7379			log .Fatal ("Path to ArduinoCLI config file must be set." )
7480		}
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+ 		}
7789	}
90+ 
7891	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 
8098	}
8199
82100	config  :=  & ls.Config {
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments