Skip to content

Automatically detect the path of clangd, arduino-cli, and its configuration #115

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 3 commits into from
Jun 20, 2022
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
Auto-detect arduino-cli.yaml in ~/.arduino15
  • Loading branch information
joewreschnig committed Jun 18, 2022
commit 9d859f47995aedc1aac69ca81d2f5f1b2d1604c2
11 changes: 11 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"os"
"os/exec"
"os/signal"
"os/user"
"path"

"github.com/arduino/arduino-language-server/ls"
"github.com/arduino/arduino-language-server/streams"
Expand Down Expand Up @@ -75,6 +77,15 @@ func main() {
log.Fatal("ArduinoCLI daemon address and instance number must be set.")
}
} else {
if *cliConfigPath == "" {
if user, _ := user.Current(); user != nil {
candidate := path.Join(user.HomeDir, ".arduino15/arduino-cli.yaml")
if _, err := os.Stat(candidate); err == nil {
*cliConfigPath = candidate
log.Printf("ArduinoCLI config file found at %s\n", candidate)
}
}
}
if *cliConfigPath == "" {
log.Fatal("Path to ArduinoCLI config file must be set.")
}
Expand Down