Support global custom formatter configuration #566
Labels
conclusion: resolved
Issue was resolved
topic: code
Related to content of the project itself
topic: language server
Related to the Arduino Language Server
type: enhancement
Proposed improvement
Code formatting style preferences vary and are often strongly held. For this reason, it's important for development tools to allow customization of the formatter tool.
This is already possible on a per-project basis by adding a
.clang-format
ClangFormat configuration file to the root of the sketch folder. That will be the best approach for collaborative projects, so that the configuration is distributed to all contributors along with the project, ensuring their contributions will be consistent with the project's established code style.However, users also use the Arduino IDE for development of many solo projects. For that use case, it will not be convenient to maintain a copy of the formatter configuration file inside every sketch. Better will be to place a single configuration file in a standardized location, which will be applied to all sketches that don't contain a local configuration file. This idea was discussed during the process of integrating the standardized Arduino ClangFormat configuration to the Arduino Language Server:
arduino/arduino-language-server#69 (comment)
The capability was added to Arduino Language Server at that time in the form of a
format-conf-path
flag, through which the path to the global configuration file may be passed:https://github.com/arduino/arduino-language-server/blob/e453c5fbd059bae673bb21d028f5ca8e690744be/main.go#L35
It doesn't appear that Arduino IDE has been configured to use that capability yet though.
There may be a decision regarding where the file should be located:
~/.arduinoIDE/.clang-format
<directories.data>/.clang-format
(e.g.,~/.arduino15/.clang-format
)The Java IDE has support for placing its
formatter.conf
file indirectories.data
, so the ability to set a global custom formatter configuration is a matter of feature parity.Customizing the formatting style is something only advanced users will be interested in, so I don't see any need for GUI changes related to this work.
Fixes #94
Fixes #439
Part of best efforts to mitigate #42
The text was updated successfully, but these errors were encountered: