Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preferences -> C/C++ -> Editor (LSP) -> clangd: The currently displayed page contains invalid values. #441

Closed
joaopedrotaveira opened this issue Feb 22, 2025 · 8 comments

Comments

@joaopedrotaveira
Copy link

Hi,

The new banner showed up to try new Editor (LSP) but I can’t get it to work.


!MESSAGE java.lang.NoSuchMethodError: 'org.eclipse.core.runtime.preferences.PreferenceMetadata org.eclipse.cdt.lsp.clangd.ClangdMetadata.clangdPath()'
!STACK 0
java.lang.NoSuchMethodError: 'org.eclipse.core.runtime.preferences.PreferenceMetadata org.eclipse.cdt.lsp.clangd.ClangdMetadata.clangdPath()'
	at com.espressif.idf.lsp.preferences.IDFClangdPreferredOptions.clangdPath(IDFClangdPreferredOptions.java:30)
	at org.eclipse.cdt.lsp.clangd.internal.ui.ClangdConfigurationArea.optionsChanged(ClangdConfigurationArea.java:246)
	at org.eclipse.cdt.lsp.clangd.internal.ui.ClangdConfigurationPage.configurationSettingsChanged(ClangdConfigurationPage.java:74)
	at org.eclipse.cdt.lsp.clangd.internal.ui.ClangdConfigurationPage.performOk(ClangdConfigurationPage.java:58)
	at org.eclipse.jface.preference.PreferenceDialog$7.run(PreferenceDialog.java:905)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
	at org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.java:889)
	at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.okPressed(FilteredPreferenceDialog.java:449)
	at org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDialog.java:233)
	at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619)
	at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:83)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:286)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4660)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1657)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1680)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1665)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1394)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4427)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4003)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:823)
	at org.eclipse.jface.window.Window.open(Window.java:799)
	at org.eclipse.ui.internal.handlers.ShowPreferencePageHandler.execute(ShowPreferencePageHandler.java:58)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:277)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:98)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:299)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:233)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:174)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:165)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:485)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:204)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:186)
	at org.eclipse.e4.ui.workbench.renderers.swt.cocoa.CocoaUIHandler.runCommand(CocoaUIHandler.java:421)
	at org.eclipse.e4.ui.workbench.renderers.swt.cocoa.CocoaUIHandler$1.widgetSelected(CocoaUIHandler.java:281)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:286)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4660)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1657)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1680)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1665)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1394)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4427)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4003)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:668)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:576)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:178)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
@jonahgraham
Copy link
Member

HI @joaopedrotaveira Thank you for trying out the pre-release of Eclipse CDT. This is very much appreciated!

I notice in your stack trace it has "com.espressif.idf.lsp.preferences.IDFClangdPreferredOptions.clangdPath(IDFClangdPreferredOptions.java:30)" which implies you obtained this, in part, from Espressif.

Can you explain how to reproduce your setup? Did you update the Espressif IDE to the pre-release of Eclipse CDT?

@jonahgraham
Copy link
Member

I'm having a look at the class with the error and that code is only for the previous version of CDT. The pre-release of Eclipse CDT + Eclipse CDT-LSP requires that Espressif update their code to work with the latest version.

The refactored code is in #410 (comment).

In the meantime, I do encourage you to test out the pre-release of Eclipse CDT, but you'll have to test it out without the Espressif plug-ins until they make an update.

I have added to the previously raised espressif/idf-eclipse-plugin#1127 this issue.

@joaopedrotaveira
Copy link
Author

Hi @jonahgraham

My setup is based on Eclipse IDE for C/C++ Developers. I might installed the IDF plugin in the past.

This is what shows up on “About Eclipse”:

Eclipse IDE for C/C++ Developers (includes Incubating components)

Version: 2025-03 M3 (4.35.0 M3)
Build id: 20250220-0946

Expressif -> Product Information:

Operating System: mac os x
Java Runtime Version: 23.0.2+7
Eclipse Version: 4.35.0.v20250213-1800
Eclipse CDT Version: 12.0.0.202501171709
IDF Eclipse Plugin Version: 3.2.0.202501110717
ESP-IDF version cannot be checked. IDF_PATH or IDF_PYTHON_ENV_PATH  are not set.
Python set for IDF_PYTHON_ENV: <NOT FOUND>

@jonahgraham
Copy link
Member

Hi @joaopedrotaveira - if you can uninstall the IDF plugin hopefully it will start working as expected.

You may find it cleaner to create a new install for testing the pre-release. Thanks again for taking the time to test and and report back your findings. With any luck IDF plugins can be updated soon so they continue to work with the upcoming release.

@joaopedrotaveira
Copy link
Author

Hi @jonahgraham

The IDF plugin was uninstalled very quickly. The LSP started working but the experience is not what I expected. I’m still used to classic experience.

Using the LSP editor with a common autoconf-tools project, everything works perfectly.

When I try to use a project which was configured by platformio under the hood, the references between included files doesn’t work as I would like to. I might be doing something wrong or the “Path and Symbols” project settings might not being passed to clang server. I don’t know, this is my first time.

But it works now.

Thank very much.

@jonahgraham
Copy link
Member

Thanks for that @joaopedrotaveira

The classic experience is going to be around for a long time still. The LSP experience is most suitable for users who are reaching the limits of the classic editor, most acutely for those users on the most recent C++ standards.

The specific feedback on project types is very helpful, and I am delighted to hear the autoconf one worked out of the box.

My immediate guess on the platformio one is the same as you - that clangd can't find some of the paths. Configuring clangd to find everything the most successfully involves having the builder generate a compile_commands.json file that clangd knows how to read. We are looking at whether we can generate compile_commands.json for tool chains that don't do it natively.

Would you know of a good tutorial/example project that can demonstrate how platformio is setup best in Eclipse CDT to see if we can make sure that flow works well in the future with CDT LSP editor?

Thanks!

@joaopedrotaveira
Copy link
Author

joaopedrotaveira commented Feb 22, 2025

Hi

  1. Install platformio as instructed here.
  2. create project folder:
$ mkdir -s /tmp/platformio-blink-test-1
  1. Initialize a new project with some board, but specify eclipse as IDE
$ cd /tmp/platformio-blink-test-1
$ platformio project init --board esp32-s3-devkitc-1 --ide eclipse
  1. add basic example of code to src, example blink.cpp:
/**
 * Blink
 * Turns on an LED on for one second,
 * then off for one second, repeatedly.
 */
#include "Arduino.h"

void setup()
{
  // initialize LED digital pin as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
  // turn the LED on (HIGH is the voltage level)
  digitalWrite(LED_BUILTIN, HIGH);
  // wait for a second
  delay(1000);
  // turn the LED off by making the voltage LOW
  digitalWrite(LED_BUILTIN, LOW);
   // wait for a second
  delay(1000);
}
  1. one can see that eclipse project files are in the folder
$ ls -a
.
..
.cproject
.gitignore
.pio
.project
.settings
include
lib
platformio.ini
src
test
  1. open Eclipse for C/C++ Developers and import the project folder

@jonahgraham
Copy link
Member

@joaopedrotaveira Thank you for the steps - I have extracted that and added some analysis in #443

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants