From 8784a80d2a7af13e2927d114f136fa392d9c2265 Mon Sep 17 00:00:00 2001 From: Kondal Kolipaka Date: Mon, 12 Aug 2024 10:21:38 +0530 Subject: [PATCH] fix: Address issue with the cdt-lsp-2.0.0 (#1021) * fix: Address issues witheclipse 4.32 and cdt-lsp 2.0 --- .../espressif/idf/core/util/LspService.java | 7 ++-- .../preferences/IDFClangdOptionsDefaults.java | 41 ++++++++++++++++--- .../com.espressif.idf.target.target | 28 ++++++------- 3 files changed, 52 insertions(+), 24 deletions(-) diff --git a/bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/LspService.java b/bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/LspService.java index a17ba2a61..93f519b71 100644 --- a/bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/LspService.java +++ b/bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/LspService.java @@ -4,13 +4,12 @@ *******************************************************************************/ package com.espressif.idf.core.util; -import java.io.IOException; import java.util.stream.Stream; -import org.eclipse.cdt.lsp.LspUtils; import org.eclipse.cdt.lsp.clangd.ClangdConfiguration; import org.eclipse.cdt.lsp.clangd.ClangdMetadata; -import org.eclipse.cdt.lsp.editor.Configuration; +import org.eclipse.cdt.lsp.config.Configuration; +import org.eclipse.cdt.lsp.util.LspUtils; import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.lsp4e.LanguageServerWrapper; import org.eclipse.ui.PlatformUI; @@ -41,7 +40,7 @@ public void restartLspServers() { w.restart(); } - catch (IOException e) + catch (Exception e) { Logger.log(e); } diff --git a/bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/preferences/IDFClangdOptionsDefaults.java b/bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/preferences/IDFClangdOptionsDefaults.java index 14c7362e6..613759fb2 100644 --- a/bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/preferences/IDFClangdOptionsDefaults.java +++ b/bundles/com.espressif.idf.lsp/src/com/espressif/idf/lsp/preferences/IDFClangdOptionsDefaults.java @@ -4,9 +4,10 @@ *******************************************************************************/ package com.espressif.idf.lsp.preferences; +import java.util.Collections; +import java.util.List; import java.util.Optional; -import org.eclipse.cdt.lsp.clangd.BuiltinClangdOptionsDefaults; import org.eclipse.cdt.lsp.clangd.ClangdOptionsDefaults; import org.osgi.service.component.annotations.Component; @@ -18,9 +19,8 @@ * @author Kondal Kolipaka * */ -@SuppressWarnings("restriction") @Component(service = ClangdOptionsDefaults.class, property = { "service.ranking:Integer=100" }) -public class IDFClangdOptionsDefaults extends BuiltinClangdOptionsDefaults +public class IDFClangdOptionsDefaults implements ClangdOptionsDefaults { @Override @@ -34,10 +34,41 @@ public String clangdPath() @Override public String queryDriver() { - // By passing --query-driver argument to clangd helps to resolve the cross-compiler toolchain headers. + // By passing --query-driver argument to clangd helps to resolve the + // cross-compiler toolchain headers. String toolchainPath = IDFUtil.getToolchainExePathForActiveTarget(); Logger.log("toolchain path: " + toolchainPath); //$NON-NLS-1$ - return Optional.ofNullable(toolchainPath).orElse(super.queryDriver()); + return Optional.ofNullable(toolchainPath).orElse(""); + } + + @Override + public boolean useTidy() + { + return true; + } + + @Override + public boolean useBackgroundIndex() + { + return true; + } + + @Override + public String completionStyle() + { + return "detailed"; //$NON-NLS-1$ + } + + @Override + public boolean prettyPrint() + { + return true; + } + + @Override + public List additionalOptions() + { + return Collections.emptyList(); } } diff --git a/releng/com.espressif.idf.target/com.espressif.idf.target.target b/releng/com.espressif.idf.target/com.espressif.idf.target.target index cf0f4ed25..7a2c46c0a 100644 --- a/releng/com.espressif.idf.target/com.espressif.idf.target.target +++ b/releng/com.espressif.idf.target/com.espressif.idf.target.target @@ -3,7 +3,7 @@ - + @@ -19,7 +19,7 @@ - + @@ -87,11 +87,6 @@ - - - - - @@ -100,14 +95,12 @@ - - - - - - - - + + + + + + @@ -139,5 +132,10 @@ + + + + + \ No newline at end of file