eclipse-cdt / cdt-lsp

Eclipse CDT™ LSP Extensions for CDT
Eclipse Public License 2.0
26 stars 11 forks source link

An internal error occurred during: "DSF Source Lookup" #320

Closed BenthamSoftwareServices closed 4 months ago

BenthamSoftwareServices commented 4 months ago

Message windows appears = error.log

Error occurs when Launching any ESP-IDF project in Debug mode.

Eclipse IDE for Embedded C/C++ Developers (includes Incubating components) Version: 2024-03 (4.31.0) Build id: 20240307-1437 OS: Windows 11, v.10.0, x86_64 / win32 Java vendor: Eclipse Adoptium Java runtime version: 17.0.11+9 Java version: 17.0.11

Using ESP-IDF v5.2.1

error.log

OKing the error message Window closes it and appears to have no effect on normal debugging operation. I would like to fix the source of the error, or, if that is not possible, supress it.

[x ] I understand reporting an issue to this OSS project does not mandate anyone to fix it. Other contributors may consider the issue, or not, at their own convenience. The most efficient way to get it fixed is that I fix it myself and contribute it back as a good quality patch to the project.

ghentschke commented 4 months ago

Hi, when I take a look at the log file I don't think that this is an cdt-lsp issue. IMO its an esspressif project/IDE issue.

jonahgraham commented 4 months ago

I think there is a null check missing in org.eclipse.cdt.lsp.util.LspUtils.isFileOpenedInLspEditor(IEditorInput) as this code probably shouldn't throw an NPE. But the underlying error is that it looks like isFileOpenedInLspEditor is assuming it is called from the main thread, but in this case it is being called from a job, leading the editor to fail to initialize (restore).

Will a change like this resolve the issue, i.e. getting the editor id from the editor reference, rather than fully restoring the editor?

diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/util/LspUtils.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/util/LspUtils.java
index b89ca53..6915672 100644
--- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/util/LspUtils.java
+++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/util/LspUtils.java
@@ -94,7 +94,7 @@
                    continue;
                }
                if (editorInput.equals(editorInputFromEditor)) {
-                   return LspPlugin.LSP_C_EDITOR_ID.equals(editor.getEditor(true).getEditorSite().getId());
+                   return LspPlugin.LSP_C_EDITOR_ID.equals(editor.getId());
                }
            }
            // the file has not been opened yet:
jonahgraham commented 4 months ago

@BenthamSoftwareServices can you try to apply the patch and let us know the results. We have ~2 weeks until we release so now is an excellent time to resolve this.

ghentschke commented 4 months ago

Thanks @jonahgraham for finding this possible NPE. I created a PR to fix it. This code line will be called when a an external C/C++ file (e.g. a standard library header) is already opened in an editor.

BenthamSoftwareServices commented 4 months ago

@BenthamSoftwareServices can you try to apply the patch and let us know the results. We have ~2 weeks until we release so now is an excellent time to resolve this.

Yes I would like to try the patch, can you explain to me where it is and how to apply it please.

ghentschke commented 4 months ago

@BenthamSoftwareServices which version of cdt-lsp are you using?

BenthamSoftwareServices commented 4 months ago

Is this what you are looking for: C:\Espressif\tools\esp-clang\16.0.1-fe4f10a809\esp-clang\bin\clangd.exe

BenthamSoftwareServices commented 4 months ago

image Or is this the cdt version? I have only just started using Eclipse so if you need some other info please tell me where to find also - thanks.

ghentschke commented 4 months ago

Or is this the cdt version?

You are close: please type LSP. I need the version of the C/C++ LSP Support feature

BenthamSoftwareServices commented 4 months ago

image

BenthamSoftwareServices commented 4 months ago

*** Date: Wednesday, 22 May 2024 at 14:12:25 British Summer Time

*** Platform Details:

*** System properties:

*** System environment variables:

*** Features:

*** Plug-in Registry: com.espressif.idf.lsp (1.0.1.202405161213) "ESP-IDF LSP Plugin" [Active] org.eclipse.cdt.lsp (1.0.0.202402211419) "Language Server based C/C++ Editor" [Active] org.eclipse.cdt.lsp.clangd (1.0.0.202402211419) "Clangd Language Server Support" [Active] org.eclipse.lsp4e (0.18.6.202403050753) "Language Server Protocol client for Eclipse IDE (Incubation)" [Active] org.eclipse.lsp4j (0.22.0.v20240213-2011) "org.eclipse.lsp4j" [Resolved] org.eclipse.lsp4j.jsonrpc (0.22.0.v20240213-2011) "org.eclipse.lsp4j.jsonrpc" [Resolved]

