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
3 changes: 2 additions & 1 deletion bundles/com.espressif.idf.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ Require-Bundle: org.eclipse.core.runtime,
com.sun.jna.platform,
org.eclipse.cdt.lsp.clangd,
org.eclipse.cdt.lsp,
org.eclipse.lsp4e
org.eclipse.lsp4e,
org.eclipse.lsp4j
Bundle-RequiredExecutionEnvironment: JavaSE-17
Automatic-Module-Name: com.espressif.idf.core
Bundle-ActivationPolicy: lazy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
*******************************************************************************/
package com.espressif.idf.core.util;

import java.util.stream.Stream;
import java.util.List;

import org.eclipse.cdt.lsp.clangd.ClangdConfiguration;
import org.eclipse.cdt.lsp.clangd.ClangdMetadata;
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.lsp4e.LanguageServiceAccessor;
import org.eclipse.ui.PlatformUI;

import com.espressif.idf.core.logging.Logger;
Expand All @@ -20,17 +20,19 @@
public class LspService
{
private final Configuration configuration;
private final Stream<LanguageServerWrapper> languageServerWrappers;
private final List<LanguageServerWrapper> languageServerWrappers;

public LspService()
{
this(PlatformUI.getWorkbench().getService(ClangdConfiguration.class), LspUtils.getLanguageServers());
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, Stream<LanguageServerWrapper> languageServerWrappers)
public LspService(Configuration configuration, List<LanguageServerWrapper> languageServerWrappers)
{
this.configuration = configuration;
this.languageServerWrappers = languageServerWrappers;

Check warning on line 35 in bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/LspService.java

View workflow job for this annotation

GitHub Actions / spotbugs

EI_EXPOSE_REP2

new com.espressif.idf.core.util.LspService(Configuration, List) may expose internal representation by storing an externally mutable object into LspService.languageServerWrappers
Raw output
This code stores a reference to an externally mutable object into the internal representation of the object.  If instances are accessed by untrusted code, and unchecked changes to the mutable object would compromise security or other important properties, you will need to do something different. Storing a copy of the object is better approach in many situations.
}

public void restartLspServers()
Expand Down
Loading