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

non working CDT-LDP after installation of IDF-Eclipse-Plugin (IEP-1504)

Open mzimail opened this issue 8 months ago • 4 comments

Describe the bug As soon as ESP-IDF-Eclipse Plugin is installed, other projects using CDT-LSP (standard C/C++ project using editor with clangd language server) are not working any more: Language Server (clangd-19) is not started. This applies to existing and new C/C++ projects, regardless of there are any ESP-IDF projects in the same workspace or not. Simple installation of ESP-IDF-Eclipse breaks previously working projects of those other natures.

To Reproduce Steps to reproduce the behavior:

  1. Create blank Workspace
  2. Click on 'File -> New -> C/C++ Project'
  3. Choose "CMake Project"
  4. Click "Next"
  5. Assign Project Name "x86helloworld"
  6. Click "Finish"
  7. Open "x86helloworld.cpp" using "C/C++ Editor (LSP)"
  8. Open "Windows -> Whow View -> Other -> Language Servers -> Language Servers"

Expected behavior The configured language server (/usr/bin/clangd-19 in this case) should be started just at is if, when ESP-IDF-plugin is not installed. Syntax errors should be highlighted in editor accordlingly, but they aren't.

Screenshots

Image

Espressif-IDE Product Information: idfproductinfo.txt

Eclipse Error log: errorlog.log

**

mzimail avatar Apr 03 '25 20:04 mzimail

Hi @mzimail! This is an automated response. If you don’t find the answer helpful, please check the ESP32 IDE forum (https://www.esp32.com/viewforum.php?f=40) or GitHub issues (https://github.com/espressif/idf-eclipse-plugin/issues) to see if the issue has already been discussed.


Based on the information provided in the knowledge sources, I can see that your issue relates to the CDT-LSP functionality in Espressif-IDE. This appears to be a conflict between the Espressif-IDE plugin and standard C/C++ projects using the clangd language server.

The recent Espressif-IDE v3.0.0 introduced significant changes to the LSP support for C/C++ editors. As mentioned in the documentation, Espressif-IDE now uses Eclipse CDT-LSP plugins and a new LSP C/C++ Editor powered by the LLVM clangd C/C++ language server Espressif-IDE v3.0.0 — LSP Support for C/C++ Editor.

The issue you're experiencing might be related to how the Espressif-IDE configures clangd. According to the documentation, Espressif-IDE sets up specific configurations for clangd to work with ESP-IDF projects, including custom paths and compilation database settings Espressif-IDE v3.0.0 — LSP Support for C/C++ Editor.

For troubleshooting this issue, I recommend:

  1. Check the clangd configuration in preferences as mentioned in the documentation. The plugin might be overriding your existing clangd settings.

  2. Review the .clangd configuration file that might have been created or modified by the Espressif-IDE plugin.

  3. Consider reporting this issue to the Espressif-IDE GitHub repository as mentioned in their documentation: "If you have further improvement ideas or if you encounter any issues while using Espressif-IDE, do not hesitate to report them in the project's GitHub issues."

The most recent version (Espressif-IDE 3.1.0) includes "CDT LSP 2.0 Integration" with "Full support for CDT Language Server Protocol (LSP) 2.0" New Release: Espressif IDE 3.1.0, so updating to this version might also help resolve your issue.

github-actions[bot] avatar Apr 03 '25 20:04 github-actions[bot]

Hi @mzimail

Could you please check the Clangd preferences page?

Image

sigmaaa avatar Apr 04 '25 08:04 sigmaaa

Hi @sigmaaa, thanks for having a closer look at my problem.

The LSP Preferences page looks like this, when in an Workspace with ESP-IDF projects, according clangd from ESP-IDF is then starting as expected:

Image

The LSP Preferences page looks like this, when in an Workspace with pure C/C++ projects, then clangd is not starting as soon as IDF-eclipse-plugin is installed, but clangd would start using the same settings as soon as IDF-eclipse-plugin is not installed:

Image

So Installation of the plugin effectively breaks projects / configurations that used to work previously.

mzimail avatar Apr 04 '25 19:04 mzimail

Hi @mzimail,

I wasn't able to reproduce the exact issue you described. After installing our plugin on top of CDT with LSP support, the language server continued to function correctly after both installation and restart.

It's possible there was an exception on the clangd server side, but I didn’t find anything relevant in the logs. The only suspicious detail I noticed is that the log reports a null value for the clangd path, which might be worth investigating further.

That said, let me clarify how the idf-eclipse plugin interacts with LSP preferences and what might be influencing your setup.

(For reference, I’m using the master version of the plugin. While version 3.3.0 has a few differences, the general behavior and design goals are similar.)

After installing the plugin, the next step is to configure the ESP-IDF via the ESP-IDF Manager in the IDE. During this setup, the plugin automatically switches to using the clangd server bundled with the Espressif tools. This design choice helps avoid requiring users to manually reconfigure the language server each time they install a different ESP-IDF version.

Additionally:

When the launch target is switched to an IDF-related one, we update the query-driver settings.

After a project is built, we update the compile-commands-dir and restart the clangd server.

On the master branch, we also trigger a server restart when files are opened in the editor to ensure accurate source navigation.

We understand that this automatic behavior may not suit users with custom configurations. We're considering adding an option in the Espressif preferences to disable automatic clangd updates for such cases.

Thanks again for reporting this—it helps us continue improving the plugin!

sigmaaa avatar Apr 07 '25 14:04 sigmaaa