Genio-The-Haiku-IDE / Genio

The Haiku IDE
Other
69 stars 8 forks source link

Add configuration of coding style to Project settings #291

Open humdingerb opened 10 months ago

humdingerb commented 10 months ago

The "Format" menu item works, if there is a .clang-format file in a project's top folder.

However, if there is no .clang-format file, some formatting is applied, though I'm not clear what defaults are used. The indention is changed to two spaces instead of a tab, for example.

I think it would be best to have the user configure this in the "Project settings". There could be a pop-up menu "Use coding style:" and the options "none", "Haiku" and "from Project".

If there's no .clang-format file in the project's top folder, disable "from Project" and make "none" the default. In that case, disable "Edit|Format". Otherwise default to "from Project".

The menu could be renamed to "Apply coding style" which is more decriptive.

Freaxed commented 10 months ago

The default is the "LLVM coding style". Keep in mind that 'Format' is a LSP command (https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_formatting) and depends on the LSP in use for a specific file. For example pylsp (lsp server for python) has a different default style and a different config file... So the configuration must be per lsp server. Another point is that the "Haiku format" is not exactly following all the haiku rules (only with the haiku-format tool you can have it but is an external tool).