espressif / idf-eclipse-plugin

Espressif-IDE (based on Eclipse CDT) for ESP-IDF CMake based projects 4.x and above
Eclipse Public License 2.0
312 stars 121 forks source link

Espressif-IDE Code Formatting not working (IEP-1349) #1072

Open sanderdb01 opened 1 week ago

sanderdb01 commented 1 week ago

When I open a c file in the editor, none of the shortcuts or code editing works. When I click "Source" on the menu bar, everything in grayed out. I tried resetting my perspective to C/C++, but that still did not solve it. I am on a Mac if that helps. Thanks.

sigmaaa commented 6 days ago

Hi @sanderdb01,

some options don't work with the new LSP editor that we are using. You can still use some Source commands with the right click inside the editor. For the formatting you can try the default key combination cmd+shift+F. You can also set to auto-trigger the formatting with the save action. To do this go to the Preferences -> C/C++ -> Editor(LSP) -> Format source code image

Note that the formatter settings could be changed by editing the .clang-format file inside the project. https://github.com/eclipse-cdt/cdt-lsp?tab=readme-ov-file#save-actions-using-clang-format

sanderdb01 commented 5 days ago

got you, thank you for the response. Is there a way to auto comment? Usually on other IDEs I can do cmd/ctrl+ '/' to comment out a line, but that does not work here. According to the IDEs shortcuts, it should be cmd+shift+/, but when I press that, the help search comes up (even if I am clicked into a c file so that should have focus). Thanks.

sigmaaa commented 5 days ago

Hi @sanderdb01,

the default combination for commenting out the line in the LSP editor is ctrl + 7, but cmd+shift+/ should also work. I was able to reproduce this issue and will take a closer look into it. It's also possible to rebind this combination. To do this:

Thank you