*** User Preferences: /bundle_defaults/org.eclipse.cdt.lsp.clangd/additional_options= /bundle_defaults/org.eclipse.cdt.lsp.clangd/background_index=true /bundle_defaults/org.eclipse.cdt.lsp.clangd/clangd_path=C\:\Espressif\tools\esp-clang\16.0.1-fe4f10a809\esp-clang\bin\clangd.exe /bundle_defaults/org.eclipse.cdt.lsp.clangd/completion_style=detailed /bundle_defaults/org.eclipse.cdt.lsp.clangd/pretty_print=true /bundle_defaults/org.eclipse.cdt.lsp.clangd/query_driver= /bundle_defaults/org.eclipse.cdt.lsp.clangd/use_tidy=true /bundle_defaults/org.eclipse.ui.editors/LSP4EReadOccurrenceHighlighting=true /bundle_defaults/org.eclipse.ui.editors/LSP4EReadOccurrenceIndication=false /bundle_defaults/org.eclipse.ui.editors/LSP4EReadOccurrenceIndicationColor=212,212,212 /bundle_defaults/org.eclipse.ui.editors/LSP4EReadOccurrenceIndicationInOverviewRuler=true /bundle_defaults/org.eclipse.ui.editors/LSP4EReadOccurrenceIndicationInVerticalRuler=false /bundle_defaults/org.eclipse.ui.editors/LSP4EReadOccurrenceTextStyle=NONE /bundle_defaults/org.eclipse.ui.editors/LSP4ETextOccurrenceHighlighting=true /bundle_defaults/org.eclipse.ui.editors/LSP4ETextOccurrenceIndication=false /bundle_defaults/org.eclipse.ui.editors/LSP4ETextOccurrenceIndicationColor=212,212,212 /bundle_defaults/org.eclipse.ui.editors/LSP4ETextOccurrenceIndicationInOverviewRuler=true /bundle_defaults/org.eclipse.ui.editors/LSP4ETextOccurrenceIndicationInVerticalRuler=false /bundle_defaults/org.eclipse.ui.editors/LSP4ETextOccurrenceTextStyle=NONE /bundle_defaults/org.eclipse.ui.editors/LSP4EWriteOccurrenceHighlighting=true /bundle_defaults/org.eclipse.ui.editors/LSP4EWriteOccurrenceIndication=false /bundle_defaults/org.eclipse.ui.editors/LSP4EWriteOccurrenceIndicationColor=240,216,168 /bundle_defaults/org.eclipse.ui.editors/LSP4EWriteOccurrenceIndicationInOverviewRuler=true /bundle_defaults/org.eclipse.ui.editors/LSP4EWriteOccurrenceIndicationInVerticalRuler=false /bundle_defaults/org.eclipse.ui.editors/LSP4EWriteOccurrenceTextStyle=NONE /bundle_defaults/org.eclipse.ui.editors/org.eclipse.lsp4e.documentLinkDetector_stateMask=-1 /bundle_defaults/org.eclipse.ui.editors/org.eclipse.lsp4e.hyperlinkDetector_stateMask=-1 /bundle_defaults/org.eclipse.ui.editors/org.eclipse.lsp4e.read.isGoToNextNavigationTarget=true /bundle_defaults/org.eclipse.ui.editors/org.eclipse.lsp4e.read.isGoToPreviousNavigationTarget=true /bundle_defaults/org.eclipse.ui.editors/org.eclipse.lsp4e.read.showInNextPrevDropdownToolbarAction=true /bundle_defaults/org.eclipse.ui.editors/org.eclipse.lsp4e.text.isGoToNextNavigationTarget=true /bundle_defaults/org.eclipse.ui.editors/org.eclipse.lsp4e.text.isGoToPreviousNavigationTarget=true /bundle_defaults/org.eclipse.ui.editors/org.eclipse.lsp4e.text.showInNextPrevDropdownToolbarAction=true /bundle_defaults/org.eclipse.ui.editors/org.eclipse.lsp4e.write.isGoToNextNavigationTarget=true /bundle_defaults/org.eclipse.ui.editors/org.eclipse.lsp4e.write.isGoToPreviousNavigationTarget=true /bundle_defaults/org.eclipse.ui.editors/org.eclipse.lsp4e.write.showInNextPrevDropdownToolbarAction=true /instance/org.eclipse.cdt.lsp/format_all_lines=true /instance/org.eclipse.cdt.lsp/format_edited_lines=false /instance/org.eclipse.cdt.lsp/format_source=false /instance/org.eclipse.ui.editors/LSP4EReadOccurrenceIndicationColor=27,98,145 /instance/org.eclipse.ui.editors/LSP4ETextOccurrenceIndicationColor=27,98,145 /instance/org.eclipse.ui.editors/LSP4EWriteOccurrenceIndicationColor=27,98,145 /instance/org.eclipse.ui.editors/overriddenByCSS=,org.eclipse.cdt.ui.occurrenceIndicationColor,org.eclipse.cdt.ui.writeOccurrenceIndicationColor,org.eclipse.cdt.ui.overrideIndicatorColor,LSP4EReadOccurrenceIndicationColor,LSP4EWriteOccurrenceIndicationColor,LSP4ETextOccurrenceIndicationColor,TM4EMatchingPairColor,TextOccurrenceIndicationColor,AbstractTextEditor.Color.Background.SystemDefault,AbstractTextEditor.Color.SelectionForeground.SystemDefault,AbstractTextEditor.Color.SelectionBackground.SystemDefault,AbstractTextEditor.Color.Background,AbstractTextEditor.Color.Foreground.SystemDefault,AbstractTextEditor.Color.SelectionBackground,AbstractTextEditor.Color.SelectionForeground,AbstractTextEditor.Color.Foreground,AbstractTextEditor.Color.FindScope,asOccurencesIndicationColor,breakpointIndicationColor,currentIPColor,currentLineColor,deletionIndicationColor,filteredSearchResultIndicationColor,hyperlinkColor,hyperlinkColor.SystemDefault,infoIndicationColor,lineNumberColor,linked.slave.color,matchingTagIndicationColor,occurrenceIndicationColor,overrideIndicatorColor,printMarginColor,searchResultHighlighting,searchResultIndication,searchResultIndicationColor,searchResultTextStyle,secondaryIPColor,spellingIndicationColor,writeOccurrenceIndicationColor, @org.eclipse.cdt.lsp=1.0.0.202402211419

