Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import org.eclipse.lsp4e.LanguageServiceAccessor;
import org.eclipse.ui.PlatformUI;

import com.espressif.idf.core.logging.Logger;

@SuppressWarnings("restriction")
public class LspService
{
Expand All @@ -29,6 +27,7 @@ public LspService()
this(PlatformUI.getWorkbench().getService(ClangdConfiguration.class),
LanguageServiceAccessor.getStartedWrappers(null, true).stream()
.filter(w -> "org.eclipse.cdt.lsp.server".equals(w.serverDefinition.id)).toList()); //$NON-NLS-1$

}

public LspService(Configuration configuration, List<LanguageServerWrapper> languageServerWrappers)
Expand All @@ -39,16 +38,9 @@ public LspService(Configuration configuration, List<LanguageServerWrapper> langu

public void restartLspServers()
{
languageServerWrappers.forEach(w -> {
try
{
w.restart();
}
catch (Exception e)
{
Logger.log(e);
}
});
languageServerWrappers.forEach(w ->
// ensures that the LS is initialized before proceeding.
w.execute(ls -> ls.shutdown()).thenRun(w::restart));
}

public void updateAdditionalOptions(String additionalOptions)
Expand All @@ -70,6 +62,16 @@ public void updateLspQueryDrivers()
}
}

public void updateClangdPath()
{
if (configuration.metadata() instanceof ClangdMetadata metadata)
{
String qualifier = configuration.qualifier();
InstanceScope.INSTANCE.getNode(qualifier).put(metadata.clangdPath().identifer(),
metadata.clangdPath().defaultValue());
}
}

public void updateCompileCommandsDir(String buildDir)
{
if (configuration.metadata() instanceof ClangdMetadata metadata)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
* @author Kondal Kolipaka <kondal.kolipaka@espressif.com>
*
*/
public class Messages extends NLS {
public class Messages extends NLS
{
private static final String BUNDLE_NAME = "com.espressif.idf.core.util.messages"; //$NON-NLS-1$
public static String FileUtil_CopyingMsg;
public static String FileUtil_DesDirNotavailable;
Expand Down Expand Up @@ -43,15 +44,20 @@ public class Messages extends NLS {
public static String NvsValidation_EncodingValidationErr_1;
public static String NvsValidation_KeyValidationErr_1;
public static String NvsValidation_KeyValidationErr_2;

public static String PortChecker_AttemptLimitExceededMsg;
public static String PortChecker_PortIsAvailable;
public static String PortChecker_PortNotAvailable;

static {
public static String LspService_RestartJobMsg;

static
{
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
private Messages() {

private Messages()
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ NvsValidation_KeyValidationErr_2=Maximum key length is 15 characters
PortChecker_AttemptLimitExceededMsg=The port selection attempt limit was exceeded. Returning last checked port
PortChecker_PortIsAvailable=Port %d is available
PortChecker_PortNotAvailable=Port %d is not available, trying next port: %d
LspService_RestartJobMsg=Restarting LSP server...
3 changes: 2 additions & 1 deletion bundles/com.espressif.idf.lsp/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Bundle-ManifestVersion: 2
Bundle-SymbolicName: com.espressif.idf.lsp;singleton:=true
Bundle-Vendor: ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD
Bundle-Version: 1.0.1.qualifier
Export-Package: com.espressif.idf.lsp
Export-Package: com.espressif.idf.lsp,
com.espressif.idf.lsp.preferences
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.cdt.lsp.clangd,
Expand Down
1 change: 1 addition & 0 deletions bundles/com.espressif.idf.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ Bundle-ClassPath: .,
lib/ini4j-0.5.4.jar,
lib/gson-2.8.7.jar,
lib/commonmark-0.16.1.jar
Import-Package: com.espressif.idf.lsp.preferences
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.espressif.idf.core.toolchain.ESPToolChainManager;
import com.espressif.idf.core.tools.vo.IDFToolSet;
import com.espressif.idf.core.util.IDFUtil;
import com.espressif.idf.core.util.LspService;
import com.espressif.idf.core.util.StringUtil;
import com.espressif.idf.ui.UIPlugin;
import com.espressif.idf.ui.update.ExportIDFTools;
Expand Down Expand Up @@ -94,7 +95,7 @@ protected IStatus run(IProgressMonitor monitor)

toolSetConfigurationManager.export(idfToolSet);
console.println("Tools Activated");

new LspService().updateClangdPath();
Preferences scopedPreferenceStore = InstanceScope.INSTANCE.getNode(UIPlugin.PLUGIN_ID);
scopedPreferenceStore.putBoolean(INSTALL_TOOLS_FLAG, true);
try
Expand Down