idf-eclipse-plugin icon indicating copy to clipboard operation
idf-eclipse-plugin copied to clipboard

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

Open sanderdb01 opened this issue 1 year ago • 4 comments

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.

sanderdb01 avatar Oct 29 '24 19:10 sanderdb01

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

sigmaaa avatar Oct 30 '24 15:10 sigmaaa

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.

sanderdb01 avatar Oct 31 '24 17:10 sanderdb01

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:

  • Go to the Preferences -> General -> keys -> look for Toggle Line Comment in the TM4E configuration: image

Thank you

sigmaaa avatar Oct 31 '24 18:10 sigmaaa

great, thanks. I modified that and it worked. Why does it not work when it is under C/C++ Editor? Just curious.

sanderdb01 avatar Nov 06 '24 18:11 sanderdb01