*** Current Install Configuration:

Id: com.espressif.idf.lsp, Version: 1.0.1.202405161213, Location: reference:file:/C:/Users/Steven/.p2/pool/plugins/com.espressif.idf.lsp_1.0.1.202405161213.jar Id: org.eclipse.cdt.lsp, Version: 1.0.0.202402211419, Location: reference:file:/C:/Users/Steven/.p2/pool/plugins/org.eclipse.cdt.lsp_1.0.0.202402211419.jar Id: org.eclipse.cdt.lsp.clangd, Version: 1.0.0.202402211419, Location: reference:file:/C:/Users/Steven/.p2/pool/plugins/org.eclipse.cdt.lsp.clangd_1.0.0.202402211419.jar Id: org.eclipse.lsp4e, Version: 0.18.6.202403050753, Location: reference:file:/C:/Users/Steven/.p2/pool/plugins/org.eclipse.lsp4e_0.18.6.202403050753.jar Id: org.eclipse.lsp4j, Version: 0.22.0.v20240213-2011, Location: reference:file:/C:/Users/Steven/.p2/pool/plugins/org.eclipse.lsp4j_0.22.0.v20240213-2011.jar Id: org.eclipse.lsp4j.jsonrpc, Version: 0.22.0.v20240213-2011, Location: reference:file:/C:/Users/Steven/.p2/pool/plugins/org.eclipse.lsp4j.jsonrpc_0.22.0.v20240213-2011.jar

*** Security Configuration:

Service: KeyGenerator, Algorithm: SunTlsPrf, Class: com.sun.crypto.provider.TlsPrfGenerator$V10 Service: KeyGenerator, Algorithm: SunTls12Prf, Class: com.sun.crypto.provider.TlsPrfGenerator$V12

ghentschke commented 4 months ago

@BenthamSoftwareServices this bug should be fixed by #321 . Can you please check if this issue has been fixed by testing it with the 2024-06 M3 release which comes later this week?

jonahgraham commented 4 months ago

Thanks @ghentschke for applying the fix.

@BenthamSoftwareServices can you try to apply the patch and let us know the results. We have ~2 weeks until we release so now is an excellent time to resolve this.

Yes I would like to try the patch, can you explain to me where it is and how to apply it please.

@BenthamSoftwareServices If you aren't an Eclipse developer then the above request by me may have been a bit too much to ask - please check out the new build available Friday as @ghentschke mentioned in the above comment.

That said, if you are using a vendor version of Eclipse you may need to contact the vendor to get an update.

jonahgraham commented 4 months ago

Closing this issue - the fix is pushed. Please comment or reopen if there is still something left to do here.

BenthamSoftwareServices commented 4 months ago

I assume the patch is live now, how exactly should I apply it? Thanks

BenthamSoftwareServices commented 4 months ago

I have installed 2024-06 and the problem I reported no longer occurs - thank you. Config now: Operating System: windows 11 Java Runtime Version: 22.0.1+8 Eclipse Version: 4.32.0.v20240525-0900 Eclipse CDT Version: 11.6.0.202403071917 IDF Eclipse Plugin Version: 3.0.0.202405281541 ESP-IDF v5.2.1-dirty Python set for IDF_PYTHON_ENV: Python 3.12.3