Very disappointed in the decision to use the C/C++ (LSP) editor

ESP_aliazamrana
Posts: 9
Joined: Wed Nov 10, 2021 11:01 am

Re: Very disappointed in the decision to use the C/C++ (LSP) editor

Postby ESP_aliazamrana » Wed Dec 04, 2024 12:59 pm

The CDT LSP Editor is based on TextMate in eclipse.

So for now there are a few options for you to configure this and get around the issue of inactive code being highlighted as a comment. The easiest is to just switch the theme.

If you right click on the opened file in the editor you can see this option
Screenshot 2024-12-04 135612.png
Screenshot 2024-12-04 135612.png (199.08 KiB) Viewed 1389 times
If you switch to the Light theme you should have a clear difference between the inactive code and the comments.

Also you can choose the Eclipse Light if you want something similar to CDT C/C++ editor.

The other option is that you can create your own css files for syntax highlighting that is a bit tricky but if you look around the TM4E github repo you can find predefined css styles and then you can modify and add them to the TextMate preferences under Themes in Eclipse's Preferences.
https://github.com/eclipse-tm4e/tm4e

ESP_aliazamrana
Posts: 9
Joined: Wed Nov 10, 2021 11:01 am

Re: Very disappointed in the decision to use the C/C++ (LSP) editor

Postby ESP_aliazamrana » Wed Dec 04, 2024 1:03 pm

martins wrote:
Mon Dec 02, 2024 8:29 am
I tried the v3.1.0, but inactive code is still marked as comment instead of just background highlight of whole block while keeping original syntax highlight. Unless I missed some settings?

See https://github.com/clangd/vscode-clangd ... 1502199447 for reference.
Hi Please see the last comment
viewtopic.php?f=40&t=41302&p=141374#p141374

martins
Posts: 55
Joined: Tue Aug 24, 2021 8:58 am

Re: Very disappointed in the decision to use the C/C++ (LSP) editor

Postby martins » Thu Dec 05, 2024 8:23 am

Ok, so you can change its color, but it is still basically "commented out" at it changes color of the text, therefore we loose original syntax highlight of the inactive code.

But I want to keep the original text color, just change the background. And not just background of the text itself, but background of whole inactive block of code.

And judging by the vscode-clangd extension discussions that may not be as simple as it sounds (they basically had to create their own protocol for this feature to work correctly).

emaayan
Posts: 14
Joined: Sun Mar 05, 2023 6:16 pm

Re: Very disappointed in the decision to use the C/C++ (LSP) editor

Postby emaayan » Sun Dec 15, 2024 6:49 am

gtjoseph wrote:
Tue Aug 13, 2024 4:30 pm
ESP_kondalkolipaka wrote:
Tue Aug 13, 2024 6:28 am
Hello,

I have published a blog post on why we have moved to the LSP Editor and what it offers. Please check here
https://developer.espressif.com/blog/es ... p-support/
Many users have been reporting that the Eclipse CDT Editor/Indexer is unable to resolve headers and compilation units when working with ESP-IDF v5.0 and higher. This issue arises because the Eclipse CDT only supports the versions up to C++14. However, ESP-IDF v5.0 uses C++20 (with GCC 11.2) and ESP-IDF v5.2 uses C++23 (with GCC 13.1).
OK, that's fair.
ESP_kondalkolipaka wrote:
Tue Aug 13, 2024 6:28 am
Improving the CDT Parser with the new language grammar is a huge task that requires dedicated resources. However, we feel this is not a productive task as the world is moving towards LSP-based editors; therefore, putting efforts there is not a viable option. Importantly, we need to constantly update the parser whenever there is new version support.
OK, also fair.
ESP_kondalkolipaka wrote:
Tue Aug 13, 2024 6:28 am

We will be addressing some of the limitations mentioned above in upcoming releases.

> Doesn't use the C/C++ Code Formatter
LSP based editor uses clang based formatter, please refer to this
https://developer.espressif.com/blog/es ... formatting
https://github.com/espressif/idf-eclips ... 2202018650
Using .clang-format is quite hard because you can't immediately see the result. You have to actually do a reformat. Having https://clang.llvm.org/docs/ClangFormat ... tions.html open in another window or tab helps but it's still not easy.

There's no format-as-you-type.

Some settings will also conflict with those in General -> Editors. Tab type (spaces or tabs) and Tab Width for instance. clang-format defaults to a TabWidth of 4 and "use spaces". If you set "use tabs" in General -> Editors, tabs will be used as you type but on a reformat, the tabs will be replaced with spaces. You have to set "UseTabs: Always" in .clang-format to make sure it stays tabs after a reformat.
ESP_kondalkolipaka wrote:
Tue Aug 13, 2024 6:28 am

> Doesn't even obey the tab size and type set in General/Editors
The LSP Editor is based on the standard editor. You can set the tab width, line spacing, etc., from Preferences > General > Editors > Text Editors.
See above.
ESP_kondalkolipaka wrote:
Tue Aug 13, 2024 6:28 am

> Missing context menu items like Declarations and References.
Agreed.However, you should be able to use Ctrl+click or F3. If, for some reason, this is not working, please check here.
https://github.com/espressif/idf-eclips ... 2276935107
For finding the declaration, yes. There's no equivalent for finding usages as far as I can tell.
ESP_kondalkolipaka wrote:
Tue Aug 13, 2024 6:28 am

>It's SLOW
My observation is that the LSP indexer is faster compared old indexer. Please share your findings on this with details.
It's the speed of the hovers that's seems slower.
ESP_kondalkolipaka wrote:
Tue Aug 13, 2024 6:28 am

> No coloring for code deactivated by preprocessor #if/#endif
This is addresed on master branch, will be available in the next release 3.1.0.
Here is the master build if you want to try.
https://github.com/espressif/idf-eclips ... 1800310442
I'll give it a shot today.
ESP_kondalkolipaka wrote:
Tue Aug 13, 2024 6:28 am

> The hovers are overly intrusive
Please share more details for investigation.
Unfortunately we can't easily paste images here but here's the hover for the max_cmdline_length member of the esp_console_config_t structure in the CDT...

Code: Select all

size_t max_cmdline_length;  //!< length of command line buffer, in bytes
Here's the hover using the LSP editor...

Code: Select all

field max_cmdline_length

Type: size_t (aka unsigned int)
length of command line buffer, in bytes

// In (anonymous struct)
public: size_t max_cmdline_length
The CDT version is just one line and is all you need.

There also doesn't seem to be a way to control proposals. If I start typing "st" I really don't need to see a list pop up listing every function in the universe that starts with "st".
ESP_kondalkolipaka wrote:
Tue Aug 13, 2024 6:28 am


Thank you for sharing your views and concerns. I’m sure we will turn this around in a couple of releases.
We'll see how it goes. I've reverted to 2.12.1 for now but also have the Espressif IDE 3.0.0 bundle installed so I can see them side-by-side.

i just found this post via google, when i searched on why are all the refactoring tools disabled, it appears that when using the regular editor CDT they are enabled while on LSP editor they are not why?

Who is online

Users browsing this forum: No registered users and 29 guests