arduino / arduino-language-server

An Arduino Language Server based on Clangd to Arduino code autocompletion
GNU Affero General Public License v3.0
133 stars 11 forks source link

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

Closed joewreschnig closed 2 years ago

joewreschnig commented 2 years ago

Please check if the PR fulfills these requirements

Tests have not been added because I don't see any tests for command option handling in the existing code.

What kind of change does this PR introduce? Better out-of-the-box configuration by default.

What is the current behavior? arduino-language-server always requires providing full arduino-cli and clangd executable paths, and the arduino-cli configuration file path, even though these may vary across systems. This makes them difficult to include in project/editor configuration which is the same across systems.

What is the new behavior? There should be no differences in behavior for successful runs.

Previously failing commands may now be successful if everything can be autodetected, along with printing a log message saying so.

Error messages will be different for failed runs when a configuration file is provided but arduino-cli could not be detected - previously it would ask for a daemon address, now it will ask for a path to arduino-cli.

Other information: I've split the PR into separate commits for searching $PATH vs. finding the configuration file as they may have different issues to discuss. (Or if there is a better / more thorough way of finding the default configuration file I'm not aware of.)

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.

cmaglie commented 2 years ago

Thank you!