decompme / decomp.me

Collaborative decompilation and reverse engineering website
https://decomp.me
MIT License
348 stars 108 forks source link

Add options for Clangd formatting file per template #1235

Open weirdbeardgame opened 1 month ago

weirdbeardgame commented 1 month ago

Is your feature request related to a problem? Please describe. When uploading scratches line spacing and new line formatting doesn't match a particular coding style I always like to use and id prefer to be able to set my own formatting.

Describe the solution you'd like Add an option when editing a preset to upload a .clangd file that can then apply to every scratch using that preset.

Additional context Think how VScode and other editors have formattable spacing and new line guidelines.

bates64 commented 1 month ago

IMO:

  1. https://github.com/decompme/decomp.me/issues/361
  2. Read .clang-format
ethteck commented 1 month ago

My vote here would be to just use localstorage to allow users to put their own clang-format file in, continuing the local settings-esque nature of this feature. At some point, we could have an optional field on Preset that lets you format with the Preset (project)'s settings if they are present. But I think it's probably best to keep things client-side for now

Currently, the only formatting we run at all is done in the browser, it must be invoked manually, and it requires the language server to be enabled. So before we do much more with that feature, we should probably decide how far we want to go with it. Should we be doing backend formatting? I would prefer we don't, since I think it's kind of out of scope, but it's a conceivable direction

Personally, I think of the code formatting feature as something that's a nice-to-have as a result of having a language server, not a core site feature. The site is meant for figuring out matches, rather than producing polished code for a repo. But since we run clang-format browser-side, having a localstorage clang-format file seems appropriate